Salome HOME
Merge branch V7_3_1_BR
[modules/smesh.git] / src / MEDWrapper / V2_2 / MED_V2_2_Wrapper.hxx
1 // Copyright (C) 2007-2014  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 #ifndef MED_V2_2_Wrapper_HeaderFile
23 #define MED_V2_2_Wrapper_HeaderFile
24
25 #ifdef WIN32
26  #if defined MEDWRAPPER_V2_2_EXPORTS || defined MEDWrapper_V2_2_EXPORTS
27   #if defined WIN32
28    #define MED_V22_WRAPPER_EXPORT __declspec( dllexport )
29   #else
30    #define MED_V22_WRAPPER_EXPORT
31   #endif
32  #else
33   #if defined WIN32
34    #define MED_V22_WRAPPER_EXPORT __declspec( dllimport )
35   #else
36    #define MED_V22_WRAPPER_EXPORT
37   #endif
38  #endif
39 #else
40  #define MED_V22_WRAPPER_EXPORT
41 #endif
42
43 #include "MED_Structures.hxx"
44 #include "MED_TWrapper.hxx"
45
46 namespace MED
47 {
48   template<>
49   TInt MED_V22_WRAPPER_EXPORT
50   GetDESCLength<eV2_2>();
51   
52   template<>
53   TInt MED_V22_WRAPPER_EXPORT
54   GetIDENTLength<eV2_2>();
55   
56   template<>
57   TInt MED_V22_WRAPPER_EXPORT
58   GetNOMLength<eV2_2>();
59   
60   template<>
61   TInt MED_V22_WRAPPER_EXPORT
62   GetLNOMLength<eV2_2>();
63   
64   template<>
65   TInt MED_V22_WRAPPER_EXPORT
66   GetPNOMLength<eV2_2>();
67
68   template<>
69   void MED_V22_WRAPPER_EXPORT
70   GetVersionRelease<eV2_2>(TInt& majeur, TInt& mineur, TInt& release);
71
72   template<>
73   TInt MED_V22_WRAPPER_EXPORT
74   GetNbConn<eV2_2>(EGeometrieElement typmai,
75                    EEntiteMaillage typent,
76                    TInt mdim);
77
78   namespace V2_2
79   {
80     //----------------------------------------------------------------------------
81     class TFile;
82     typedef boost::shared_ptr<TFile> PFile;
83     
84     typedef enum {eLECTURE, eLECTURE_ECRITURE, eLECTURE_AJOUT, eCREATION} EModeAcces; 
85
86     //----------------------------------------------------------------------------
87     class MED_V22_WRAPPER_EXPORT TVWrapper: public MED::TTWrapper<eV2_2>
88     {
89       TVWrapper();
90       TVWrapper(const TVWrapper&);
91       TVWrapper& operator=(const TVWrapper&);
92       
93     public:
94       TVWrapper(const std::string& theFileName);
95
96       //----------------------------------------------------------------------------
97       virtual 
98       TInt
99       GetNbMeshes(TErr* theErr = NULL);
100       
101       virtual
102       void
103       GetMeshInfo(TInt theMeshId, MED::TMeshInfo&,
104                                TErr* theErr = NULL);
105
106       virtual
107       void
108       SetMeshInfo(const MED::TMeshInfo& theInfo,
109                   TErr* theErr = NULL);
110       
111       void SetMeshInfo(const MED::TMeshInfo& theInfo,
112                        EModeAcces theMode,
113                        TErr* theErr = NULL);
114       
115       
116       //----------------------------------------------------------------------------
117       virtual
118       TInt
119       GetNbFamilies(const MED::TMeshInfo& theMeshInfo,
120                     TErr* theErr = NULL);
121
122       virtual 
123       TInt
124       GetNbFamAttr(TInt theFamId, 
125                    const MED::TMeshInfo& theInfo,
126                    TErr* theErr = NULL);
127       
128       virtual
129       TInt
130       GetNbFamGroup(TInt theFamId, 
131                     const MED::TMeshInfo& theInfo,
132                     TErr* theErr = NULL);
133       
134       virtual
135       void
136       GetFamilyInfo(TInt theFamId, 
137                     MED::TFamilyInfo& theInfo,
138                     TErr* theErr = NULL);
139       
140       virtual
141       void
142       SetFamilyInfo(const MED::TFamilyInfo& theInfo,
143                     TErr* theErr = NULL);
144       
145       void 
146       SetFamilyInfo(const MED::TFamilyInfo& theInfo,
147                     EModeAcces theMode,
148                     TErr* theErr = NULL);
149       
150       
151       //----------------------------------------------------------------------------
152       virtual
153       void
154       GetNames(TElemInfo& theInfo,
155                TInt nb,
156                EEntiteMaillage theEntity, 
157                EGeometrieElement theGeom,
158                TErr* theErr = NULL);
159
160       virtual
161       void
162       GetNumeration(TElemInfo& theInfo,
163                     TInt nb,
164                     EEntiteMaillage theEntity, 
165                     EGeometrieElement theGeom,
166                     TErr* theErr = NULL);
167
168       virtual
169       void
170       GetFamilies(TElemInfo& theInfo,
171                   TInt nb,
172                   EEntiteMaillage theEntity, 
173                   EGeometrieElement theGeom,
174                   TErr* theErr = NULL);
175
176       virtual
177       void
178       SetNames(const TElemInfo& theInfo,
179                EEntiteMaillage theEntity, 
180                EGeometrieElement theGeom,
181                TErr* theErr = NULL);
182
183       void
184       SetNames(const TElemInfo& theInfo,
185                EModeAcces theMode,
186                EEntiteMaillage theEntity, 
187                EGeometrieElement theGeom,
188                TErr* theErr = NULL);
189       
190       virtual
191       void
192       SetNumeration(const TElemInfo& theInfo,
193                     EEntiteMaillage theEntity, 
194                     EGeometrieElement theGeom,
195                     TErr* theErr = NULL);
196       void
197       SetNumeration(const TElemInfo& theInfo,
198                     EModeAcces theMode,
199                     EEntiteMaillage theEntity, 
200                     EGeometrieElement theGeom,
201                     TErr* theErr = NULL);
202       
203       virtual
204       void
205       SetFamilies(const TElemInfo& theInfo,
206                   EEntiteMaillage theEntity, 
207                   EGeometrieElement theGeom,
208                   TErr* theErr = NULL);
209       void
210       SetFamilies(const TElemInfo& theInfo,
211                   EModeAcces theMode,
212                   EEntiteMaillage theEntity, 
213                   EGeometrieElement theGeom,
214                   TErr* theErr = NULL);
215
216       //----------------------------------------------------------------------------
217       virtual
218       TInt
219       GetNbNodes(const MED::TMeshInfo& theMeshInfo,
220                  TErr* theErr = NULL)
221       {
222         return GetNbNodes(theMeshInfo,eCOOR,theErr);
223       }
224
225       TInt
226       GetNbNodes(const MED::TMeshInfo& theMeshInfo,
227                  ETable theTable,
228                  TErr* theErr = NULL);
229       
230       virtual 
231       void
232       GetNodeInfo(MED::TNodeInfo& theInfo,
233                   TErr* theErr = NULL);
234       
235       virtual
236       void
237       SetNodeInfo(const MED::TNodeInfo& theInfo,
238                   TErr* theErr = NULL);
239       
240       void
241       SetNodeInfo(const MED::TNodeInfo& theInfo,
242                   EModeAcces theMode,
243                   TErr* theErr = NULL);
244       
245       //----------------------------------------------------------------------------
246       virtual
247       void
248       GetPolygoneInfo(TPolygoneInfo& theInfo,
249                       TErr* theErr = NULL);
250
251       virtual 
252       void
253       SetPolygoneInfo(const TPolygoneInfo& theInfo,
254                                    TErr* theErr = NULL);
255       
256       void
257       SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
258                       EModeAcces theMode,
259                       TErr* theErr = NULL);
260
261       virtual 
262       TInt
263       GetNbPolygones(const TMeshInfo& theMeshInfo,
264                    EEntiteMaillage theEntity,
265                    EGeometrieElement theGeom,
266                    EConnectivite theConnMode = eNOD,
267                    TErr* theErr = NULL);
268       
269       virtual 
270       TInt
271       GetPolygoneConnSize(const TMeshInfo& theMeshInfo,
272                         EEntiteMaillage theEntity,
273                         EGeometrieElement theGeom,
274                         EConnectivite theConnMode = eNOD,
275                         TErr* theErr = NULL);
276
277       //----------------------------------------------------------------------------
278       virtual 
279       void
280       GetPolyedreInfo(TPolyedreInfo& theInfo,
281                       TErr* theErr = NULL);
282       
283       virtual
284       void
285       SetPolyedreInfo(const TPolyedreInfo& theInfo,
286                       TErr* theErr = NULL);
287       
288       void
289       SetPolyedreInfo(const MED::TPolyedreInfo& theInfo,
290                       EModeAcces theMode,
291                       TErr* theErr = NULL);
292       
293       virtual
294       TInt
295       GetNbPolyedres(const TMeshInfo& theMeshInfo,
296                      EEntiteMaillage,
297                      EGeometrieElement,
298                      EConnectivite,
299                      TErr* theErr = NULL);
300       
301       virtual 
302       void
303       GetPolyedreConnSize(const TMeshInfo& theMeshInfo,
304                           TInt& theNbFaces,
305                           TInt& theConnSize,
306                           EConnectivite theConnMode = eNOD,
307                           TErr* theErr = NULL);
308       
309       //----------------------------------------------------------------------------
310       virtual
311       TEntityInfo
312       GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
313                     EConnectivite theConnMode = eNOD,
314                     TErr* theErr = NULL);
315       
316       virtual 
317       TInt
318       GetNbCells(const MED::TMeshInfo& theMeshInfo, 
319                  EEntiteMaillage, 
320                  EGeometrieElement, 
321                  EConnectivite theConnMode = eNOD,
322                  TErr* theErr = NULL);
323       
324       virtual
325       void
326       GetCellInfo(MED::TCellInfo& theInfo,
327                   TErr* theErr = NULL);
328
329       virtual 
330       void
331       SetCellInfo(const MED::TCellInfo& theInfo,
332                   TErr* theErr = NULL);
333       
334       void 
335       SetCellInfo(const MED::TCellInfo& theInfo,
336                   EModeAcces theMode,
337                   TErr* theErr = NULL);
338       
339       //----------------------------------------------------------------------------
340       //! Read geom type of MED_BALL structural element
341       EGeometrieElement GetBallGeom(const TMeshInfo& theMeshInfo);
342       
343       //! Read number of balls in the Mesh
344       virtual TInt GetNbBalls(const TMeshInfo& theMeshInfo);
345
346       //! Read a MEDWrapped representation of MED_BALL from the MED file
347       virtual void GetBallInfo(TBallInfo& theInfo, TErr* theErr = NULL);
348
349       //! Write a MEDWrapped representation of MED_BALL to the MED file
350       virtual void  SetBallInfo(const TBallInfo& theInfo, TErr* theErr);
351
352       //! Write a MEDWrapped representation of MED_BALL to the MED file
353       void  SetBallInfo(const TBallInfo& theInfo, EModeAcces theMode, TErr* theErr);
354
355       //----------------------------------------------------------------------------
356       virtual
357       TInt
358       GetNbFields(TErr* theErr = NULL);
359       
360       virtual
361       TInt
362       GetNbComp(TInt theFieldId,
363                 TErr* theErr = NULL);
364       
365       virtual 
366       void
367       GetFieldInfo(TInt theFieldId, 
368                    MED::TFieldInfo& theInfo,
369                    TErr* theErr = NULL);
370       
371       virtual
372       void
373       SetFieldInfo(const MED::TFieldInfo& theInfo,
374                    TErr* theErr = NULL);
375       
376       void
377       SetFieldInfo(const MED::TFieldInfo& theInfo,
378                    EModeAcces theMode,
379                    TErr* theErr = NULL);
380       
381       //----------------------------------------------------------------------------
382       virtual 
383       TInt
384       GetNbGauss(TErr* theErr = NULL);
385
386       virtual 
387       TGaussInfo::TInfo
388       GetGaussPreInfo(TInt theId, 
389                       TErr* theErr = NULL);
390
391       virtual 
392       void
393       GetGaussInfo(TInt theId, 
394                    TGaussInfo& theInfo,
395                    TErr* theErr = NULL);
396
397       //----------------------------------------------------------------------------
398       virtual 
399       TInt
400       GetNbProfiles(TErr* theErr = NULL);
401
402       virtual 
403       TProfileInfo::TInfo
404       GetProfilePreInfo(TInt theId, 
405                         TErr* theErr = NULL);
406       
407       virtual 
408       void
409       GetProfileInfo(TInt theId, 
410                      TProfileInfo& theInfo,
411                      TErr* theErr = NULL);
412
413       virtual
414       void
415       SetProfileInfo(const TProfileInfo& theInfo,
416                      TErr*               theErr = NULL);
417
418       void
419       SetProfileInfo(const TProfileInfo& theInfo,
420                      EModeAcces          theMode,
421                      TErr*               theErr = NULL);
422
423       //----------------------------------------------------------------------------
424       virtual 
425       TInt
426       GetNbTimeStamps(const MED::TFieldInfo& theInfo, 
427                       const MED::TEntityInfo& theEntityInfo,
428                       EEntiteMaillage& theEntity,
429                       TGeom2Size& theGeom2Size,
430                       TErr* theErr = NULL);
431       
432       virtual 
433       void
434       GetTimeStampInfo(TInt theTimeStampId, 
435                        MED::TTimeStampInfo& theInfo,
436                        TErr* theErr = NULL);
437       
438       virtual
439       void
440       GetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
441                         const TMKey2Profile& theMKey2Profile,
442                         const TKey2Gauss& theKey2Gauss,
443                         TErr* theErr = NULL);
444       
445       virtual
446       void
447       SetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
448                         TErr* theErr = NULL);
449       
450       void 
451       SetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
452                         EModeAcces theMode,
453                         TErr* theErr = NULL);
454       
455
456       //----------------------------------------------------------------------------
457       virtual
458       void
459       GetGrilleInfo(TGrilleInfo& theGrilleInfo,
460                     TErr* theErr = NULL);
461       
462       virtual
463       void
464       SetGrilleInfo(const MED::TGrilleInfo& theGrilleInfo,
465                     TErr* theErr = NULL);
466
467       void
468       SetGrilleInfo(const MED::TGrilleInfo& theGrilleInfo,
469                     EModeAcces theMode,
470                     TErr* theErr = NULL);
471
472       virtual
473       void
474       GetGrilleType(const MED::TMeshInfo& theMeshInfo,
475                     EGrilleType& type,
476                     TErr* theErr = NULL);
477
478       void
479       GetGrilleStruct(const MED::TMeshInfo& theMeshInfo,
480                       TIntVector& theStruct,
481                       TErr* theErr = NULL);
482
483     protected:
484       PFile myFile;
485     };
486   }
487 }
488
489 #endif