]> SALOME platform Git repositories - modules/visu.git/blob - src/CONVERTOR/VISU_MedConvertor.hxx
Salome HOME
c467f0c13339ff24e35fbf8b9fed52f5d6ea1c54
[modules/visu.git] / src / CONVERTOR / VISU_MedConvertor.hxx
1 //  License as published by the Free Software Foundation; either 
2 //  version 2.1 of the License. 
3 // 
4 //  This library is distributed in the hope that it will be useful, 
5 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
6 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
7 //  Lesser General Public License for more details. 
8 // 
9 //  You should have received a copy of the GNU Lesser General Public 
10 //  License along with this library; if not, write to the Free Software 
11 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
12 // 
13 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
14 //
15 //  File   : VISU_MedConvertor.hxx
16 //  Author : Alexey PETROV
17 //  Module : VISU
18
19 #ifndef VISU_MedConvertor_HeaderFile
20 #define VISU_MedConvertor_HeaderFile
21
22 #include "VISU_Convertor_impl.hxx"
23
24 #include "MED_Common.hxx"
25 #include "MED_Structures.hxx"
26
27 #include <boost/thread/mutex.hpp>
28 #include <qfileinfo.h>
29
30 namespace VISU
31 {
32   typedef TVector<TName> TNames;
33
34   //---------------------------------------------------------------
35   class TMEDNamedPointCoords: public virtual TNamedPointCoords
36   {
37     MED::PNodeInfo myNodeInfo;
38     TNames myPointNames;
39   public:
40     void
41     Init(vtkIdType theNbPoints,
42          vtkIdType theDim,
43          const MED::PNodeInfo& theNodeInfo);
44
45     void
46     Init(vtkIdType theNbPoints,
47          vtkIdType theDim,
48          const MED::PGrilleInfo& theGrilleInfo);
49
50     virtual
51     std::string 
52     GetNodeName(vtkIdType theObjID) const;
53   };
54   typedef SharedPtr<TMEDNamedPointCoords> PMEDNamedPointCoords;
55
56
57   //---------------------------------------------------------------
58   struct TMEDMesh: virtual TMeshImpl
59   {
60     MED::PMeshInfo myMeshInfo;
61     MED::TEntityInfo myEntityInfo;
62   };
63   typedef SharedPtr<TMEDMesh> PMEDMesh;
64
65
66   //---------------------------------------------------------------
67   struct TMEDSubProfile: virtual TSubProfileImpl
68   {
69     MED::EGeometrieElement myMGeom;
70
71     TMEDSubProfile():
72       myIsElemNum(MED::eFAUX)
73     {}
74
75     MED::EBooleen myIsElemNum;
76     MED::TElemNum myElemNum;
77
78     virtual 
79     vtkIdType 
80     GetElemObjID(vtkIdType theID) const;
81   };
82   typedef SharedPtr<TMEDSubProfile> PMEDSubProfile;
83
84
85   //---------------------------------------------------------------
86   struct TMEDProfile: virtual TProfileImpl
87   {};
88   typedef SharedPtr<TMEDProfile> PMEDProfile;
89
90
91   //---------------------------------------------------------------
92   struct TMEDGauss: virtual TGaussImpl
93   {
94     MED::PGaussInfo myGaussInfo;
95
96     //! To define a way to implement more detail comparision of the TGaussSubMesh instances
97     virtual
98     void
99     LessThan(const PGaussImpl& theGauss,
100              bool& theResult) const;
101   };
102   typedef SharedPtr<TMEDGauss> PMEDGauss;
103
104
105   //---------------------------------------------------------------
106   struct TMEDGaussSubMesh: virtual TGaussSubMeshImpl
107   {
108     TMEDGaussSubMesh():
109       myIsElemNum(MED::eFAUX)
110     {}
111
112     MED::EBooleen myIsElemNum;
113     MED::TElemNum myElemNum;
114
115     virtual
116     TGaussPointID
117     GetObjID(vtkIdType theID,
118              vtkIdType theStartID) const;
119   };
120   typedef SharedPtr<TMEDGaussSubMesh> PMEDGaussSubMesh;
121
122
123   //---------------------------------------------------------------
124   struct TMEDGaussMesh: virtual TGaussMeshImpl
125   {};
126   typedef SharedPtr<TMEDGaussMesh> PMEDGaussMesh;
127
128
129   //---------------------------------------------------------------
130   struct TMEDSubMesh: virtual TSubMeshImpl
131   {
132     TMEDSubMesh():
133       myIsElemNum(MED::eFAUX)
134     {}
135
136     MED::EBooleen myIsElemNum;
137     MED::TElemNum myElemNum;
138     MED::PElemInfo myElemInfo;
139
140     void
141     Init(const MED::PElemInfo& theElemInfo);
142
143     void
144     Init(const MED::PGrilleInfo& theGrilleInfo);
145
146     virtual 
147     vtkIdType 
148     GetElemObjID(vtkIdType theID) const;
149
150     virtual
151     std::string 
152     GetElemName(vtkIdType theObjID) const;
153   };
154   typedef SharedPtr<TMEDSubMesh> PMEDSubMesh;
155
156
157   //---------------------------------------------------------------
158   typedef std::map<vtkIdType,vtkIdType> TFamilyID2CellsSize;
159
160   struct TMEDMeshOnEntity: virtual TMeshOnEntityImpl
161   {
162     TFamilyID2CellsSize myFamilyID2CellsSize;
163     MED::TGeom2Size myGeom2Size;
164   };
165   typedef SharedPtr<TMEDMeshOnEntity> PMEDMeshOnEntity;
166
167
168   //---------------------------------------------------------------
169   struct TMEDFamily: virtual TFamilyImpl
170   {};
171   typedef SharedPtr<TMEDFamily> PMEDFamily;
172   
173
174   //---------------------------------------------------------------
175   struct TMEDGroup: virtual TGroupImpl
176   {};
177   typedef SharedPtr<TMEDGroup> PMEDGroup;
178
179
180   //---------------------------------------------------------------
181   struct TMEDField: virtual TFieldImpl
182   {};
183   typedef SharedPtr<TMEDField> PMEDField;
184
185
186   //---------------------------------------------------------------
187   struct TMEDValForTime: virtual TValForTimeImpl
188   {};
189   typedef SharedPtr<TMEDValForTime> PMEDValForTime;
190
191 }
192
193 class VISU_MedConvertor: public VISU_Convertor_impl
194 {  
195   VISU_MedConvertor();
196   VISU_MedConvertor(const VISU_MedConvertor&);
197   
198   bool myIsEntitiesDone;
199   bool myIsFieldsDone;
200   bool myIsGroupsDone;
201   bool myIsMinMaxDone;
202
203 public:
204   VISU_MedConvertor(const std::string& theFileName);
205
206   virtual
207   VISU_Convertor* 
208   BuildEntities();
209
210   virtual
211   VISU_Convertor* 
212   BuildFields();
213
214   virtual
215   VISU_Convertor* 
216   BuildMinMax();
217
218   virtual
219   VISU_Convertor* 
220   BuildGroups();
221
222 protected:
223   QFileInfo myFileInfo;
224
225   virtual
226   int
227   LoadMeshOnEntity(VISU::PMeshImpl theMesh,
228                    VISU::PMeshOnEntityImpl theMeshOnEntity);
229   
230   virtual
231   int
232   LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
233                      VISU::PMeshOnEntityImpl theMeshOnEntity, 
234                      VISU::PFamilyImpl theFamily);
235
236   virtual
237   int
238   LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
239                   const VISU::TFamilySet& theFamilySet);
240   
241   virtual
242   int
243   LoadValForTimeOnMesh(VISU::PMeshImpl theMesh, 
244                        VISU::PMeshOnEntityImpl theMeshOnEntity, 
245                        VISU::PFieldImpl theField, 
246                        VISU::PValForTimeImpl theValForTime);
247   
248   virtual 
249   int
250   LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh, 
251                            VISU::PMeshOnEntityImpl theMeshOnEntity, 
252                            VISU::PFieldImpl theField, 
253                            VISU::PValForTimeImpl theValForTime);
254
255   int
256   LoadPoints(const MED::PWrapper& theMed,
257              const VISU::PMEDMesh theMesh);
258   
259   int
260   LoadPointsOnFamily(const MED::PWrapper& theMed,
261                      const VISU::PMEDMesh theMesh, 
262                      const VISU::PMEDFamily theFamily);
263   
264   int
265   LoadCellsOnEntity(const MED::PWrapper& theMed,
266                     const VISU::PMEDMesh theMesh,
267                     const VISU::PMEDMeshOnEntity theMeshOnEntity);
268   
269   int
270   LoadCellsOnFamily(const MED::PWrapper& theMed,
271                     const VISU::PMEDMesh theMesh,
272                     const VISU::PMEDMeshOnEntity theMeshOnEntity,
273                     const VISU::PMEDFamily theFamily);
274   
275   int
276   LoadValForTimeOnMesh(const MED::PWrapper& theMed,
277                        VISU::PMEDMesh theMesh,
278                        VISU::PMEDMeshOnEntity theMeshOnEntity,
279                        VISU::PMEDField theField, 
280                        VISU::PMEDValForTime theValForTime);
281   
282   int
283   LoadValForTimeOnGaussPts(const MED::PWrapper& theMed,
284                            VISU::PMEDMesh theMesh,
285                            VISU::PMEDMeshOnEntity theMeshOnEntity,
286                            VISU::PMEDField theField, 
287                            VISU::PMEDValForTime theValForTime);
288 };
289
290 #endif