]> SALOME platform Git repositories - modules/smesh.git/blob - src/MEDWrapper/MED_Wrapper.hxx
Salome HOME
19b29f8a860fc6efcef7db84fee2c1d6629b67f8
[modules/smesh.git] / src / MEDWrapper / MED_Wrapper.hxx
1 // Copyright (C) 2007-2016  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, or (at your option) any later version.
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
23 #ifndef MED_Wrapper_HeaderFile
24 #define MED_Wrapper_HeaderFile
25
26 #include "MED_WrapperDef.hxx"
27 #include "MED_Structures.hxx"
28 #include "MED_Algorithm.hxx"
29
30 #include <boost/thread/mutex.hpp>
31
32 namespace MED
33 {
34   //----------------------------------------------------------------------------
35   //! Define a base class that wraps the MED API
36   struct MEDWRAPPER_EXPORT TWrapper
37   {
38     typedef boost::mutex TMutex;
39     //! This is a syncronization primitive which allow to support thread safety for the MED access
40     TMutex myMutex;
41
42     virtual
43     ~TWrapper();
44
45     //----------------------------------------------------------------------------
46     //! Creates a MEDWrapper MED Mesh representation
47     virtual 
48     PMeshInfo 
49     CrMeshInfo(TInt theDim = 0, TInt theSpaceDim = 0,
50                const std::string& theValue = "",
51                EMaillage theType = eNON_STRUCTURE,
52                const std::string& theDesc = "") = 0;
53
54     //! A copy-constructor for the MEDWrapper MED Mesh representation
55     virtual 
56     PMeshInfo 
57     CrMeshInfo(const PMeshInfo& theInfo) = 0;
58
59     //! Read number of MED Mesh entities in the defined MED file
60     virtual 
61     TInt 
62     GetNbMeshes(TErr* theErr = NULL) = 0;
63     
64     //! Read a MEDWrapper MED Mesh representation by its number
65     virtual 
66     void 
67     GetMeshInfo(TInt theMeshId, 
68                 TMeshInfo& theInfo,
69                 TErr* theErr = NULL) = 0;
70
71     //! Write the MEDWrapper MED Mesh representation in the defined MED file
72     virtual 
73     void
74     SetMeshInfo(const TMeshInfo& theInfo,
75                 TErr* theErr = NULL) = 0;
76     
77     //! Read a MEDWrapper MED Mesh representation by its number
78     virtual 
79     PMeshInfo
80     GetPMeshInfo(TInt theId,
81                  TErr* theErr = NULL);
82
83     //----------------------------------------------------------------------------
84     //! Read number of MED Family entities in the defined MED file
85     virtual 
86     TInt
87     GetNbFamilies(const TMeshInfo& theMeshInfo,
88                   TErr* theErr = NULL) = 0;
89
90     //! Read number of attributes for defined MED Family
91     virtual 
92     TInt
93     GetNbFamAttr(TInt theFamId, 
94                  const TMeshInfo& theInfo,
95                  TErr* theErr = NULL) = 0;
96     
97     //! Read number of MED Groups where MED Family with the number belong to
98     virtual
99     TInt
100     GetNbFamGroup(TInt theFamId, 
101                   const TMeshInfo& theInfo,
102                   TErr* theErr = NULL) = 0;
103     
104     //! Read a MEDWrapper MED Family representation by its number
105     virtual
106     void
107     GetFamilyInfo(TInt theFamId, 
108                   TFamilyInfo& theInfo,
109                   TErr* theErr = NULL) = 0;
110     
111     //! Write a MEDWrapper MED Family representation by its number
112     virtual
113     void
114     SetFamilyInfo(const TFamilyInfo& theInfo,
115                   TErr* theErr = NULL) = 0;
116     
117     //! Creates a MEDWrapper MED Family representation
118     virtual 
119     PFamilyInfo
120     CrFamilyInfo(const PMeshInfo& theMeshInfo,
121                  TInt theNbGroup = 0, 
122                  TInt theNbAttr = 0,
123                  TInt theId = 0,
124                  const std::string& theValue = "") = 0;
125     
126     //! Creates a MEDWrapper MED Family representation
127     virtual 
128     PFamilyInfo
129     CrFamilyInfo(const PMeshInfo& theMeshInfo,
130                  const std::string& theValue,
131                  TInt theId,
132                  const TStringSet& theGroupNames, 
133                  const TStringVector& theAttrDescs = TStringVector(), 
134                  const TIntVector& theAttrIds = TIntVector(), 
135                  const TIntVector& theAttrVals = TIntVector()) = 0;
136     
137     //! A copy-constructor for the MEDWrapper MED Family representation
138     virtual
139     PFamilyInfo
140     CrFamilyInfo(const PMeshInfo& theMeshInfo,
141                  const PFamilyInfo& theInfo) = 0;
142     
143     //! Write a MEDWrapper MED Family representation by its number
144     PFamilyInfo
145     GetPFamilyInfo(const PMeshInfo& theMeshInfo, 
146                    TInt theId,
147                    TErr* theErr = NULL);
148     
149     //----------------------------------------------------------------------------
150     //! Read sequence of names for any descendant of TElemInfo
151     virtual
152     void
153     GetNames(TElemInfo& theInfo,
154              TInt theNb,
155              EEntiteMaillage theEntity, 
156              EGeometrieElement theGeom,
157              TErr* theErr = NULL)
158     {}
159
160     //! Read sequence of numerous for any descendant of TElemInfo
161     virtual
162     void
163     GetNumeration(TElemInfo& theInfo,
164                   TInt theNb,
165                   EEntiteMaillage theEntity, 
166                   EGeometrieElement theGeom,
167                   TErr* theErr = NULL)
168     {}
169
170     //! Read sequence MED Family indexes for any descendant of TElemInfo
171     virtual
172     void
173     GetFamilies(TElemInfo& theInfo,
174                 TInt theNb,
175                 EEntiteMaillage theEntity, 
176                 EGeometrieElement theGeom,
177                 TErr* theErr = NULL)
178     {}
179
180     //! Write sequence of names for any descendant of TElemInfo
181     virtual
182     void
183     SetNames(const TElemInfo& theInfo,
184              EEntiteMaillage theEntity, 
185              EGeometrieElement theGeom,
186              TErr* theErr = NULL)
187     {}
188
189     //! Write sequence of numerous for any descendant of TElemInfo
190     virtual
191     void
192     SetNumeration(const TElemInfo& theInfo,
193                   EEntiteMaillage theEntity, 
194                   EGeometrieElement theGeom,
195                   TErr* theErr = NULL)
196     {}
197
198     //! Write sequence MED Family indexes for any descendant of TElemInfo
199     virtual
200     void
201     SetFamilies(const TElemInfo& theInfo,
202                 EEntiteMaillage theEntity, 
203                 EGeometrieElement theGeom,
204                 TErr* theErr = NULL)
205     {}
206
207     //! Read a MEDWrapper MED Element representation from defined MED file
208     PElemInfo
209     GetPElemInfo(const PMeshInfo& theMeshInfo,
210                  EEntiteMaillage theEntity = eNOEUD, 
211                  EGeometrieElement theGeom = ePOINT1, 
212                  EConnectivite theConnMode = eNOD,
213                  TErr* theErr = NULL);
214
215     //----------------------------------------------------------------------------
216     //! Read number of nodes in defined MED Mesh
217     virtual
218     TInt
219     GetNbNodes(const TMeshInfo& theMeshInfo,
220                TErr* theErr = NULL) = 0;
221     
222     virtual
223     TInt
224     GetNbNodes(const TMeshInfo& theMeshInfo,
225                ETable theTable,
226                TErr* theErr = NULL)
227     {
228       return 0;
229     }
230
231     //! Read a MEDWrapper MED Nodes representation from defined MED file
232     virtual
233     void
234     GetNodeInfo(TNodeInfo& theInfo,
235                 TErr* theErr = NULL) = 0;
236
237     //! Write the MEDWrapper MED Nodes representation into defined MED file
238     virtual 
239     void
240     SetNodeInfo(const TNodeInfo& theInfo,
241                 TErr* theErr = NULL) = 0;
242     
243     //! Creates a MEDWrapper MED Nodes representation
244     virtual 
245     PElemInfo
246     CrElemInfo(const PMeshInfo& theMeshInfo, 
247                TInt theNbElem,
248                EBooleen theIsElemNum = eVRAI,
249                EBooleen theIsElemNames = eVRAI)
250     {
251       return PElemInfo();
252     }
253
254     //! Creates a MEDWrapper MED Nodes representation
255     virtual 
256     PElemInfo
257     CrElemInfo(const PMeshInfo& theMeshInfo, 
258                TInt theNbElem,
259                const TIntVector& theFamNum,
260                const TIntVector& aElemNum,
261                const TStringVector& aElemNames)
262     {
263       return PElemInfo();
264     }
265
266     //! Creates a MEDWrapper MED Nodes representation
267     virtual
268     PNodeInfo
269     CrNodeInfo(const PMeshInfo& theMeshInfo, 
270                TInt theNbElem,
271                EModeSwitch theMode = eFULL_INTERLACE,
272                ERepere theSystem = eCART, 
273                EBooleen theIsElemNum = eVRAI,
274                EBooleen theIsElemNames = eVRAI) = 0;
275
276     //! Creates a MEDWrapper MED Nodes representation
277     virtual 
278     PNodeInfo
279     CrNodeInfo(const PMeshInfo& theMeshInfo, 
280                const TFloatVector& theNodeCoords,
281                EModeSwitch theMode = eFULL_INTERLACE,
282                ERepere theSystem = eCART, 
283                const TStringVector& theCoordNames = TStringVector(),
284                const TStringVector& theCoordUnits = TStringVector(),
285                const TIntVector& theFamilyNums = TIntVector(),
286                const TIntVector& theElemNums = TIntVector(),
287                const TStringVector& theElemNames = TStringVector()) = 0;
288     
289     //! A copy-constructor for the MEDWrapper MED Nodes representation
290     virtual
291     PNodeInfo
292     CrNodeInfo(const PMeshInfo& theMeshInfo,
293                const PNodeInfo& theInfo) = 0;
294     
295     //! Read a MEDWrapper MED Nodes representation from defined MED file
296     PNodeInfo
297     GetPNodeInfo(const PMeshInfo& theMeshInfo,
298                  TErr* theErr = NULL);
299     
300     //----------------------------------------------------------------------------
301     //! Read a MEDWrapper MED Polygones representation from defined MED file
302     /*! This feature is supported only for version of 2.2 and higher */
303     virtual
304     void
305     GetPolygoneInfo(TPolygoneInfo& theInfo,
306                     TErr* theErr = NULL) 
307     {}
308
309     //! Write a MEDWrapper MED Polygones representation from defined MED file
310     /*! This feature is supported only for version of 2.2 and higher */
311     virtual
312     void
313     SetPolygoneInfo(const TPolygoneInfo& theInfo,
314                     TErr* theErr = NULL) 
315     {}
316
317     //! Read number of MED Polygones in defined MED Mesh
318     /*! This feature is supported only for version of 2.2 and higher */
319     virtual
320     TInt
321     GetNbPolygones(const TMeshInfo& theMeshInfo,
322                    EEntiteMaillage theEntity,
323                    EGeometrieElement theGeom,
324                    EConnectivite theConnMode = eNOD,
325                    TErr* theErr = NULL) 
326     { 
327       return 0;
328     }
329
330     //! Read connectivity infroamtion for the MED Polygones in defined MED Mesh
331     /*! This feature is supported only for version of 2.2 and higher */
332     virtual
333     TInt
334     GetPolygoneConnSize(const TMeshInfo& theMeshInfo,
335                         EEntiteMaillage theEntity,
336                         EGeometrieElement theGeom,
337                         EConnectivite theConnMode = eNOD,
338                         TErr* theErr = NULL)
339     { 
340       return 0;
341     }
342     
343     //! Creates a MEDWrapper MED Polygones representation
344     /*! This feature is supported only for version of 2.2 and higher */
345     virtual 
346     PPolygoneInfo
347     CrPolygoneInfo(const PMeshInfo& theMeshInfo, 
348                    EEntiteMaillage theEntity, 
349                    EGeometrieElement theGeom,
350                    TInt theNbElem,
351                    TInt theConnSize,
352                    EConnectivite theConnMode = eNOD,
353                    EBooleen theIsElemNum = eVRAI,
354                    EBooleen theIsElemNames = eVRAI)
355     {
356       return PPolygoneInfo();
357     }
358     
359     //! Creates a MEDWrapper MED Polygones representation
360     /*! This feature is supported only for version of 2.2 and higher */
361     virtual
362     PPolygoneInfo 
363     CrPolygoneInfo(const PMeshInfo& theMeshInfo, 
364                    EEntiteMaillage theEntity, 
365                    EGeometrieElement theGeom,
366                    const TIntVector& theIndexes,
367                    const TIntVector& theConnectivities,
368                    EConnectivite theConnMode = eNOD,
369                    const TIntVector& theFamilyNums = TIntVector(),
370                    const TIntVector& theElemNums = TIntVector(),
371                    const TStringVector& theElemNames = TStringVector())
372     {
373       return PPolygoneInfo();
374     }
375
376     //! A copy-constructor for the MEDWrapper MED Polygones representation
377     virtual
378     PPolygoneInfo
379     CrPolygoneInfo(const PMeshInfo& theMeshInfo,
380                    const PPolygoneInfo& theInfo)
381     {
382       return PPolygoneInfo();
383     }
384     
385     //! Read a MEDWrapper MED Polygones representation from defined MED file
386     /*! This feature is support only for version of 2.2 and higher */
387     PPolygoneInfo
388     GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
389                      EEntiteMaillage theEntity, 
390                      EGeometrieElement theGeom, 
391                      EConnectivite theConnMode = eNOD);
392     
393     //----------------------------------------------------------------------------
394     //! Read a MEDWrapper MED Polyedres representation from defined MED file
395     /*! This feature is support only for version of 2.2 and higher */
396     virtual 
397     void
398     GetPolyedreInfo(TPolyedreInfo& theInfo,
399                     TErr* theErr = NULL) 
400     {}
401
402     //! Write a MEDWrapper MED Polyedres representation from defined MED file
403     /*! This feature is support only for version of 2.2 and higher */
404     virtual
405     void
406     SetPolyedreInfo(const TPolyedreInfo& theInfo,
407                     TErr* theErr = NULL)
408     {}
409     
410     //! Read number of MED Polyedres in defined MED Mesh
411     /*! This feature is support only for version of 2.2 and higher */
412     virtual
413     TInt
414     GetNbPolyedres(const TMeshInfo& theMeshInfo,
415                    EEntiteMaillage theEntity,
416                    EGeometrieElement theGeom,
417                    EConnectivite theConnMode = eNOD,
418                    TErr* theErr = NULL)
419     { 
420       return 0;
421     }
422
423     //! Read connectivity infroamtion for the MED Polyedres in defined MED Mesh
424     /*! This feature is support only for version of 2.2 and higher */
425     virtual 
426     void
427     GetPolyedreConnSize(const TMeshInfo& theMeshInfo,
428                         TInt& theNbFaces,
429                         TInt& theConnSize,
430                         EConnectivite theConnMode = eNOD,
431                         TErr* theErr = NULL)
432     {
433       theNbFaces = theConnSize = 0;
434     }
435     
436     virtual
437     PPolyedreInfo
438     CrPolyedreInfo(const PMeshInfo& theMeshInfo, 
439                    EEntiteMaillage theEntity, 
440                    EGeometrieElement theGeom,
441                    TInt theNbElem,
442                    TInt theNbFaces,
443                    TInt theConnSize,
444                    EConnectivite theConnMode = eNOD,
445                    EBooleen theIsElemNum = eVRAI,
446                    EBooleen theIsElemNames = eVRAI)
447     {
448       return PPolyedreInfo();
449     }
450     
451     //! Creates a MEDWrapper MED Polyedres representation
452     /*! This feature is support only for version of 2.2 and higher */
453     virtual
454     PPolyedreInfo
455     CrPolyedreInfo(const PMeshInfo& theMeshInfo, 
456                    EEntiteMaillage theEntity, 
457                    EGeometrieElement theGeom,
458                    const TIntVector& theIndexes,
459                    const TIntVector& theFaces,
460                    const TIntVector& theConnectivities,
461                    EConnectivite theConnMode = eNOD,
462                    const TIntVector& theFamilyNums = TIntVector(),
463                    const TIntVector& theElemNums = TIntVector(),
464                    const TStringVector& theElemNames = TStringVector())
465     {
466       return PPolyedreInfo();
467     }
468
469     //! A copy-constructor for the MEDWrapper MED Polyedres representation
470     virtual
471     PPolyedreInfo
472     CrPolyedreInfo(const PMeshInfo& theMeshInfo,
473                    const PPolyedreInfo& theInfo)
474     {
475       return PPolyedreInfo();
476     }
477     
478     //! Read a MEDWrapper MED Polyedres representation from defined MED file
479     /*! This feature is support only for version of 2.2 and higher */
480     PPolyedreInfo
481     GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
482                      EEntiteMaillage theEntity, 
483                      EGeometrieElement theGeom, 
484                      EConnectivite theConnMode = eNOD);
485     
486     //----------------------------------------------------------------------------
487     //! Get TEntityInfo which contains brief information about existing cells and their destribution among MED ENTITIES
488     virtual
489     TEntityInfo
490     GetEntityInfo(const TMeshInfo& theMeshInfo,
491                   EConnectivite theConnMode = eNOD,
492                   TErr* theErr = NULL) = 0;
493     
494     //! Read number of cells for defined MED Mesh, ENTITY and geometrical type with define mode of connectivity
495     virtual
496     TInt
497     GetNbCells(const TMeshInfo& theMeshInfo, 
498                EEntiteMaillage theEntity, 
499                EGeometrieElement theGeom, 
500                EConnectivite theConnMode = eNOD,
501                TErr* theErr = NULL) = 0;
502     
503     //! Read a MEDWrapper MED Cells representation from defined MED file
504     virtual
505     void
506     GetCellInfo(TCellInfo& theInfo,
507                 TErr* theErr = NULL) = 0;
508     
509     //! Write the MEDWrapper MED Cells representation into defined MED file
510     virtual 
511     void
512     SetCellInfo(const TCellInfo& theInfo,
513                 TErr* theErr = NULL) = 0;
514     
515     //! Creates a MEDWrapper MED Cells representation
516     virtual
517     PCellInfo
518     CrCellInfo(const PMeshInfo& theMeshInfo, 
519                EEntiteMaillage theEntity, 
520                EGeometrieElement theGeom,
521                TInt theNbElem,
522                EConnectivite theConnMode = eNOD,
523                EBooleen theIsElemNum = eVRAI,
524                EBooleen theIsElemNames = eVRAI,
525                EModeSwitch theMode = eFULL_INTERLACE) = 0;
526     
527     //! Creates a MEDWrapper MED Cells representation
528     virtual
529     PCellInfo
530     CrCellInfo(const PMeshInfo& theMeshInfo, 
531                EEntiteMaillage theEntity, 
532                EGeometrieElement theGeom,
533                const TIntVector& theConnectivities,
534                EConnectivite theConnMode = eNOD,
535                const TIntVector& theFamilyNums = TIntVector(),
536                const TIntVector& theElemNums = TIntVector(),
537                const TStringVector& theElemNames = TStringVector(),
538                EModeSwitch theMode = eFULL_INTERLACE) = 0;
539     
540     //! A copy-constructor for the MEDWrapper MED Cells representation
541     virtual
542     PCellInfo
543     CrCellInfo(const PMeshInfo& theMeshInfo,
544                const PCellInfo& theInfo) = 0;
545     
546     //! Read a MEDWrapper MED Cells representation from defined MED file
547     PCellInfo
548     GetPCellInfo(const PMeshInfo& theMeshInfo,
549                  EEntiteMaillage theEntity, 
550                  EGeometrieElement theGeom, 
551                  EConnectivite theConnMode = eNOD,
552                  TErr* theErr = NULL);
553
554     //----------------------------------------------------------------------------
555     //! Read number of balls in the Mesh
556     /*! This feature is supported since version 3.0 */
557     virtual
558     TInt
559     GetNbBalls(const TMeshInfo& theMeshInfo)
560     {
561       return 0;
562     }
563
564     //! Read a MEDWrapped representation of MED_BALL from the MED file
565     /*! This feature is supported since version 3.0 */
566     virtual
567     void
568     GetBallInfo(TBallInfo& theInfo,
569                 TErr* theErr = NULL) 
570     {}
571
572     //! Write a MEDWrapped representation of MED_BALL to the MED file
573     /*! This feature is supported since version 3.0 */
574     virtual
575     void
576     SetBallInfo(const TBallInfo& theInfo,
577                 TErr* theErr = NULL) 
578     {}
579
580     //! Creates a MEDWrapper MED Balls representation
581     /*! This feature is supported since version 3.0 */
582     virtual 
583     PBallInfo
584     CrBallInfo(const PMeshInfo& theMeshInfo, 
585                TInt             theNbBalls,
586                EBooleen         theIsElemNum = eVRAI)
587     {
588       return PBallInfo();
589     }
590
591     //! Creates a MEDWrapper MED Balls representation
592     /*! This feature is supported since version 3.0 */
593     virtual
594     PBallInfo 
595     CrBallInfo(const PMeshInfo&  theMeshInfo, 
596                const TIntVector& theNodes,
597                TFloatVector&     theDiameters,
598                const TIntVector& theFamilyNums = TIntVector(),
599                const TIntVector& theElemNums = TIntVector())
600     {
601       return PBallInfo();
602     }
603
604     //! A copy-constructor for the MEDWrapped MED Balls representation
605     virtual
606     PBallInfo
607     CrBallInfo(const PMeshInfo& theMeshInfo,
608                const PBallInfo& theInfo)
609     {
610       return PBallInfo();
611     }
612     
613     //! Read a MEDWrapped MED Balls representation from defined MED file
614     /*! This feature is supported since version 3.0 */
615     virtual
616     PBallInfo
617     GetPBallInfo(const PMeshInfo& theMeshInfo);
618
619     //----------------------------------------------------------------------------
620     //! Read number of MED FIELDS in defined MED Mesh
621     virtual 
622     TInt
623     GetNbFields(TErr* theErr = NULL) = 0;
624     
625     //! Read number of components for the defined MED FIELD by its order number
626     virtual
627     TInt
628     GetNbComp(TInt theFieldId,
629               TErr* theErr = NULL) = 0;
630     
631     //! Read MEDWrapper MED FIELD representation by its order number
632     virtual 
633     void
634     GetFieldInfo(TInt theFieldId, 
635                  TFieldInfo& theInfo,
636                  TErr* theErr = NULL) = 0;
637
638     //! Write MEDWrapper MED FIELD representation into defined MED file
639     virtual 
640     void
641     SetFieldInfo(const TFieldInfo& theInfo,
642                  TErr* theErr = NULL) = 0;
643     
644     //! Creates a MEDWrapper MED FIELD representation
645     virtual 
646     PFieldInfo
647     CrFieldInfo(const PMeshInfo& theMeshInfo, 
648                 TInt theNbComp = 0,
649                 ETypeChamp theType = eFLOAT64,
650                 const std::string& theValue = "",
651                 EBooleen theIsLocal = eVRAI,
652                 TInt theNbRef = 1) = 0;
653
654     //! A copy-constructor for the MEDWrapper MED FIELD representation
655     virtual 
656     PFieldInfo
657     CrFieldInfo(const PMeshInfo& theMeshInfo,
658                 const PFieldInfo& theInfo) = 0;
659     
660     //! Read a MEDWrapper MED FIELD representation from defined MED file
661     PFieldInfo
662     GetPFieldInfo(const PMeshInfo& theMeshInfo, 
663                   TInt theId,
664                   TErr* theErr = NULL);
665
666     //----------------------------------------------------------------------------
667     //! Read number of MED GAUSS in defined MED Mesh
668     /*! This feature is support only for version of 2.2 and higher */
669     virtual 
670     TInt
671     GetNbGauss(TErr* theErr = NULL)
672     { 
673       return TInt();
674     }
675
676     //! Read brief MED GAUSS information by its order number from defined MED Mesh
677     /*! This feature is support only for version of 2.2 and higher */
678     virtual 
679     TGaussInfo::TInfo
680     GetGaussPreInfo(TInt theId, 
681                     TErr* theErr = NULL)
682     {
683       return TGaussInfo::TInfo( TGaussInfo::TKey(ePOINT1,""),0 );
684     }
685     
686     //! Read a MEDWrapper MED GAUSS representation by its order number from defined MED file
687     /*! This feature is support only for version of 2.2 and higher */
688     virtual 
689     void
690     GetGaussInfo(TInt theId, 
691                  TGaussInfo& theInfo,
692                  TErr* theErr = NULL)
693     {}
694
695     //! Creates a MEDWrapper MED GAUSS representation
696     /*! This feature is support only for version of 2.2 and higher */
697     virtual
698     PGaussInfo
699     CrGaussInfo(const TGaussInfo::TInfo& theInfo,
700                 EModeSwitch theMode = eFULL_INTERLACE) = 0;
701
702     //----------------------------------------------------------------------------
703     //! Read number of MED TIMESTAMPS in defined MED Mesh
704     /*!
705       By the way some additional information can be obtained:
706       - to what MED ENTITY the MED TIMESTAMP conntected to;
707       - on what geometrical types the MED TIMESTAMP defined to.
708     */
709     virtual 
710     TInt
711     GetNbTimeStamps(const TFieldInfo& theInfo, 
712                     const TEntityInfo& theEntityInfo,
713                     EEntiteMaillage& theEntity,
714                     TGeom2Size& theGeom2Size,
715                     TErr* theErr = NULL) = 0;
716     
717     //! Read MEDWrapper MED TIMESTAMP representation by its order number
718     virtual 
719     void
720     GetTimeStampInfo(TInt theTimeStampId, 
721                      TTimeStampInfo& theInfo,
722                      TErr* theErr = NULL) = 0;
723
724     //! Creates a MEDWrapper MED TIMESTAMP representation
725     virtual 
726     PTimeStampInfo
727     CrTimeStampInfo(const PFieldInfo& theFieldInfo, 
728                     EEntiteMaillage theEntity,
729                     const TGeom2Size& theGeom2Size,
730                     const TGeom2NbGauss& theGeom2NbGauss = TGeom2NbGauss(),
731                     TInt theNumDt = 0,
732                     TInt theNumOrd = 0,
733                     TFloat theDt = 0,
734                     const std::string& theUnitDt = "",
735                     const TGeom2Gauss& theGeom2Gauss = TGeom2Gauss()) = 0;
736
737     //! A copy-constructor for the MEDWrapper MED TIMESTAMP representation
738     virtual 
739     PTimeStampInfo 
740     CrTimeStampInfo(const PFieldInfo& theFieldInfo,
741                     const PTimeStampInfo& theInfo) = 0;
742     
743     //! Read MEDWrapper MED TIMESTAMP representation by its order number
744     PTimeStampInfo
745     GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
746                       EEntiteMaillage theEntity,
747                       const TGeom2Size& theGeom2Size,
748                       TInt theId,
749                       TErr* theErr = NULL);
750
751     //----------------------------------------------------------------------------
752     //! Read number of MED PROFILES in defined MED Mesh
753     virtual 
754     TInt
755     GetNbProfiles(TErr* theErr = NULL) = 0;
756
757     //! Read brief MED PROFILE information by its order number from defined MED Mesh
758     virtual 
759     TProfileInfo::TInfo
760     GetProfilePreInfo(TInt theId, 
761                       TErr* theErr = NULL) = 0;
762
763     //! Read a MEDWrapper MED PROFILE representation by its order number from defined MED file
764     virtual 
765     void
766     GetProfileInfo(TInt theId, 
767                    TProfileInfo& theInfo,
768                    TErr* theErr = NULL) = 0;
769
770     //! Creates a MEDWrapper MED PROFILE representation
771     virtual
772     PProfileInfo
773     CrProfileInfo(const TProfileInfo::TInfo& theInfo,
774                   EModeProfil theMode = eCOMPACT) = 0;
775
776     //! Write a MEDWrapper MED PROFILE representation
777     virtual
778     void
779     SetProfileInfo(const TProfileInfo& theInfo,
780                    TErr* theErr = NULL) = 0;
781
782     //! Read a MEDWrapper MED PROFILE representation by its order number from defined MED file
783     PProfileInfo
784     GetPProfileInfo(TInt theId,
785                     EModeProfil theMode = eCOMPACT,
786                     TErr* theErr = NULL);
787
788     //----------------------------------------------------------------------------
789     //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
790     virtual 
791     void
792     GetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
793                       const TMKey2Profile& theMKey2Profile,
794                       const TKey2Gauss& theKey2Gauss,
795                       TErr* theErr = NULL) = 0;
796     
797     //! Write the values for MEDWrapper MED TIEMSTAMP to defined MED file
798     virtual 
799     void
800     SetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
801                       TErr* theErr = NULL) = 0;
802     
803     //! Creates the values for MEDWrapper MED TIEMSTAMP representation
804     virtual
805     PTimeStampValueBase
806     CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
807                      ETypeChamp theTypeChamp,
808                      const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
809                      EModeSwitch theMode = eFULL_INTERLACE) = 0;
810
811     //! Creates the values for MEDWrapper MED TIEMSTAMP representation
812     virtual
813     PTimeStampValueBase
814     CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
815                      const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
816                      EModeSwitch theMode = eFULL_INTERLACE);
817
818     //! A copy-constructor for the values for MEDWrapper MED TIEMSTAMP representation
819     virtual 
820     PTimeStampValueBase
821     CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
822                      const PTimeStampValueBase& theInfo,
823                      ETypeChamp theTypeChamp) = 0;
824     
825     //! A copy-constructor for the values for MEDWrapper MED TIEMSTAMP representation
826     virtual 
827     PTimeStampValueBase
828     CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
829                      const PTimeStampValueBase& theInfo);
830     
831     //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
832     PTimeStampValueBase
833     GetPTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
834                        const TMKey2Profile& theMKey2Profile,
835                        const TKey2Gauss& theKey2Gauss,
836                        TErr* theErr = NULL);
837     
838     //----------------------------------------------------------------------------
839     // Backward compatibility  declarations
840     //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
841     virtual 
842     void
843     GetTimeStampVal(const PTimeStampVal& theVal,
844                     const TMKey2Profile& theMKey2Profile,
845                     const TKey2Gauss& theKey2Gauss,
846                     TErr* theErr = NULL);
847     
848     //! Write the values for MEDWrapper MED TIEMSTAMP to defined MED file
849     virtual 
850     void
851     SetTimeStamp(const PTimeStampVal& theVal,
852                  TErr* theErr = NULL);
853     
854     //! Creates the values for MEDWrapper MED TIEMSTAMP representation
855     virtual
856     PTimeStampVal
857     CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
858                    const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
859                    EModeSwitch theMode = eFULL_INTERLACE);
860
861     //! A copy-constructor for the values for MEDWrapper MED TIEMSTAMP representation
862     virtual 
863     PTimeStampVal
864     CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
865                    const PTimeStampVal& theInfo);
866     
867     //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
868     PTimeStampVal
869     GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
870                      const TMKey2Profile& theMKey2Profile,
871                      const TKey2Gauss& theKey2Gauss,
872                      TErr* theErr = NULL);
873
874     //----------------------------------------------------------------------------
875     //! Read a MEDWrapper MED Grille representation from defined MED file
876     /*! This feature is support only for version of 2.2 and higher */
877     PGrilleInfo
878     GetPGrilleInfo(const PMeshInfo& theMeshInfo);
879
880     //! Read a MEDWrapper MED Grille representation from defined MED file
881     /*! This feature is support only for version of 2.2 and higher */
882     PGrilleInfo
883     GetPGrilleInfo(const PMeshInfo& theMeshInfo,
884                    const PGrilleInfo& theInfo);
885
886     //! Read a MEDWrapper MED Grille representation from defined MED file
887     /*! This feature is support only for version of 2.2 and higher */
888     virtual
889     void
890     GetGrilleInfo(TGrilleInfo& theInfo,
891                   TErr* theErr = NULL)
892     {}
893
894     //! Write the MEDWrapper MED Grille representation into defined MED file
895     /*! This feature is support only for version of 2.2 and higher */
896     virtual 
897     void
898     SetGrilleInfo(const TGrilleInfo& theInfo,
899                   TErr* theErr = NULL)
900     {}
901
902     /*! This feature is support only for version of 2.2 and higher */
903     virtual
904     PGrilleInfo
905     CrGrilleInfo(const PMeshInfo& theMeshInfo,
906                  const PGrilleInfo& theGrilleInfo)
907     {
908       return PGrilleInfo();
909     }
910
911     /*! This feature is support only for version of 2.2 and higher */
912     virtual
913     PGrilleInfo
914     CrGrilleInfo(const PMeshInfo& theMeshInfo)
915     {
916       return PGrilleInfo();
917     }
918     
919     /*! This feature is support only for version of 2.2 and higher */
920     virtual
921     PGrilleInfo
922     CrGrilleInfo(const PMeshInfo& theMeshInfo,
923                  const EGrilleType& type)
924     {
925       return PGrilleInfo();
926     }
927     
928     /*! This feature is support only for version of 2.2 and higher */
929     virtual
930     PGrilleInfo
931     CrGrilleInfo(const PMeshInfo& theMeshInfo,
932                  const EGrilleType& type,
933                  const TInt& nbNodes)
934     {
935       return PGrilleInfo();
936     }
937
938     /*! This feature is support only for version of 2.2 and higher */
939     virtual
940     PGrilleInfo
941     CrGrilleInfo(const PMeshInfo& theMeshInfo,
942                  const EGrilleType& type,
943                  const MED::TIntVector& nbNodeVec)
944     {
945       return PGrilleInfo();
946     }
947
948     /*! This feature is support only for version of 2.2 and higher */
949     virtual
950     void
951     GetGrilleType(const TMeshInfo& theMeshInfo,
952                   EGrilleType& type,
953                   TErr* theErr = NULL)
954     {
955     }
956   };
957
958   //----------------------------------------------------------------------------
959   //! This class provide thread-safety for MEDWrapper interaction
960   class MEDWRAPPER_EXPORT TLockProxy
961   {
962     TLockProxy& operator=(const TLockProxy& );
963     TWrapper* myWrapper;
964
965   public:
966     TLockProxy(TWrapper* theWrapper);
967
968     ~TLockProxy();
969
970     TWrapper * operator-> () const;
971   };
972
973   //----------------------------------------------------------------------------
974   //! To specialize the SharedPtr for TWrapper
975   template<> 
976   class MEDWRAPPER_EXPORT SharedPtr<TWrapper>: public boost::shared_ptr<TWrapper>
977   {
978   public:
979     SharedPtr() {}
980
981     template<class Y>
982     explicit SharedPtr(Y * p): 
983       boost::shared_ptr<TWrapper>(p) 
984     {}
985
986     template<class Y>
987     SharedPtr(SharedPtr<Y> const & r):
988       boost::shared_ptr<TWrapper>(boost::dynamic_pointer_cast<TWrapper,Y>(r))
989     {}
990
991     template<class Y>
992     SharedPtr& 
993     operator=(SharedPtr<Y> const & r)
994     {
995       SharedPtr<TWrapper>(r).swap(*this);
996       return *this;
997     }
998
999     template<class Y> 
1000     SharedPtr& 
1001     operator()(Y * p) // Y must be complete
1002     {
1003       return operator=<Y>(SharedPtr<Y>(p));
1004     }
1005
1006     template<class Y> 
1007     SharedPtr& 
1008     operator()(SharedPtr<Y> const & r) // Y must be complete
1009     {
1010       return operator=<Y>(SharedPtr<Y>(r));
1011     }
1012
1013     TLockProxy operator-> () const // never throws
1014     {
1015       return TLockProxy(this->get());
1016     }
1017     
1018   protected:
1019     operator const TWrapper& () const;
1020
1021     operator TWrapper& ();
1022
1023     TWrapper& operator* () const;
1024
1025     TWrapper * get() const // never throws
1026     {
1027       return boost::shared_ptr<TWrapper>::get();
1028     }
1029   };
1030
1031   //----------------------------------------------------------------------------
1032   typedef SharedPtr<TWrapper> PWrapper;
1033 }
1034
1035 #endif // MED_Wrapper_HeaderFile