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