]> SALOME platform Git repositories - modules/visu.git/blob - src/CONVERTOR/VISU_Structures.hxx
Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/visu.git] / src / CONVERTOR / VISU_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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //  File   : 
24 //  Author : Alexey PETROV
25 //  Module : VISU
26
27 #ifndef VISU_Structures_HeaderFile
28 #define VISU_Structures_HeaderFile
29
30 /*! 
31   \file VISU_Structures.hxx
32   \brief The file contains definitions for basic classes of the VISU CONVERTER package
33 */
34
35 #include "VISUConvertor.hxx"
36 #include "VISU_IDMapper.hxx"
37 #include "VISU_ConvertorDef.hxx"
38
39 #include "MED_Vector.hxx"
40
41 #include <map>
42 #include <set>
43 #include <string>
44 #include <stdexcept>
45
46 namespace VISU
47 {
48   using MED::TVector;
49
50   //---------------------------------------------------------------
51   typedef std::string TName;
52   typedef TVector<TName> TNames;
53
54   //---------------------------------------------------------------
55   //! Define a basic class for all MED entites which can be identified by its number
56   struct VISU_CONVERTOR_EXPORT TIntId: virtual TBaseStructure
57   {
58     vtkIdType myId;
59
60     TIntId();
61   };
62
63
64   //---------------------------------------------------------------
65   //! Define an utility base class which is repsonsible for preventing repetion
66   struct VISU_CONVERTOR_EXPORT TIsVTKDone: virtual TBaseStructure
67   {
68     mutable bool myIsDone; //!< Say, is the corresponding MED entity already loaded into intermediate data structure 
69     mutable bool myIsVTKDone; //!< Say, is the corresponding intermediate data structure already mapped into VTK representation  
70
71     TIsVTKDone();
72   };
73
74   
75   //---------------------------------------------------------------
76   typedef std::map<TEntity, PMeshOnEntity> TMeshOnEntityMap;
77   typedef std::map<TName, PGroup> TGroupMap;
78
79   //! Define a basic class which corresponds to MED MESH entity
80   /*!
81     This class in its turn contains map of TMeshOnEntity and TGroup substructures,
82     also it keeps name and dimention of corresponding MED MESH entity.
83   */
84   struct VISU_CONVERTOR_EXPORT TMesh: virtual TBaseStructure
85   {
86     TMeshOnEntityMap myMeshOnEntityMap; //!< Contains corresponding meshes for MED ENTITIES
87     TGroupMap myGroupMap; //!< Contains map of bounded MED GROUPS
88     TName myName; //! Name of the corresponding MED MESH
89     vtkIdType myDim; //! Dimension of the corresponding MED MESH
90
91     std::string myGroupsEntry; //!< To simplify publication of the groups in a data tree
92     std::string myFieldsEntry; //!< To simplify publication of the fiels in a data tree
93         
94     // MULTIPR
95     std::string myPartsEntry; //!< To simplify publication of the parts in a data tree
96
97     TMesh();
98   };
99   typedef std::map<std::string, PMesh> TMeshMap;
100
101
102   typedef std::map<VISU::TEntity,VISU::PNamedIDMapper> PNamedIDMapperMap;
103
104   //---------------------------------------------------------------
105   //! Define a basic class which corresponds to MED PROFILE entity
106   struct VISU_CONVERTOR_EXPORT TSubProfile: virtual TBaseStructure
107   {
108     //! Get object number of mesh cell by its VTK one
109     virtual 
110     vtkIdType 
111     GetElemObjID(vtkIdType theID) const = 0;
112
113     //! Get cell VTK ID for corresponding object ID
114     virtual 
115     vtkIdType 
116     GetElemVTKID(vtkIdType theID) const = 0;
117   };
118
119
120   //---------------------------------------------------------------
121   //! Define a containerfor MED PROFILE entities which belongs to the same MED ENTITY
122   struct VISU_CONVERTOR_EXPORT TProfile: virtual TNamedIDMapper
123   {};
124
125
126   //---------------------------------------------------------------
127   bool VISU_CONVERTOR_EXPORT
128   operator<(const PSubProfile& theLeft, const PSubProfile& theRight);
129
130   typedef std::set<PSubProfile> TProfileKey;
131   typedef std::map<TProfileKey, PProfile> TProfileMap;
132
133
134   //---------------------------------------------------------------
135   //! Define a basic class for MED GAUSS entity
136   struct VISU_CONVERTOR_EXPORT TGauss: virtual TBaseStructure
137   {};
138
139
140   //---------------------------------------------------------------
141   //! Define a container for mesh generated from MED GAUSS and corresponding MED PROFILE
142   struct VISU_CONVERTOR_EXPORT TGaussSubMesh: virtual TBaseStructure
143   {
144     PSubProfile mySubProfile; //!< Keeps reference on what submesh the Gauss Points are located
145   };
146
147   
148   //---------------------------------------------------------------
149   //! Define a container for all TGaussSubMesh that belongs to the same MED ENTITY
150   struct VISU_CONVERTOR_EXPORT TGaussMesh: virtual TGaussPtsIDMapper
151   {};
152
153
154   //---------------------------------------------------------------
155   bool VISU_CONVERTOR_EXPORT
156   operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight);
157
158   typedef std::set<PGaussSubMesh> TGaussKey;
159   typedef std::map<TGaussKey, PGaussMesh> TGaussMeshMap;
160
161
162   //---------------------------------------------------------------
163
164   typedef std::map<TName, PFamily> TFamilyMap;
165   typedef std::map<TName, PField> TFieldMap;
166
167   //! Define a basic class which corresponds to MED ENTITY
168   /*!
169     This class in its turn contains map of TGaussMesh and TProfile substructures,
170     also it keeps corresponding map of MED FAMILIES and FIELDS.
171   */
172   struct VISU_CONVERTOR_EXPORT TMeshOnEntity: virtual TNamedIDMapper
173   {
174     TGaussMeshMap myGaussMeshMap; //!< Contains map of Gauss mesh which exist on it
175     TProfileMap myProfileMap; //!< Contains map of Profile mesh which exist on it
176
177     TFamilyMap myFamilyMap; //!< Contains map of MED FAMILIES which belongs to it
178     TFieldMap myFieldMap; //!< Contains map of MED FIELDS which belongs to it
179
180     TName myMeshName; //!< Contains name of the MED MESH where the it belongs to.
181     TEntity myEntity; //!< Referes to MED ENTITY where the it belongs to.
182
183     TMeshOnEntity();
184   };
185
186
187   //---------------------------------------------------------------
188   //! Define a basic class for MED FAMILY entity
189   struct VISU_CONVERTOR_EXPORT TFamily: virtual TIntId,
190                   virtual TUnstructuredGridIDMapper
191   {
192     TEntity myEntity; //!< Referes to MED ENTITY where the TFamily belongs to.
193     TName myName; //!< Contains name of the corresponding MED FAMILY
194
195     TFamily();
196   };
197
198
199   //---------------------------------------------------------------
200   bool VISU_CONVERTOR_EXPORT
201   operator<(const PFamily& theLeft, const PFamily& theRight);
202
203   typedef std::set<PFamily> TFamilySet;
204
205   //! Define a basic class for MED GROUP entity
206   struct VISU_CONVERTOR_EXPORT TGroup: virtual TUnstructuredGridIDMapper
207   {
208     TFamilySet myFamilySet;
209   };
210
211
212   //---------------------------------------------------------------
213   typedef std::map<vtkIdType, PValForTime> TValField;
214   typedef std::pair<vtkFloatingPointType, vtkFloatingPointType> TMinMax;
215
216   //! Define a basic class for MED FIELD entity
217   struct VISU_CONVERTOR_EXPORT TField: virtual TIntId
218   {
219     TEntity myEntity; //!< Referes to MED ENTITY where it belongs to.
220     TName myName; //!< Contains name of the corresponding MED FIELD
221     TName myMeshName; //!< Contains name of the MED MESH where it belongs to.
222     TValField myValField; //!< Contains sequence of values for corresponding MED TIMESTAMPS
223     TNames myCompNames; //!< Contains names of components of the MED FIELD
224     TNames myUnitNames; //!< Contains names of units of the MED FIELD
225     vtkIdType myNbComp; //!< Keeps number of components for the MED FIELD
226
227     //! Calculate min/max values for each of the MED FIELD components among all its timestamps
228     /*!
229       Numeration of the components starts from 1.
230       Zero component contains min/max value for modulus of corresponding vector
231     */
232     virtual
233     TMinMax 
234     GetMinMax(vtkIdType theCompID) = 0;
235     
236     bool myIsMinMaxInitilized; //!< Is the min / max values are calculated
237
238     TField();
239   };
240
241   // MULTIPR
242   struct VISU_CONVERTOR_EXPORT TPart: virtual TIntId
243   {
244     vtkIdType myCurrentRes; //!< Keeps current resolution fot this part
245
246     TPart();
247   };
248
249
250   //---------------------------------------------------------------
251   typedef std::pair<double, std::string> TTime;
252
253   //! Define a basic class for MED TIMESTAMP entity
254   struct VISU_CONVERTOR_EXPORT TValForTime: virtual TIntId
255   {
256     TEntity myEntity; //!< Referes to MED ENTITY where it belongs to.
257     TName myMeshName; //!< Contains name of the MED MESH where it belongs to.
258     TName myFieldName; //!< Contains name of the MED FIELD where it belongs to.
259     TTime myTime;
260
261     PProfile myProfile; //!< Contains corresponding MED PROFILE where the MED TIEMSTMAP attached to
262     PGaussMesh myGaussMesh;
263   };
264  
265
266   //---------------------------------------------------------------
267 }
268
269
270 #endif