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