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