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