Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef VISU_MedConvertor_HeaderFile
00028 #define VISU_MedConvertor_HeaderFile
00029
00030 #include "VISUConvertor.hxx"
00031 #include "VISU_Convertor_impl.hxx"
00032 #include "VISU_Structures_impl.hxx"
00033 #include "VISU_PointCoords.hxx"
00034 #include "VISU_MeshValue.hxx"
00035
00036 #include "MED_Wrapper.hxx"
00037 #include "MED_Common.hxx"
00038 #include "MED_Structures.hxx"
00039 #include "MED_GaussUtils.hxx"
00040
00041 #include <boost/thread/mutex.hpp>
00042
00043 namespace VISU
00044 {
00045
00046 struct VISU_CONVERTOR_EXPORT TMEDCoordHolder: TCoordHolder<MED::PNodeCoord>
00047 {
00048 virtual
00049 const TCoord*
00050 GetPointer() const
00051 {
00052 return &(*myCoord)[0];
00053 }
00054
00055 virtual
00056 TCoord*
00057 GetPointer()
00058 {
00059 return &(*myCoord)[0];
00060 }
00061 };
00062
00063
00064
00065 struct VISU_CONVERTOR_EXPORT TMEDGaussCoordHolder: TCoordHolderBase
00066 {
00067 MED::PGaussCoord myGaussCoord;
00068
00070 void
00071 Init(const MED::PGaussCoord& theGaussCoord)
00072 {
00073 MED::TInt aNbGauss = theGaussCoord->GetNbGauss();
00074 MED::TInt aNbElem = theGaussCoord->GetNbElem();
00075 MED::TInt aDim = theGaussCoord->GetDim();
00076 MED::TInt aNbCells = aNbElem * aNbGauss;
00077 TCoordHolderBase::Init(aNbCells, aDim);
00078 myGaussCoord = theGaussCoord;
00079 }
00080
00082 virtual
00083 TCCoordSlice
00084 GetCoordSlice(vtkIdType theNodeId) const
00085 {
00086 MED::TInt anElemId = theNodeId / myGaussCoord->GetNbGauss();
00087 MED::TCCoordSliceArr aCoordSliceArr = myGaussCoord->GetCoordSliceArr(anElemId);
00088 MED::TInt aGaussId = theNodeId % myGaussCoord->GetNbGauss();
00089 return aCoordSliceArr[aGaussId];
00090 }
00091
00093 virtual
00094 TCoordSlice
00095 GetCoordSlice(vtkIdType theNodeId)
00096 {
00097 MED::TInt anElemId = theNodeId / myGaussCoord->GetNbGauss();
00098 MED::TCoordSliceArr aCoordSliceArr = myGaussCoord->GetCoordSliceArr(anElemId);
00099 MED::TInt aGaussId = theNodeId % myGaussCoord->GetNbGauss();
00100 return aCoordSliceArr[aGaussId];
00101 }
00102
00103 virtual
00104 unsigned char*
00105 GetValuePtr()
00106 {
00107 return myGaussCoord->GetValuePtr();
00108 }
00109 };
00110
00111
00112
00113 template<class TValueType>
00114 struct VISU_CONVERTOR_EXPORT TTMEDMeshValue: TTMeshValueHolder<TValueType,
00115 MED::SharedPtr<MED::TTMeshValue<MED::TVector<TValueType> > > >
00116 {
00117 virtual
00118 const TValueType*
00119 GetPointer() const
00120 {
00121 return this->myContainer->GetPointer();
00122 }
00123
00124 virtual
00125 TValueType*
00126 GetPointer()
00127 {
00128 return this->myContainer->GetPointer();
00129 }
00130 };
00131
00132
00133
00134 typedef std::map<vtkIdType, vtkIdType> TObj2VTKID;
00135
00136 class TMEDNamedPointCoords: public virtual TNamedPointCoords
00137 {
00138 MED::EBooleen myIsElemNum;
00139 MED::PElemNum myElemNum;
00140 mutable TObj2VTKID myObj2VTKID;
00141
00142 MED::EVersion myVersion;
00143 MED::PString myElemNames;
00144 MED::EBooleen myIsElemNames;
00145
00146 public:
00147 TMEDNamedPointCoords():
00148 myIsElemNum(MED::eFAUX),
00149 myIsElemNames(MED::eFAUX)
00150 {}
00151
00152 void
00153 Init(const MED::PNodeInfo& theNodeInfo,
00154 MED::EVersion theVersion);
00155
00156 void
00157 Init(const MED::PGrilleInfo& theGrilleInfo);
00158
00160 virtual
00161 vtkIdType
00162 GetObjID(vtkIdType theID) const;
00163
00165 virtual
00166 vtkIdType
00167 GetVTKID(vtkIdType theID) const;
00168
00170 virtual
00171 std::string
00172 GetNodeName(vtkIdType theObjID) const;
00173
00175 virtual
00176 unsigned long int
00177 GetMemorySize();
00178 };
00179 typedef MED::SharedPtr<TMEDNamedPointCoords> PMEDNamedPointCoords;
00180
00181
00182
00183 struct VISU_CONVERTOR_EXPORT TMEDMesh: virtual TMeshImpl
00184 {
00185 MED::PMeshInfo myMeshInfo;
00186 MED::TEntityInfo myEntityInfo;
00187 };
00188 typedef MED::SharedPtr<TMEDMesh> PMEDMesh;
00189
00190
00191
00192 struct VISU_CONVERTOR_EXPORT TMEDSubProfile: virtual TSubProfileImpl
00193 {
00194 MED::EGeometrieElement myMGeom;
00195
00196 TMEDSubProfile():
00197 myIsElemNum(MED::eFAUX)
00198 {}
00199
00200 MED::EBooleen myIsElemNum;
00201 MED::PElemNum myElemNum;
00202
00203 virtual
00204 vtkIdType
00205 GetElemObjID(vtkIdType theID) const;
00206
00208 virtual
00209 vtkIdType
00210 GetElemVTKID(vtkIdType theID) const;
00211
00213 virtual
00214 unsigned long int
00215 GetMemorySize();
00216 };
00217 typedef MED::SharedPtr<TMEDSubProfile> PMEDSubProfile;
00218
00219
00220
00221 struct VISU_CONVERTOR_EXPORT TMEDProfile: virtual TProfileImpl
00222 {};
00223 typedef MED::SharedPtr<TMEDProfile> PMEDProfile;
00224
00225
00226
00227 struct VISU_CONVERTOR_EXPORT TMEDGauss: virtual TGaussImpl
00228 {
00229 MED::PGaussInfo myGaussInfo;
00230
00232 virtual
00233 void
00234 LessThan(const PGaussImpl& theGauss,
00235 bool& theResult) const;
00236 };
00237 typedef MED::SharedPtr<TMEDGauss> PMEDGauss;
00238
00239
00240
00241 struct VISU_CONVERTOR_EXPORT TMEDGaussSubMesh: virtual TGaussSubMeshImpl
00242 {
00243 TMEDGaussSubMesh():
00244 myIsElemNum(MED::eFAUX)
00245 {}
00246
00247 MED::EBooleen myIsElemNum;
00248 MED::PElemNum myElemNum;
00249
00250 virtual
00251 TGaussPointID
00252 GetObjID(vtkIdType theID) const;
00253
00254 virtual
00255 vtkIdType
00256 GetVTKID( const TGaussPointID& theID ) const;
00257
00259 virtual
00260 unsigned long int
00261 GetMemorySize();
00262 };
00263 typedef MED::SharedPtr<TMEDGaussSubMesh> PMEDGaussSubMesh;
00264
00265
00266
00267 struct VISU_CONVERTOR_EXPORT TMEDGaussMesh: virtual TGaussMeshImpl
00268 {};
00269 typedef MED::SharedPtr<TMEDGaussMesh> PMEDGaussMesh;
00270
00271
00272
00273 struct VISU_CONVERTOR_EXPORT TMEDSubMesh: virtual TSubMeshImpl
00274 {
00275 TMEDSubMesh():
00276 myIsElemNum(MED::eFAUX),
00277 myIsElemNames(MED::eFAUX)
00278 {}
00279
00280 MED::EBooleen myIsElemNum;
00281 MED::PElemNum myElemNum;
00282
00283 MED::EVersion myVersion;
00284 MED::PString myElemNames;
00285 MED::EBooleen myIsElemNames;
00286
00287 void
00288 Init(const MED::PElemInfo& theElemInfo,
00289 MED::EVersion theVersion);
00290
00291 void
00292 Init(const MED::PGrilleInfo& theGrilleInfo);
00293
00294 virtual
00295 vtkIdType
00296 GetElemObjID(vtkIdType theID) const;
00297
00298 virtual
00299 std::string
00300 GetElemName(vtkIdType theObjID) const;
00301
00303 virtual
00304 unsigned long int
00305 GetMemorySize();
00306 };
00307 typedef MED::SharedPtr<TMEDSubMesh> PMEDSubMesh;
00308
00309
00310
00311 typedef std::map<vtkIdType,vtkIdType> TFamilyID2CellsSize;
00312
00313 typedef std::map<vtkIdType,vtkIdType> TElemID2FamilyID;
00314 typedef std::map<MED::EGeometrieElement,TElemID2FamilyID> TGeom2ElemID2FamilyID;
00315
00316 struct VISU_CONVERTOR_EXPORT TMEDMeshOnEntity: virtual TMeshOnEntityImpl
00317 {
00318 TFamilyID2CellsSize myFamilyID2CellsSize;
00319 TGeom2ElemID2FamilyID myGeom2ElemID2FamilyID;
00320 MED::TGeom2Size myGeom2Size;
00321 };
00322 typedef MED::SharedPtr<TMEDMeshOnEntity> PMEDMeshOnEntity;
00323
00324
00325
00326 struct VISU_CONVERTOR_EXPORT TMEDFamily: virtual TFamilyImpl
00327 {};
00328 typedef MED::SharedPtr<TMEDFamily> PMEDFamily;
00329
00330
00331
00332 struct VISU_CONVERTOR_EXPORT TMEDGroup: virtual TGroupImpl
00333 {};
00334 typedef MED::SharedPtr<TMEDGroup> PMEDGroup;
00335
00336
00337
00338 struct VISU_CONVERTOR_EXPORT TMEDField: virtual TFieldImpl
00339 {};
00340 typedef MED::SharedPtr<TMEDField> PMEDField;
00341
00342
00343
00344 struct VISU_CONVERTOR_EXPORT TMEDValForTime: virtual TValForTimeImpl
00345 {};
00346 typedef MED::SharedPtr<TMEDValForTime> PMEDValForTime;
00347
00348 }
00349
00350 class VISU_MedConvertor: public VISU_Convertor_impl
00351 {
00352 VISU_MedConvertor();
00353 VISU_MedConvertor(const VISU_MedConvertor&);
00354
00355 bool myIsEntitiesDone;
00356 bool myIsFieldsDone;
00357 bool myIsGroupsDone;
00358 bool myIsMinMaxDone;
00359
00360 public:
00361 VISU_MedConvertor(const std::string& theFileName, MED::PWrapper theMed);
00362
00363 virtual
00364 VISU_Convertor*
00365 BuildEntities();
00366
00367 virtual
00368 VISU_Convertor*
00369 BuildFields();
00370
00371 virtual
00372 VISU_Convertor*
00373 BuildMinMax();
00374
00375 virtual
00376 VISU_Convertor*
00377 BuildGroups();
00378
00379 protected:
00380 MED::PWrapper myMed;
00381
00382 virtual
00383 int
00384 LoadMeshOnEntity(VISU::PMeshImpl theMesh,
00385 VISU::PMeshOnEntityImpl theMeshOnEntity);
00386
00387 virtual
00388 int
00389 LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
00390 VISU::PMeshOnEntityImpl theMeshOnEntity,
00391 VISU::PFamilyImpl theFamily);
00392
00393 virtual
00394 int
00395 LoadMeshOnGroup(VISU::PMeshImpl theMesh,
00396 const VISU::TFamilySet& theFamilySet);
00397
00398 virtual
00399 int
00400 LoadValForTimeOnMesh(VISU::PMeshImpl theMesh,
00401 VISU::PMeshOnEntityImpl theMeshOnEntity,
00402 VISU::PFieldImpl theField,
00403 VISU::PValForTimeImpl theValForTime);
00404
00405 virtual
00406 int
00407 LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh,
00408 VISU::PMeshOnEntityImpl theMeshOnEntity,
00409 VISU::PFieldImpl theField,
00410 VISU::PValForTimeImpl theValForTime);
00411
00412 int
00413 LoadPoints(const MED::PWrapper& theMed,
00414 const VISU::PMEDMesh theMesh);
00415
00416 int
00417 LoadPointsOnFamily(const MED::PWrapper& theMed,
00418 const VISU::PMEDMesh theMesh,
00419 const VISU::PMEDFamily theFamily);
00420
00421 int
00422 LoadCellsOnEntity(const MED::PWrapper& theMed,
00423 const VISU::PMEDMesh theMesh,
00424 const VISU::PMEDMeshOnEntity theMeshOnEntity);
00425
00426 int
00427 LoadCellsOnFamily(const MED::PWrapper& theMed,
00428 const VISU::PMEDMesh theMesh,
00429 const VISU::PMEDMeshOnEntity theMeshOnEntity,
00430 const VISU::PMEDFamily theFamily);
00431
00432 int
00433 LoadValForTimeOnMesh(const MED::PWrapper& theMed,
00434 VISU::PMEDMesh theMesh,
00435 VISU::PMEDMeshOnEntity theMeshOnEntity,
00436 VISU::PMEDField theField,
00437 VISU::PMEDValForTime theValForTime);
00438
00439 int
00440 LoadValForTimeOnGaussPts(const MED::PWrapper& theMed,
00441 VISU::PMEDMesh theMesh,
00442 VISU::PMEDMeshOnEntity theMeshOnEntity,
00443 VISU::PMEDField theField,
00444 VISU::PMEDValForTime theValForTime);
00445 };
00446
00447 #endif