]> SALOME platform Git repositories - modules/med.git/blob - src/MEDWrapper/Base/MED_Structures.hxx
Salome HOME
updating in the main trunk (only from NB and AG) for a pre building of
[modules/med.git] / src / MEDWrapper / Base / MED_Structures.hxx
1 //  
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : 
25 //  Author : 
26 //  Module : 
27 //  $Header$
28
29 #ifndef MED_Structures_HeaderFile
30 #define MED_Structures_HeaderFile
31
32 #include "MED_Common.hxx"
33
34 namespace MED{
35
36   //---------------------------------------------------------------
37   typedef std::vector<char> TString;
38
39   std::string GetString(TInt theId, TInt theStep, 
40                         const TString& theString);
41
42   void SetString(TInt theId, TInt theStep, 
43                  TString& theString, 
44                  const std::string& theValue);
45
46   //---------------------------------------------------------------
47   struct TBase
48   {
49     virtual ~TBase() {} 
50   };
51
52
53   //---------------------------------------------------------------
54   struct TNameInfo: virtual TBase
55   {
56     TString myName;
57     virtual std::string GetName() const = 0;
58     virtual void SetName(const std::string& theValue) = 0;
59   };
60
61
62   //---------------------------------------------------------------
63   struct TMeshInfo: virtual TNameInfo
64   {
65     TInt myDim;
66     TInt GetDim() const { return myDim;}
67
68     EMaillage myType;
69     EMaillage GetType() const { return myType;}
70
71     TString myDesc;
72     virtual std::string GetDesc() const = 0;
73     virtual void SetDesc(const std::string& theValue) = 0;
74   };
75   
76
77   //---------------------------------------------------------------
78   typedef std::vector<TInt> TFamAttr;
79
80   struct TFamilyInfo: virtual TNameInfo
81   {
82     PMeshInfo myMeshInfo;
83     const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
84
85     TInt myId;
86     TInt GetId() const { return myId;}
87     void SetId(TInt theId) { myId = theId;}
88
89     TInt myNbGroup;
90     TInt GetNbGroup() const { return myNbGroup;}
91
92     TString myGroupNames;
93     virtual std::string GetGroupName(TInt theId) const = 0;
94     virtual void SetGroupName(TInt theId, const std::string& theValue) = 0;
95
96     TInt myNbAttr;
97     TInt GetNbAttr() const { return myNbAttr;}
98
99     TFamAttr myAttrId;
100     TInt GetAttrId(TInt theId) const;
101     void SetAttrId(TInt theId, TInt theVal);
102
103     TFamAttr myAttrVal;
104     TInt GetAttrVal(TInt theId) const;
105     void SetAttrVal(TInt theId, TInt theVal);
106
107     TString myAttrDesc;
108     virtual std::string GetAttrDesc(TInt theId) const = 0;
109     virtual void SetAttrDesc(TInt theId, const std::string& theValue) = 0;
110   };
111
112
113   //---------------------------------------------------------------
114   typedef std::vector<TInt> TElemNum;
115   
116   struct TElemInfo: virtual TBase
117   {
118     PMeshInfo myMeshInfo;
119     const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
120
121     TInt myNbElem;
122     TInt GetNbElem() const { return myNbElem;}
123     
124     TElemNum myFamNum;
125     TInt GetFamNum(TInt theId) const;
126     void SetFamNum(TInt theId, TInt theVal);
127
128     EBooleen myIsElemNum;
129     EBooleen IsElemNum() const { return myIsElemNum;}
130
131     TElemNum myElemNum;
132     TInt GetElemNum(TInt theId) const;
133     void SetElemNum(TInt theId, TInt theVal);
134
135     EBooleen myIsElemNames;
136     EBooleen IsElemNames() const { return myIsElemNames;}
137
138     TString myElemNames;
139     virtual std::string GetElemName(TInt theId) const = 0;
140     virtual void SetElemName(TInt theId, const std::string& theValue) = 0;
141   };
142
143
144   //---------------------------------------------------------------
145   typedef std::vector<TFloat> TNodeCoord;
146
147   struct TNodeInfo: virtual TElemInfo
148   {
149     TNodeCoord myCoord;
150     TFloat GetNodeCoord(TInt theId, TInt theComp) const;
151     void SetNodeCoord(TInt theId, TInt theComp, TFloat theVal);
152
153     ERepere mySystem;
154     ERepere GetSystem() const { return mySystem;}
155     void SetSystem(ERepere theSystem) { mySystem = theSystem;}
156
157     TString myCoordNames;
158     virtual std::string GetCoordName(TInt theId) const = 0;
159     virtual void SetCoordName(TInt theId, const std::string& theValue) = 0;
160
161     TString myCoordUnits;
162     virtual std::string GetCoordUnit(TInt theId) const = 0;
163     virtual void SetCoordUnit(TInt theId, const std::string& theValue) = 0;
164   };
165
166
167   //---------------------------------------------------------------
168   typedef SliceArray<TElemNum> TConnSlice;
169   typedef ConstSliceArray<TElemNum> TConstConnSlice;
170
171   struct TCellInfo: virtual TElemInfo
172   {
173     EEntiteMaillage myTEntity;
174     EEntiteMaillage GetEntity() const { return myTEntity;}
175
176     EGeometrieElement myTGeom;
177     EGeometrieElement GetGeom() const { return myTGeom;}
178
179     EConnectivite myTConn;
180     EConnectivite GetConn() const { return myTConn;}
181
182     virtual TInt GetConnDim() const = 0;
183
184     TElemNum myConn;
185     TConstConnSlice GetConnSlice(TInt theElemId) const;
186     TConnSlice GetConnSlice(TInt theElemId);
187
188     TInt GetConn(TInt theElemId, TInt theConnId) const;
189     void SetConn(TInt theElemId, TInt theConnId, TInt theVal);
190   };
191
192   //---------------------------------------------------------------
193   struct TPolygoneInfo: virtual TElemInfo
194   {
195     EEntiteMaillage myTEntity; // MED_FACE|MED_MAILLE
196     EEntiteMaillage GetEntity() const { return myTEntity;}
197
198     EGeometrieElement myTGeom; // ePOLYGONE
199     EGeometrieElement GetGeom() const { return ePOLYGONE;}
200
201     EConnectivite myTConn; // eNOD|eDESC(eDESC not used)
202     EConnectivite GetConn() const { return myTConn;}
203
204     TInt myConnDim;
205     TInt GetConnDim() const { return myConnDim;}
206
207     TElemNum myConn; // Table de connectivities
208     TElemNum GetConnectivite() const { return myConn;}
209
210     TElemNum myIndex; // Table de indexes
211     TElemNum GetIndex() {return myIndex;}
212     TInt GetNbConn(TInt theElemId) const;
213   };
214
215   //---------------------------------------------------------------
216   struct TPolyedreInfo: virtual TElemInfo
217   {
218     EEntiteMaillage myTEntity; // MED_FACE|MED_MAILLE
219     EEntiteMaillage GetEntity() const { return myTEntity;}
220
221     EGeometrieElement myTGeom; // ePOLYEDRE
222     EGeometrieElement GetGeom() const { return ePOLYEDRE;}
223
224     EConnectivite myTConn; // eNOD|eDESC(eDESC not used)
225     EConnectivite GetConn() const { return myTConn;}
226
227     TInt myNbConn;
228     TInt GetNbConn() const { return myNbConn;}
229
230     TElemNum myConn; // Table de connectivities
231     TElemNum GetConnectivite() const { return myConn;}
232     
233     TInt myNbFacesIndex;
234     TInt GetNbFacesIndex() const { return myNbFacesIndex;}
235     
236     TElemNum myFacesIndex; // Table de faces indexes
237     TElemNum GetFacesIndex() {return myFacesIndex;}
238     
239     TElemNum myIndex; // Table de indexes
240     TElemNum GetIndex() {return myIndex;}
241     TInt GetNbConn(TInt theElemId) const;
242   };
243
244   //---------------------------------------------------------------
245   struct TFieldInfo: virtual TNameInfo
246   {
247     PMeshInfo myMeshInfo;
248     const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
249
250     ETypeChamp myType;
251     ETypeChamp GetType() const { return myType;}
252
253     TInt myNbComp;
254     TInt GetNbComp() const { return myNbComp;}
255
256     EBooleen myIsLocal;
257     EBooleen GetIsLocal() const { return myIsLocal;}
258
259     TInt myNbRef;
260     TInt GetNbRef() const { return myNbRef;}
261
262     TString myCompNames; 
263     virtual std::string GetCompName(TInt theId) const = 0;
264     virtual void SetCompName(TInt theId, const std::string& theValue) = 0;
265
266     TString myUnitNames; 
267     virtual std::string GetUnitName(TInt theId) const = 0;
268     virtual void SetUnitName(TInt theId, const std::string& theValue) = 0;
269   };
270
271
272   //---------------------------------------------------------------
273   struct TTimeStampInfo: virtual TBase
274   {
275     PFieldInfo myFieldInfo;
276     const PFieldInfo& GetFieldInfo() const { return myFieldInfo;}
277
278     EEntiteMaillage myEntity;
279     EEntiteMaillage GetEntity() const { return myEntity;}
280
281     TGeom myGeom;
282     const TGeom& GetGeom() const { return myGeom;}
283
284     TInt myNbGauss, myNumDt, myNumOrd;
285     TInt GetNbGauss() const { return myNbGauss;}
286     TInt GetNumDt() const { return myNumDt;}
287     TInt GetNumOrd() const { return myNumOrd;}
288
289     TFloat myDt;
290     TFloat GetDt() const { return myDt;}
291
292     TString myGaussName;
293     virtual std::string GetGaussName() const = 0;
294     virtual void SetGaussName(const std::string& theValue) = 0;
295
296     TString myUnitDt;
297     virtual std::string GetUnitDt() const = 0;
298     virtual void SetUnitDt(const std::string& theValue) = 0;
299   };
300   
301
302   //---------------------------------------------------------------
303   typedef std::vector<TFloat> TValue;
304   typedef std::map<EGeometrieElement,TValue> TMeshValue;
305
306   struct TTimeStampVal: virtual TBase
307   {
308     PTimeStampInfo myTimeStampInfo;
309     const PTimeStampInfo& GetTimeStampInfo() const { return myTimeStampInfo;}
310
311     TMeshValue myMeshValue;
312     TFloat GetVal(EGeometrieElement theGeom, TInt theId, 
313                   TInt theComp, TInt theGauss = 0) const;
314
315     void SetVal(EGeometrieElement theGeom, TInt theId, 
316                 TInt theComp, TFloat theVal, TInt theGauss = 0);
317     EModeProfil myPflMode;
318     EModeProfil GetPflMode() const { return myPflMode;}
319     void GetPflMode(EModeProfil theVal) { myPflMode = theVal;}
320
321     TString myPflName;
322     virtual std::string GetPflName() const = 0;
323     virtual void SetPflName(const std::string& theValue) = 0;
324   };
325
326 }
327
328 #endif