1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // Author : Alexey PETROV
27 #ifndef VISU_Structures_HeaderFile
28 #define VISU_Structures_HeaderFile
31 \file VISU_Structures.hxx
32 \brief The file contains definitions for basic classes of the VISU CONVERTER package
35 #include "VISUConvertor.hxx"
36 #include "VISU_IDMapper.hxx"
37 #include "VISU_ConvertorDef.hxx"
39 #include "MED_Vector.hxx"
50 //---------------------------------------------------------------
51 typedef std::string TName;
52 typedef TVector<TName> TNames;
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
64 //---------------------------------------------------------------
65 //! Define an utility base class which is repsonsible for preventing repetion
66 struct VISU_CONVERTOR_EXPORT TIsVTKDone: virtual TBaseStructure
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
75 //---------------------------------------------------------------
76 typedef std::map<TEntity, PMeshOnEntity> TMeshOnEntityMap;
77 typedef std::map<TName, PGroup> TGroupMap;
79 //! Define a basic class which corresponds to MED MESH entity
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.
84 struct VISU_CONVERTOR_EXPORT TMesh: virtual TBaseStructure
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
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 std::string myPartsEntry; //!< To simplify publication of the parts in a data tree
97 typedef std::map<std::string, PMesh> TMeshMap;
100 //---------------------------------------------------------------
101 //! Define a basic class which corresponds to MED PROFILE entity
102 struct VISU_CONVERTOR_EXPORT TSubProfile: virtual TBaseStructure
104 //! Get object number of mesh cell by its VTK one
107 GetElemObjID(vtkIdType theID) const = 0;
109 //! Get cell VTK ID for corresponding object ID
112 GetElemVTKID(vtkIdType theID) const = 0;
116 //---------------------------------------------------------------
117 //! Define a containerfor MED PROFILE entities which belongs to the same MED ENTITY
118 struct VISU_CONVERTOR_EXPORT TProfile: virtual TNamedIDMapper
122 //---------------------------------------------------------------
123 bool VISU_CONVERTOR_EXPORT
124 operator<(const PSubProfile& theLeft, const PSubProfile& theRight);
126 typedef std::set<PSubProfile> TProfileKey;
127 typedef std::map<TProfileKey, PProfile> TProfileMap;
130 //---------------------------------------------------------------
131 //! Define a basic class for MED GAUSS entity
132 struct VISU_CONVERTOR_EXPORT TGauss: virtual TBaseStructure
136 //---------------------------------------------------------------
137 //! Define a container for mesh generated from MED GAUSS and corresponding MED PROFILE
138 struct VISU_CONVERTOR_EXPORT TGaussSubMesh: virtual TBaseStructure
140 PSubProfile mySubProfile; //!< Keeps reference on what submesh the Gauss Points are located
144 //---------------------------------------------------------------
145 //! Define a container for all TGaussSubMesh that belongs to the same MED ENTITY
146 struct VISU_CONVERTOR_EXPORT TGaussMesh: virtual TGaussPtsIDMapper
150 //---------------------------------------------------------------
151 bool VISU_CONVERTOR_EXPORT
152 operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight);
154 typedef std::set<PGaussSubMesh> TGaussKey;
155 typedef std::map<TGaussKey, PGaussMesh> TGaussMeshMap;
158 //---------------------------------------------------------------
160 typedef std::map<TName, PFamily> TFamilyMap;
161 typedef std::map<TName, PField> TFieldMap;
163 typedef std::map<vtkIdType, PFamily> TFamilyIDMap;
165 //! Define a basic class which corresponds to MED ENTITY
167 This class in its turn contains map of TGaussMesh and TProfile substructures,
168 also it keeps corresponding map of MED FAMILIES and FIELDS.
170 struct VISU_CONVERTOR_EXPORT TMeshOnEntity: virtual TNamedIDMapper
172 TGaussMeshMap myGaussMeshMap; //!< Contains map of Gauss mesh which exist on it
173 TProfileMap myProfileMap; //!< Contains map of Profile mesh which exist on it
175 TFamilyMap myFamilyMap; //!< Contains map of MED FAMILIES which belongs to it
176 TFamilyIDMap myFamilyIDMap; //!< Contains map of MED FAMILIES which belongs to it
178 TFieldMap myFieldMap; //!< Contains map of MED FIELDS which belongs to it
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.
187 //---------------------------------------------------------------
188 //! Define a basic class for MED FAMILY entity
189 struct VISU_CONVERTOR_EXPORT TFamily: virtual TIntId,
190 virtual TUnstructuredGridIDMapper
192 TEntity myEntity; //!< Referes to MED ENTITY where the TFamily belongs to.
193 TName myName; //!< Contains name of the corresponding MED FAMILY
199 //---------------------------------------------------------------
200 bool VISU_CONVERTOR_EXPORT
201 operator<(const PFamily& theLeft, const PFamily& theRight);
203 typedef std::pair<TEntity, PFamily> TEnity2Family;
204 typedef std::set<TEnity2Family> TFamilySet;
206 //! Define a basic class for MED GROUP entity
207 struct VISU_CONVERTOR_EXPORT TGroup: virtual TUnstructuredGridIDMapper
209 TFamilySet myFamilySet;
213 //---------------------------------------------------------------
214 typedef std::map<vtkIdType, PValForTime> TValField;
215 typedef std::pair<double, double> TMinMax;
217 //! Define a basic class for MED FIELD entity
218 struct VISU_CONVERTOR_EXPORT TField: virtual TIntId
220 TEntity myEntity; //!< Referes to MED ENTITY where it belongs to.
221 TName myName; //!< Contains name of the corresponding MED FIELD
222 TName myMeshName; //!< Contains name of the MED MESH where it belongs to.
223 TValField myValField; //!< Contains sequence of values for corresponding MED TIMESTAMPS
224 TNames myCompNames; //!< Contains names of components of the MED FIELD
225 TNames myUnitNames; //!< Contains names of units of the MED FIELD
226 vtkIdType myNbComp; //!< Keeps number of components for the MED FIELD
227 bool myIsELNO; //!< Defines whether this field contains specific "ELNO" data or not
229 //! Calculate min/max values for each of the MED FIELD components among all its timestamps
231 Numeration of the components starts from 1.
232 Zero component contains min/max value for modulus of corresponding vector
236 GetMinMax(vtkIdType theCompID,
237 const TNames& theGroupNames,
238 TGaussMetric theGaussMetric = VISU::AVERAGE_METRIC) = 0;
240 //! Calculate average min/max values for each of the MED FIELD components among all its timestamps
243 GetAverageMinMax(vtkIdType theCompID,
244 const TNames& theGroupNames,
245 TGaussMetric theGaussMetric = VISU::AVERAGE_METRIC) = 0;
247 bool myIsMinMaxInitilized; //!< Is the min / max values are calculated
253 struct VISU_CONVERTOR_EXPORT TPart: virtual TIntId
255 vtkIdType myCurrentRes; //!< Keeps current resolution fot this part
261 //---------------------------------------------------------------
262 typedef std::pair<double, std::string> TTime;
264 //! Define a basic class for MED TIMESTAMP entity
265 struct VISU_CONVERTOR_EXPORT TValForTime: virtual TIntId
267 TEntity myEntity; //!< Referes to MED ENTITY where it belongs to.
268 TName myMeshName; //!< Contains name of the MED MESH where it belongs to.
269 TName myFieldName; //!< Contains name of the MED FIELD where it belongs to.
272 PProfile myProfile; //!< Contains corresponding MED PROFILE where the MED TIEMSTMAP attached to
273 PGaussMesh myGaussMesh;
275 //! Get maximum number of Gauss Points among all geometrical types (provided for convenience)
278 GetMaxNbGauss() const = 0;
282 //---------------------------------------------------------------