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