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