]> SALOME platform Git repositories - modules/smesh.git/blob - src/MEDWrapper/Base/MED_TWrapper.hxx
Salome HOME
CMake:
[modules/smesh.git] / src / MEDWrapper / Base / MED_TWrapper.hxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 #ifndef MED_TWrapper_HeaderFile
23 #define MED_TWrapper_HeaderFile
24
25 #include "MED_TStructures.hxx"
26 #include "MED_Wrapper.hxx"
27
28 namespace MED
29 {
30
31   template<EVersion eVersion>
32   class TTWrapper: public TWrapper
33   {
34   public:
35     //----------------------------------------------------------------------------
36     //! Gets version of the MED library used for the MED file
37     virtual 
38     EVersion
39     GetVersion()
40     {
41       return eVersion;
42     }
43     
44     //----------------------------------------------------------------------------
45     virtual 
46     PMeshInfo
47     CrMeshInfo(TInt theDim = 0, TInt theSpaceDim = 0,
48                const std::string& theValue = "",
49                EMaillage theType = eNON_STRUCTURE,
50                const std::string& theDesc = "")
51     {
52       return PMeshInfo(new TTMeshInfo<eVersion>
53                        (theDim,
54                         theSpaceDim,
55                         theValue,
56                         theType,
57                         theDesc));
58     }
59
60     virtual 
61     PMeshInfo
62     CrMeshInfo(const PMeshInfo& theInfo)
63     {
64       return PMeshInfo(new TTMeshInfo<eVersion>(theInfo));
65     }
66     
67
68     //----------------------------------------------------------------------------
69     virtual
70     PFamilyInfo
71     CrFamilyInfo(const PMeshInfo& theMeshInfo,
72                  TInt theNbGroup = 0, 
73                  TInt theNbAttr = 0,
74                  TInt theId = 0,
75                  const std::string& theValue = "")
76     {
77       return PFamilyInfo(new TTFamilyInfo<eVersion>
78                          (theMeshInfo,
79                           theNbGroup,
80                           theNbAttr,
81                           theId,
82                           theValue));
83     }
84
85     virtual
86     PFamilyInfo
87     CrFamilyInfo(const PMeshInfo& theMeshInfo,
88                  const std::string& theValue,
89                  TInt theId,
90                  const MED::TStringSet& theGroupNames, 
91                  const MED::TStringVector& theAttrDescs = MED::TStringVector(), 
92                  const MED::TIntVector& theAttrIds = MED::TIntVector(), 
93                  const MED::TIntVector& theAttrVals = MED::TIntVector())
94     {
95       return PFamilyInfo(new TTFamilyInfo<eVersion>
96                          (theMeshInfo,
97                           theValue,
98                           theId,
99                           theGroupNames,
100                           theAttrDescs,
101                           theAttrIds,
102                           theAttrVals));
103     }
104
105     virtual
106     PFamilyInfo
107     CrFamilyInfo(const PMeshInfo& theMeshInfo,
108                  const PFamilyInfo& theInfo)
109     {
110       return PFamilyInfo(new TTFamilyInfo<eVersion>
111                          (theMeshInfo,
112                           theInfo));
113     }
114
115     //----------------------------------------------------------------------------
116     virtual
117     PElemInfo
118     CrElemInfo(const PMeshInfo& theMeshInfo, 
119                TInt theNbElem,
120                EBooleen theIsElemNum = eVRAI,
121                EBooleen theIsElemNames = eVRAI)
122     {
123       return PElemInfo(new TTElemInfo<eVersion>
124                        (theMeshInfo,
125                         theNbElem,
126                         theIsElemNum,
127                         theIsElemNames));
128     }
129
130     virtual
131     PElemInfo
132     CrElemInfo(const PMeshInfo& theMeshInfo, 
133                TInt theNbElem,
134                const TIntVector& theFamNum,
135                const TIntVector& aElemNum,
136                const TStringVector& aElemNames)
137     {
138       return PElemInfo(new TTElemInfo<eVersion>
139                        (theMeshInfo,
140                         theNbElem,
141                         theFamNum,
142                         aElemNum,
143                         aElemNames));
144     }
145
146     //----------------------------------------------------------------------------
147     virtual
148     PNodeInfo
149     CrNodeInfo(const PMeshInfo& theMeshInfo, 
150                TInt theNbElem,
151                EModeSwitch theMode = eFULL_INTERLACE,
152                ERepere theSystem = eCART, 
153                EBooleen theIsElemNum = eVRAI,
154                EBooleen theIsElemNames = eVRAI)
155     {
156       return PNodeInfo(new TTNodeInfo<eVersion>
157                        (theMeshInfo,
158                         theNbElem,
159                         theMode,
160                         theSystem,
161                         theIsElemNum,
162                         theIsElemNames));
163     }
164
165     virtual 
166     PNodeInfo
167     CrNodeInfo(const PMeshInfo& theMeshInfo, 
168                const TFloatVector& theNodeCoords,
169                EModeSwitch theMode = eFULL_INTERLACE,
170                ERepere theSystem = eCART, 
171                const TStringVector& theCoordNames = TStringVector(),
172                const TStringVector& theCoordUnits = TStringVector(),
173                const TIntVector& theFamilyNums = TIntVector(),
174                const TIntVector& theElemNums = TIntVector(),
175                const TStringVector& theElemNames = TStringVector())
176     {
177       return PNodeInfo(new TTNodeInfo<eVersion>
178                        (theMeshInfo,
179                         theNodeCoords,
180                         theMode,
181                         theSystem,
182                         theCoordNames,
183                         theCoordUnits,
184                         theFamilyNums,
185                         theElemNums,
186                         theElemNames));
187     }
188
189     virtual 
190     PNodeInfo
191     CrNodeInfo(const PMeshInfo& theMeshInfo,
192                const PNodeInfo& theInfo)
193     {
194       return PNodeInfo(new TTNodeInfo<eVersion>
195                        (theMeshInfo,
196                         theInfo));
197     }
198     
199     //----------------------------------------------------------------------------
200     virtual
201     PPolygoneInfo
202     CrPolygoneInfo(const PMeshInfo& theMeshInfo, 
203                    EEntiteMaillage theEntity, 
204                    EGeometrieElement theGeom,
205                    TInt theNbElem,
206                    TInt theConnSize,
207                    EConnectivite theConnMode = eNOD,
208                    EBooleen theIsElemNum = eVRAI,
209                    EBooleen theIsElemNames = eVRAI)
210     {
211       return PPolygoneInfo(new TTPolygoneInfo<eVersion>
212                            (theMeshInfo,
213                             theEntity,
214                             theGeom,
215                             theNbElem,
216                             theConnSize,
217                             theConnMode,
218                             theIsElemNum,
219                             theIsElemNames));
220     }
221
222     virtual
223     PPolygoneInfo
224     CrPolygoneInfo(const PMeshInfo& theMeshInfo, 
225                    EEntiteMaillage theEntity, 
226                    EGeometrieElement theGeom,
227                    const TIntVector& theIndexes,
228                    const TIntVector& theConnectivities,
229                    EConnectivite theConnMode = eNOD,
230                    const TIntVector& theFamilyNums = TIntVector(),
231                    const TIntVector& theElemNums = TIntVector(),
232                    const TStringVector& theElemNames = TStringVector())
233     {
234       return PPolygoneInfo(new TTPolygoneInfo<eVersion>
235                            (theMeshInfo,
236                             theEntity,
237                             theGeom,
238                             theIndexes,
239                             theConnectivities,
240                             theConnMode,
241                             theFamilyNums,
242                             theElemNums,
243                             theElemNames));
244     }
245
246     virtual
247     PPolygoneInfo
248     CrPolygoneInfo(const PMeshInfo& theMeshInfo,
249                    const PPolygoneInfo& theInfo)
250     {
251       return PPolygoneInfo(new TTPolygoneInfo<eVersion>
252                            (theMeshInfo,
253                             theInfo));
254     }
255     
256     //----------------------------------------------------------------------------
257     virtual
258     PPolyedreInfo
259     CrPolyedreInfo(const PMeshInfo& theMeshInfo, 
260                    EEntiteMaillage theEntity, 
261                    EGeometrieElement theGeom,
262                    TInt theNbElem,
263                    TInt theNbFaces,
264                    TInt theConnSize,
265                    EConnectivite theConnMode = eNOD,
266                    EBooleen theIsElemNum = eVRAI,
267                    EBooleen theIsElemNames = eVRAI)
268     {
269       return PPolyedreInfo(new TTPolyedreInfo<eVersion>
270                            (theMeshInfo,
271                             theEntity,
272                             theGeom,
273                             theNbElem,
274                             theNbFaces,
275                             theConnSize,
276                             theConnMode,
277                             theIsElemNum,
278                             theIsElemNames));
279     }
280
281     virtual
282     PPolyedreInfo
283     CrPolyedreInfo(const PMeshInfo& theMeshInfo, 
284                    EEntiteMaillage theEntity, 
285                    EGeometrieElement theGeom,
286                    const TIntVector& theIndexes,
287                    const TIntVector& theFaces,
288                    const TIntVector& theConnectivities,
289                    EConnectivite theConnMode = eNOD,
290                    const TIntVector& theFamilyNums = TIntVector(),
291                    const TIntVector& theElemNums = TIntVector(),
292                    const TStringVector& theElemNames = TStringVector())
293     {
294       return PPolyedreInfo(new TTPolyedreInfo<eVersion>
295                            (theMeshInfo,
296                             theEntity,
297                             theGeom,
298                             theIndexes,
299                             theFaces,
300                             theConnectivities,
301                             theConnMode,
302                             theFamilyNums,
303                             theElemNums,
304                             theElemNames));
305     }
306
307     virtual
308     PPolyedreInfo
309     CrPolyedreInfo(const PMeshInfo& theMeshInfo,
310                    const PPolyedreInfo& theInfo)
311     {
312       return PPolyedreInfo(new TTPolyedreInfo<eVersion>
313                            (theMeshInfo,
314                             theInfo));
315     }
316
317     //----------------------------------------------------------------------------
318     virtual
319     PCellInfo
320     CrCellInfo(const PMeshInfo& theMeshInfo, 
321                EEntiteMaillage theEntity, 
322                EGeometrieElement theGeom,
323                TInt theNbElem,
324                EConnectivite theConnMode = eNOD,
325                EBooleen theIsElemNum = eVRAI,
326                EBooleen theIsElemNames = eVRAI,
327                EModeSwitch theMode = eFULL_INTERLACE)
328     {
329       return PCellInfo(new TTCellInfo<eVersion>
330                        (theMeshInfo,
331                         theEntity,
332                         theGeom,
333                         theNbElem,
334                         theConnMode,
335                         theIsElemNum,
336                         theIsElemNames,
337                         theMode));
338     }
339
340     virtual
341     PCellInfo
342     CrCellInfo(const PMeshInfo& theMeshInfo, 
343                EEntiteMaillage theEntity, 
344                EGeometrieElement theGeom,
345                const TIntVector& theConnectivities,
346                EConnectivite theConnMode = eNOD,
347                const TIntVector& theFamilyNums = TIntVector(),
348                const TIntVector& theElemNums = TIntVector(),
349                const TStringVector& theElemNames = TStringVector(),
350                EModeSwitch theMode = eFULL_INTERLACE)
351     {
352       return PCellInfo(new TTCellInfo<eVersion>
353                        (theMeshInfo,
354                         theEntity,
355                         theGeom,
356                         theConnectivities,
357                         theConnMode,
358                         theFamilyNums,
359                         theElemNums,
360                         theElemNames,
361                         theMode));
362     }
363
364     virtual
365     PCellInfo
366     CrCellInfo(const PMeshInfo& theMeshInfo,
367                const PCellInfo& theInfo)
368     {
369       return PCellInfo(new TTCellInfo<eVersion>
370                        (theMeshInfo,
371                         theInfo));
372     }
373     
374     //----------------------------------------------------------------------------
375     //! Creates a MEDWrapper MED Balls representation
376     virtual PBallInfo CrBallInfo(const PMeshInfo& theMeshInfo, 
377                                  TInt             theNbBalls,
378                                  EBooleen         theIsElemNum = eVRAI)
379     {
380       return PBallInfo( new TTBallInfo<eVersion>( theMeshInfo, theNbBalls, theIsElemNum ));
381     }
382
383     //! Creates a MEDWrapper MED Balls representation
384     virtual PBallInfo CrBallInfo(const PMeshInfo&  theMeshInfo, 
385                                  const TIntVector& theNodes,
386                                  TFloatVector&     theDiameters,
387                                  const TIntVector& theFamilyNums = TIntVector(),
388                                  const TIntVector& theElemNums = TIntVector())
389     {
390       return PBallInfo( new TTBallInfo<eVersion>( theMeshInfo, theNodes, theDiameters,
391                                                   theFamilyNums, theElemNums));
392     }
393
394     //! A copy-constructor for the MEDWrapper MED Balls representation
395     virtual PBallInfo CrBallInfo(const PMeshInfo& theMeshInfo,
396                                  const PBallInfo& theInfo)
397     {
398       return PBallInfo( new TTBallInfo<eVersion>( theMeshInfo, theInfo ));
399     }
400
401     //----------------------------------------------------------------------------
402     virtual
403     PFieldInfo
404     CrFieldInfo(const PMeshInfo& theMeshInfo, 
405                 TInt theNbComp = 0,
406                 ETypeChamp theType = eFLOAT64,
407                 const std::string& theValue = "",
408                 EBooleen theIsLocal = eVRAI,
409                 TInt theNbRef = 1)
410     {
411       return PFieldInfo(new TTFieldInfo<eVersion>
412                         (theMeshInfo,
413                          theNbComp,
414                          theType,
415                          theValue,
416                          theIsLocal,
417                          theNbRef));
418     }
419
420     virtual
421     PFieldInfo
422     CrFieldInfo(const PMeshInfo& theMeshInfo,
423                 const PFieldInfo& theInfo)
424     {
425       return PFieldInfo(new TTFieldInfo<eVersion>
426                         (theMeshInfo,
427                          theInfo));
428     }
429     
430
431     //----------------------------------------------------------------------------
432     virtual
433     PTimeStampInfo
434     CrTimeStampInfo(const PFieldInfo& theFieldInfo, 
435                     EEntiteMaillage theEntity,
436                     const TGeom2Size& theGeom2Size,
437                     const TGeom2NbGauss& theGeom2NbGauss = TGeom2NbGauss(),
438                     TInt theNumDt = 0,
439                     TInt theNumOrd = 0,
440                     TFloat theDt = 0,
441                     const std::string& theUnitDt = "",
442                     const TGeom2Gauss& theGeom2Gauss = TGeom2Gauss())
443     {
444       return PTimeStampInfo(new TTTimeStampInfo<eVersion>
445                             (theFieldInfo,
446                              theEntity,
447                              theGeom2Size,
448                              theGeom2NbGauss,
449                              theNumDt,
450                              theNumOrd,
451                              theDt,
452                              theUnitDt,
453                              theGeom2Gauss));
454     }
455
456     virtual
457     PTimeStampInfo
458     CrTimeStampInfo(const PFieldInfo& theFieldInfo,
459                     const PTimeStampInfo& theInfo)
460     {
461       return PTimeStampInfo(new TTTimeStampInfo<eVersion>
462                             (theFieldInfo,
463                              theInfo));
464     }
465
466
467     //----------------------------------------------------------------------------
468     virtual
469     PGaussInfo
470     CrGaussInfo(const TGaussInfo::TInfo& theInfo,
471                 EModeSwitch theMode = eFULL_INTERLACE)
472     {
473       return PGaussInfo(new TTGaussInfo<eVersion>
474                         (theInfo,
475                          theMode));
476     }
477     
478
479     //----------------------------------------------------------------------------
480     virtual
481     PProfileInfo
482     CrProfileInfo(const TProfileInfo::TInfo& theInfo,
483                   EModeProfil theMode = eCOMPACT)
484     {
485       return PProfileInfo(new TTProfileInfo<eVersion>
486                            (theInfo,
487                             theMode));
488     }
489     
490
491     //----------------------------------------------------------------------------
492     virtual
493     PTimeStampValueBase
494     CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
495                      ETypeChamp theTypeChamp,
496                      const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
497                      EModeSwitch theMode = eFULL_INTERLACE)
498     {
499       if(theTypeChamp == eFLOAT64)
500         return PTimeStampValueBase(new TTTimeStampValue<eVersion, TFloatMeshValue>
501                                    (theTimeStampInfo,
502                                     theTypeChamp,
503                                     theGeom2Profile,
504                                     theMode));
505       return PTimeStampValueBase(new TTTimeStampValue<eVersion, TIntMeshValue>
506                                  (theTimeStampInfo,
507                                   theTypeChamp,
508                                   theGeom2Profile,
509                                   theMode));
510     }
511
512     virtual
513     PTimeStampValueBase
514     CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
515                      const PTimeStampValueBase& theInfo,
516                      ETypeChamp theTypeChamp)
517     {
518       if(theTypeChamp == eFLOAT64)
519         return PTimeStampValueBase(new TTTimeStampValue<eVersion, TFloatMeshValue>
520                                    (theTimeStampInfo,
521                                     theInfo,
522                                     theTypeChamp));
523       return PTimeStampValueBase(new TTTimeStampValue<eVersion, TIntMeshValue>
524                                  (theTimeStampInfo,
525                                   theInfo,
526                                   theTypeChamp));
527     }
528     
529     //----------------------------------------------------------------------------
530     virtual
531     PGrilleInfo
532     CrGrilleInfo(const PMeshInfo& theMeshInfo,
533                  const PGrilleInfo& theInfo)
534     {
535       return PGrilleInfo(new TTGrilleInfo<eVersion>
536                             (theMeshInfo,
537                              theInfo));
538     }
539     virtual
540     PGrilleInfo
541     CrGrilleInfo(const PMeshInfo& theMeshInfo,
542                  const EGrilleType& type)
543     {
544       return PGrilleInfo(new TTGrilleInfo<eVersion>
545                             (theMeshInfo,
546                              type));
547     }
548
549     virtual
550     PGrilleInfo
551     CrGrilleInfo(const PMeshInfo& theMeshInfo,
552                  const EGrilleType& type,
553                  const TInt& nbNodes)
554     {
555       return PGrilleInfo(new TTGrilleInfo<eVersion>
556                             (theMeshInfo,
557                              type,
558                              nbNodes));
559     }
560
561     virtual
562     PGrilleInfo
563     CrGrilleInfo(const PMeshInfo& theMeshInfo,
564                  const EGrilleType& type,
565                  const MED::TIntVector& nbNodeVec)
566     {
567       return PGrilleInfo(new TTGrilleInfo<eVersion>
568                             (theMeshInfo,
569                              type,
570                              nbNodeVec));
571     }
572     //----------------------------------------------------------------------------
573   };
574
575 }
576
577
578 #endif