1 // Copyright (C) 2007-2010 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
23 // VISU OBJECT : interactive object for VISU entities implementation
24 // File : VISU_MedConvertor.cxx
25 // Author : Alexey PETROV
28 #include "VISU_MedConvertor.hxx"
29 #include "VISU_ConvertorUtils.hxx"
31 #include "MED_Factory.hxx"
32 #include "MED_Algorithm.hxx"
33 #include "MED_GaussUtils.hxx"
34 #include "MED_Utilities.hxx"
36 #include "SALOMEconfig.h"
38 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
42 #include <Standard_Failure.hxx>
45 #include <Standard_ErrorHandler.hxx>
48 #include <vtkCellType.h>
60 static int MYDEBUG = 0;
61 static int MYVALUEDEBUG = 0;
62 static int MY_FAMILY_DEBUG = 0;
63 static int MY_GROUP_DEBUG = 0;
66 static int MYDEBUG = 0;
67 static int MYVALUEDEBUG = 0;
68 static int MY_FAMILY_DEBUG = 0;
69 static int MY_GROUP_DEBUG = 0;
72 #define _LOAD_FAMILIES_
73 #define _EDF_NODE_IDS_
79 //---------------------------------------------------------------
81 MEDGeom2NbNodes(MED::EGeometrieElement theMEDGeomType)
83 return theMEDGeomType % 100;
87 //---------------------------------------------------------------
89 MEDGeom2VISU(MED::EGeometrieElement theGeom)
92 case MED::ePOINT1: return VISU::ePOINT1;
93 case MED::eSEG2: return VISU::eSEG2;
94 case MED::eTRIA3: return VISU::eTRIA3;
95 case MED::eQUAD4: return VISU::eQUAD4;
96 case MED::eTETRA4: return VISU::eTETRA4;
97 case MED::eHEXA8: return VISU::eHEXA8;
98 case MED::ePENTA6: return VISU::ePENTA6;
99 case MED::ePYRA5: return VISU::ePYRA5;
101 case MED::eSEG3: return VISU::eSEG3;
102 case MED::eTRIA6: return VISU::eTRIA6;
103 case MED::eQUAD8: return VISU::eQUAD8;
104 case MED::eTETRA10: return VISU::eTETRA10;
105 case MED::eHEXA20: return VISU::eHEXA20;
106 case MED::ePENTA15: return VISU::ePENTA15;
107 case MED::ePYRA13: return VISU::ePYRA13;
109 case MED::ePOLYGONE: return VISU::ePOLYGONE;
110 case MED::ePOLYEDRE: return VISU::ePOLYEDRE;
116 //---------------------------------------------------------------
117 MED::EGeometrieElement
118 VISUGeom2MED(int theGeom)
121 case VISU::ePOINT1: return MED::ePOINT1;
122 case VISU::eSEG2: return MED::eSEG2;
123 case VISU::eTRIA3: return MED::eTRIA3;
124 case VISU::eQUAD4: return MED::eQUAD4;
125 case VISU::eTETRA4: return MED::eTETRA4;
126 case VISU::eHEXA8: return MED::eHEXA8;
127 case VISU::ePENTA6: return MED::ePENTA6;
128 case VISU::ePYRA5: return MED::ePYRA5;
130 case VISU::eSEG3: return MED::eSEG3;
131 case VISU::eTRIA6: return MED::eTRIA6;
132 case VISU::eQUAD8: return MED::eQUAD8;
133 case VISU::eTETRA10: return MED::eTETRA10;
134 case VISU::eHEXA20: return MED::eHEXA20;
135 case VISU::ePENTA15: return MED::ePENTA15;
136 case VISU::ePYRA13: return MED::ePYRA13;
138 case VISU::ePOLYGONE: return MED::ePOLYGONE;
139 case VISU::ePOLYEDRE: return MED::ePOLYEDRE;
141 return MED::EGeometrieElement(-1);
145 //---------------------------------------------------------------
147 MEDEntityToVTK( MED::EEntiteMaillage theMEDEntity )
149 VISU::TEntity anEntity = VISU::TEntity( -1 );
151 switch(theMEDEntity){
153 anEntity = VISU::NODE_ENTITY;
156 anEntity = VISU::EDGE_ENTITY;
159 anEntity = VISU::FACE_ENTITY;
162 anEntity = VISU::CELL_ENTITY;
164 case MED::eNOEUD_ELEMENT :
165 anEntity = VISU::CELL_ENTITY;
173 //---------------------------------------------------------------
175 VTKEntityToMED(VISU::TEntity theVTKEntity)
177 switch(theVTKEntity){
178 case VISU::NODE_ENTITY: return MED::eNOEUD;
179 case VISU::EDGE_ENTITY: return MED::eARETE;
180 case VISU::FACE_ENTITY: return MED::eFACE;
181 case VISU::CELL_ENTITY: return MED::eMAILLE;
183 return MED::EEntiteMaillage(-1);
187 //---------------------------------------------------------------
189 CrSubProfile(const MED::PWrapper& theMEDWrapper,
190 const MED::PMeshInfo& theMeshInfo,
191 MED::EEntiteMaillage theMEntity,
192 MED::EGeometrieElement theMGeom,
193 const MED::TGeom2Size& theGeom2Size,
194 const MED::TGeom2Profile& theGeom2Profile)
196 VISU::EGeometry aEGeom = MEDGeom2VISU(theMGeom);
197 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
199 VISU::PMEDSubProfile aSubProfile(new VISU::TMEDSubProfile());
200 aSubProfile->myGeom = aEGeom;
201 aSubProfile->myMGeom = theMGeom;
202 aSubProfile->myStatus = VISU::eAddAll;
204 MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(theMGeom);
205 if(aTimeStampIter == theGeom2Size.end())
206 aSubProfile->myStatus = VISU::eRemoveAll;
208 MED::TGeom2Profile::const_iterator aProfileIter = theGeom2Profile.find(theMGeom);
209 if(aProfileIter != theGeom2Profile.end()){
210 MED::PProfileInfo aProfileInfo = aProfileIter->second;
212 aSubProfile->myName = aProfileInfo->GetName();
213 aSubProfile->myStatus = VISU::eAddPart;
215 const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
216 TInt aNbElem = anElemNum.size();
217 aSubProfile->myNbCells = aNbElem;
219 case MED::ePOLYGONE: {
220 MED::PPolygoneInfo aPolygoneInfo =
221 theMEDWrapper->GetPPolygoneInfo(theMeshInfo,theMEntity,theMGeom);
222 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
223 TInt aNbConn = aPolygoneInfo->GetNbConn( anElemNum[ anElemId ] - 1 );
224 aSubProfile->myCellsSize += aNbConn;
228 case MED::ePOLYEDRE: {
229 MED::PPolyedreInfo aPolyedreInfo =
230 theMEDWrapper->GetPPolyedreInfo(theMeshInfo,theMEntity,theMGeom);
231 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
232 MED::TCConnSliceArr aConnSliceArr =
233 aPolyedreInfo->GetConnSliceArr( anElemNum[ anElemId ] - 1 );
234 TInt aNbFaces = aConnSliceArr.size();
236 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
237 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
238 TInt aNbConn = aConnSlice.size();
239 aCellSize += aNbConn;
241 aSubProfile->myCellsSize += aCellSize;
246 aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes;
249 TInt aNbElem = aTimeStampIter->second;
250 aSubProfile->myNbCells = aNbElem;
252 case MED::ePOLYGONE: {
253 MED::PPolygoneInfo aPolygoneInfo =
254 theMEDWrapper->GetPPolygoneInfo(theMeshInfo,theMEntity,theMGeom);
255 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
256 TInt aNbConn = aPolygoneInfo->GetNbConn(anElemId);
257 aSubProfile->myCellsSize += aNbConn;
261 case MED::ePOLYEDRE: {
262 MED::PPolyedreInfo aPolyedreInfo =
263 theMEDWrapper->GetPPolyedreInfo(theMeshInfo,theMEntity,theMGeom);
264 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
265 MED::TCConnSliceArr aConnSliceArr =
266 aPolyedreInfo->GetConnSliceArr(anElemId);
267 TInt aNbFaces = aConnSliceArr.size();
269 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
270 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
271 TInt aNbConn = aConnSlice.size();
272 aCellSize += aNbConn;
274 aSubProfile->myCellsSize += aCellSize;
279 aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes;
284 "- aMGeom = "<<theMGeom<<
285 "; aEGeom = "<<aEGeom<<
286 "; aName = '"<<aSubProfile->myName<<"'"<<
287 "; aStatus = "<<aSubProfile->myStatus<<
288 "; aNbCells = "<<aSubProfile->myNbCells<<
289 "; aCellsSize = "<<aSubProfile->myCellsSize<<
296 //---------------------------------------------------------------
298 GetProfileKey(const MED::PWrapper& theMEDWrapper,
299 const MED::PMeshInfo& theMeshInfo,
300 const MED::PTimeStampValueBase& theTimeStampValue,
301 const VISU::TMEDMeshOnEntity& theMeshOnEntity,
302 MED::EEntiteMaillage theMEntity,
303 const MED::TGeom2Size& theGeom2Size)
305 INITMSG(MYDEBUG,"GetProfileKey"<<endl);
307 VISU::TProfileKey aProfileKey;
308 const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
310 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
311 MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin();
312 for(; anIter != aGeom2Size.end(); anIter++){
313 MED::EGeometrieElement aMGeom = anIter->first;
314 VISU::PSubProfile aSubProfile = CrSubProfile(theMEDWrapper,
320 aProfileKey.insert(aSubProfile);
327 //---------------------------------------------------------------
329 InitProfile(const MED::PWrapper& theMEDWrapper,
330 const MED::PMeshInfo& theMeshInfo,
331 MED::PTimeStampValueBase& theTimeStampValue,
332 VISU::TMEDMeshOnEntity& theMeshOnEntity,
333 MED::EEntiteMaillage theMEntity,
334 const MED::TGeom2Size& theGeom2Size,
335 VISU::TMEDValForTime& theValForTime)
337 VISU::TTimerLog aTimerLog(MYDEBUG,"InitProfile");
338 INITMSG(MYDEBUG,"InitProfile"<<endl);
340 VISU::TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap;
342 VISU::TProfileKey aProfileKey = GetProfileKey(theMEDWrapper,
349 VISU::TProfileMap::const_iterator anIter = aProfileMap.find(aProfileKey);
350 if(anIter != aProfileMap.end()){
351 theValForTime.myProfile = anIter->second;
352 INITMSG(MYDEBUG,"aProfileMap.find(aProfileKey)"<<endl);
354 VISU::PMEDProfile aProfile(new VISU::TMEDProfile());
355 VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
357 VISU::TProfileKey::const_iterator anIter = aProfileKey.begin();
358 for(; anIter != aProfileKey.end(); anIter++){
359 VISU::PMEDSubProfile aSubProfile(*anIter);
361 if(aProfile->myIsAll && aSubProfile->myStatus != VISU::eAddAll)
362 aProfile->myIsAll = false;
364 VISU::EGeometry aEGeom = aSubProfile->myGeom;
365 aGeom2SubProfile[aEGeom] = aSubProfile;
368 aProfileMap[aProfileKey] = aProfile;
369 theValForTime.myProfile = aProfile;
374 //---------------------------------------------------------------
376 GetGaussKey(const MED::PTimeStampValueBase& theTimeStampValue,
377 const VISU::TMEDMeshOnEntity& theMeshOnEntity,
378 const MED::TGeom2Size& theGeom2Size,
379 VISU::TMEDValForTime& theValForTime)
381 VISU::TTimerLog aTimerLog(MYDEBUG,"GetGaussKey");
382 INITMSG(MYDEBUG,"GetGaussKey"<<endl);
384 VISU::TGaussKey aGaussKey;
385 VISU::PMEDProfile aProfile = theValForTime.myProfile;
386 VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
388 const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
389 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
391 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
392 MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin();
393 for(; anIter != aGeom2Size.end(); anIter++){
394 MED::EGeometrieElement aMGeom = anIter->first;
395 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
397 VISU::TGeom2SubProfile::iterator anIter2 = aGeom2SubProfile.find(aEGeom);
398 if(anIter2 == aGeom2SubProfile.end()){
399 INITMSG(MYDEBUG,"anIter2 == aGeom2SubProfile.end!!"<<endl);
402 VISU::PMEDSubProfile aSubProfile = anIter2->second;
404 MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(aMGeom);
405 if(aTimeStampIter != theGeom2Size.end()){
406 TInt aNbCells = aTimeStampIter->second;
407 if(aSubProfile->myStatus == VISU::eAddPart)
408 aNbCells = aSubProfile->myNbCells;
410 VISU::PMEDGaussSubMesh aGaussSubMesh(new VISU::TMEDGaussSubMesh());
411 aGaussSubMesh->mySubProfile = aSubProfile;
412 aGaussSubMesh->myStatus = aSubProfile->myStatus;
414 VISU::PMEDGauss aGauss(new VISU::TMEDGauss());
415 aGaussSubMesh->myGauss = aGauss;
416 aGauss->myGeom = aEGeom;
417 aGauss->myNbPoints = 1;
419 MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
420 if(aGaussIter != aGeom2Gauss.end()){
421 MED::PGaussInfo aGaussInfo = aGaussIter->second;
422 aGauss->myGaussInfo = aGaussInfo;
423 aGauss->myName = aGaussInfo->GetName();
424 aGauss->myNbPoints = aGaussInfo->GetNbGauss();
425 } else if ( aTimeStampInfo.GetNbGauss(aMGeom) > 1 )
426 EXCEPTION( std::runtime_error, "aGaussIter == aGeom2Gauss.end()"
427 " && aTimeStampInfo.GetNbGauss(aMGeom) > 1 !!!" );
429 aGaussSubMesh->myNbCells = aNbCells*aGauss->myNbPoints;
430 aGaussSubMesh->myCellsSize = aGaussSubMesh->myNbCells*2;
432 aGaussKey.insert(aGaussSubMesh);
435 "- aEGeom = "<<aGauss->myGeom<<
436 "; aName = '"<<aGauss->myName<<"'"<<
437 "; aNbGauss = "<<aGauss->myNbPoints<<
438 "; aStatus = "<<aGaussSubMesh->myStatus<<
439 "; aNbCells = "<<aGaussSubMesh->myNbCells<<
440 "; aCellsSize = "<<aGaussSubMesh->myCellsSize<<
451 //---------------------------------------------------------------
453 InitGaussMesh(MED::PTimeStampValueBase& theTimeStampValue,
454 VISU::TMEDMeshOnEntity& theMeshOnEntity,
455 const MED::TGeom2Size& theGeom2Size,
456 VISU::TMEDValForTime& theValForTime)
458 VISU::TTimerLog aTimerLog(MYDEBUG,"InitGaussMesh");
459 INITMSG(MYDEBUG,"InitGaussMesh"<<endl);
461 if(theMeshOnEntity.myEntity == VISU::NODE_ENTITY)
464 VISU::TGaussMeshMap& aGaussMeshMap = theMeshOnEntity.myGaussMeshMap;
466 VISU::TGaussKey aGaussKey = GetGaussKey(theTimeStampValue,
471 VISU::TGaussMeshMap::const_iterator anIter = aGaussMeshMap.find(aGaussKey);
472 if(anIter != aGaussMeshMap.end()){
473 theValForTime.myGaussMesh = anIter->second;
474 INITMSG(MYDEBUG,"aGaussMeshMap.find(aGaussKey)"<<endl);
476 VISU::PMEDGaussMesh aGaussMesh(new VISU::TMEDGaussMesh());
477 VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
479 VISU::TGaussKey::const_iterator anIter = aGaussKey.begin();
480 for(; anIter != aGaussKey.end(); anIter++){
481 VISU::PMEDGaussSubMesh aGaussSubMesh(*anIter);
482 VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss;
483 VISU::EGeometry aEGeom = aGauss->myGeom;
484 aGeom2GaussSubMesh[aEGeom] = aGaussSubMesh;
488 VISU::TGaussSubMeshArr& aGaussSubMeshArr = aGaussMesh->myGaussSubMeshArr;
489 aGaussSubMeshArr.resize(aGeom2GaussSubMesh.size());
490 VISU::TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
491 for(TInt anID = 0; anIter != aGeom2GaussSubMesh.end(); anIter++, anID++){
492 const VISU::PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
493 aGaussSubMeshArr[anID] = aGaussSubMesh;
496 INITMSG(MYDEBUG,"aGaussMeshMap[aGaussKey] = aGaussMesh"<<std::endl);
497 aGaussMeshMap[aGaussKey] = aGaussMesh;
498 theValForTime.myGaussMesh = aGaussMesh;
502 //---------------------------------------------------------------
504 BuildMeshOnEntityMap(VISU::PMEDMesh theMesh,
505 const MED::TEntityInfo& theEntityInfo,
506 const MED::PNodeInfo& theNodeInfo,
507 const MED::PWrapper& theMEDWrapper)
509 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMeshOnEntityMap");
510 INITMSG(MYDEBUG,"BuildMeshOnEntityMap"<<endl);
512 MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
513 const std::string& aMeshName = theMesh->myName;
514 VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
515 MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
516 for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
517 const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
518 const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
520 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
521 VISU::PMEDMeshOnEntity aMeshOnEntity =
522 aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
523 aMeshOnEntity->myEntity = aVEntity;
524 aMeshOnEntity->myMeshName = aMeshName;
525 aMeshOnEntity->myGeom2Size = aGeom2Size;
526 VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
527 VISU::TGeom2ElemID2FamilyID& aGeom2ElemID2FamilyID = aMeshOnEntity->myGeom2ElemID2FamilyID;
530 "- aMEntity = "<<aMEntity<<
531 "; aVEntity = "<<aVEntity<<
534 if(aMEntity == MED::eNOEUD){
535 aMeshOnEntity->myNbCells = theMesh->myNbPoints;
536 aMeshOnEntity->myCellsSize = 2*theMesh->myNbPoints;
538 VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[MED::ePOINT1];
540 for(TInt iElem = 0; iElem < theMesh->myNbPoints; iElem++){
541 TInt aFamId = theNodeInfo->GetFamNum(iElem);
543 aFamilyID2CellsSize[aFamId] += 2;
544 anElemID2FamilyID[iElem] = aFamId;
548 "- myNbCells = "<<aMeshOnEntity->myNbCells<<
549 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
553 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
554 aMeshOnEntity->myNbCells = 0;
555 aMeshOnEntity->myCellsSize = 0;
556 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
557 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
559 VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom];
561 case MED::ePOLYGONE: {
562 MED::PPolygoneInfo aPolygoneInfo = theMEDWrapper->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
563 TInt aNbElem = aPolygoneInfo->GetNbElem();
566 "- aMGeom = "<<aMGeom<<
567 "; aNbElem = "<<aNbElem<<
570 aMeshOnEntity->myNbCells += aNbElem;
571 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
572 TInt aNbConn = aPolygoneInfo->GetNbConn(anElemId);
573 aMeshOnEntity->myCellsSize += aNbConn;
574 TInt aFamId = aPolygoneInfo->GetFamNum(anElemId);
576 aFamilyID2CellsSize[aFamId] += aNbConn + 1;
577 anElemID2FamilyID[anElemId] = aFamId;
581 case MED::ePOLYEDRE: {
582 MED::PPolyedreInfo aPolyedreInfo = theMEDWrapper->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
583 TInt aNbElem = aPolyedreInfo->GetNbElem();
586 "- aMGeom = "<<aMGeom<<
587 "; aNbElem = "<<aNbElem<<
590 aMeshOnEntity->myNbCells += aNbElem;
591 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
592 MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(anElemId);
593 TInt aNbFaces = aConnSliceArr.size();
595 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
596 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
597 TInt aNbConn = aConnSlice.size();
598 aCellSize += aNbConn;
600 aMeshOnEntity->myCellsSize += aCellSize;
601 TInt aFamId = aPolyedreInfo->GetFamNum(anElemId);
603 aFamilyID2CellsSize[aFamId] += aCellSize + 1;
604 anElemID2FamilyID[anElemId] = aFamId;
609 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
610 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
611 MED::PCellInfo aCellInfo = theMEDWrapper->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
612 TInt aNbElem = aCellInfo->GetNbElem();
613 aMeshOnEntity->myNbCells += aNbElem;
614 aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
617 "- aMGeom = "<<aMGeom<<
618 "; aNbElem = "<<aNbElem<<
619 "; myNbCells = "<<aMeshOnEntity->myNbCells<<
620 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
623 for(TInt iElem = 0; iElem < aNbElem; iElem++){
624 TInt aFamId = aCellInfo->GetFamNum(iElem);
626 aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
627 anElemID2FamilyID[iElem] = aFamId;
629 }} // end switch(...)
635 //---------------------------------------------------------------
637 BuildMeshGrilleOnEntityMap(VISU::PMEDMesh theMesh,
638 const MED::TEntityInfo& theEntityInfo,
639 const MED::PGrilleInfo& theGrilleInfo,
640 const MED::PWrapper& theMEDWrapper)
642 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMeshGrilleOnEntityMap");
643 INITMSG(MYDEBUG,"BuildMeshGrilleOnEntityMap"<<endl);
645 MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
646 const std::string& aMeshName = theMesh->myName;
647 VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
648 MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
650 VISU::TStructuredId& aGrilleStructure = theMesh->myGrilleStructure;
651 if ( theGrilleInfo->GetGrilleType() != MED::eGRILLE_STANDARD )
652 for ( int aDimId = 0; aDimId < theMesh->myDim; aDimId++ )
653 aGrilleStructure[aDimId] = theGrilleInfo->GetNbIndexes(aDimId);
655 MED::TIntVector aVector = theGrilleInfo->GetGrilleStructure();
656 for ( int aDimId = 0; aDimId < aVector.size(); aDimId++ )
657 aGrilleStructure[aDimId] = aVector[aDimId];
660 int kMax = aGrilleStructure[2];
661 int jMax = aGrilleStructure[1];
662 int iMax = aGrilleStructure[0];
665 VISU::TObj2StructuredId& aObj2StructuredId = theMesh->myObj2StructuredId;
666 switch ( theMesh->myDim ) {
668 for ( int i = 1; i <= iMax; i++ )
669 aObj2StructuredId[i-1][0] = i;
672 for ( int j = 1; j <= jMax; j++ )
673 for ( int i = 1; i <= iMax; i++ ) {
674 aObj2StructuredId[iii][0] = i;
675 aObj2StructuredId[iii][1] = j;
680 for ( int k = 1; k <= kMax; k++ )
681 for ( int j = 1; j <= jMax; j++ )
682 for ( int i = 1; i <= iMax; i++ ) {
683 aObj2StructuredId[iii][0] = i;
684 aObj2StructuredId[iii][1] = j;
685 aObj2StructuredId[iii][2] = k;
690 for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
691 const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
692 const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
694 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
695 VISU::PMEDMeshOnEntity aMeshOnEntity =
696 aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
697 aMeshOnEntity->myEntity = aVEntity;
698 aMeshOnEntity->myMeshName = aMeshName;
699 aMeshOnEntity->myGeom2Size = aGeom2Size;
700 VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
701 VISU::TGeom2ElemID2FamilyID& aGeom2ElemID2FamilyID = aMeshOnEntity->myGeom2ElemID2FamilyID;
704 "- aMEntity = "<<aMEntity<<
705 "; aVEntity = "<<aVEntity<<
708 if(aMEntity == MED::eNOEUD){
709 aMeshOnEntity->myNbCells = theGrilleInfo->GetNbNodes();
710 aMeshOnEntity->myCellsSize = 2*theGrilleInfo->GetNbNodes();
712 VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[MED::ePOINT1];
714 if((theGrilleInfo->myFamNumNode).size() > 0)
715 for(TInt iElem = 0; iElem < theGrilleInfo->GetNbNodes(); iElem++){
716 TInt aFamId = theGrilleInfo->GetFamNumNode(iElem);
718 aFamilyID2CellsSize[aFamId] += 2;
719 anElemID2FamilyID[iElem] = aFamId;
723 "- myNbCells = "<<aMeshOnEntity->myNbCells<<
724 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
728 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
729 aMeshOnEntity->myNbCells = 0;
730 aMeshOnEntity->myCellsSize = 0;
731 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
732 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
733 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
734 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
735 TInt aNbElem = aGeom2SizeIter->second;//theGrilleInfo->GetNbCells();
736 aMeshOnEntity->myNbCells += aNbElem;
737 aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
739 VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom];
742 "- aMGeom = "<<aMGeom<<
743 "; aNbElem = "<<aNbElem<<
744 "; myNbCells = "<<aMeshOnEntity->myNbCells<<
745 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
748 MED::TElemNum& famNums =
749 (aMEntity == MED::eMAILLE) ? theGrilleInfo->myFamNum : theGrilleInfo->myFamSubNum;
750 if (famNums.size() == aNbElem)
751 for(TInt iElem = 0; iElem < aNbElem; iElem++){
752 TInt aFamId = famNums[iElem];
754 aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
755 anElemID2FamilyID[iElem] = aFamId;
763 //---------------------------------------------------------------
765 BuildFieldMap(VISU::PMEDMesh theMesh,
766 const MED::TEntityInfo& theEntityInfo,
767 MED::PWrapper theMEDWrapper)
769 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFieldMap");
770 TInt aNbFields = theMEDWrapper->GetNbFields();
771 MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
772 const std::string& aMeshName = theMesh->myName;
773 INITMSG(MYDEBUG,"BuildFieldMap: aNbFields = "<<aNbFields<<"\n");
774 for(TInt iField = 1; iField <= aNbFields; iField++){
775 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPFieldInfo");
777 MED::TErr anError = 0;
778 MED::PFieldInfo aFieldInfo = theMEDWrapper->GetPFieldInfo(aMeshInfo, iField, &anError);
782 TInt aNbComp = aFieldInfo->GetNbComp();
783 std::string aFieldName = aFieldInfo->GetName();
785 MED::TGeom2Size aGeom2Size;
786 MED::EEntiteMaillage aMEntity;
787 TInt aNbTimeStamps = theMEDWrapper->GetNbTimeStamps(aFieldInfo,
791 if(aNbTimeStamps < 1)
794 VISU::TEntity aVEntity = MEDEntityToVTK( aMEntity );
795 vtkIdType aDataType = VTK_DOUBLE;
796 if ( aFieldInfo->GetType() != MED::eFLOAT64 ) {
797 #if defined(HAVE_F77INT64)
798 aDataType = VTK_LONG;
803 VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
804 VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
805 VISU::PMEDField aField = aFieldMap[aFieldName](new VISU::TMEDField());
806 aField->myId = iField;
807 aField->Init(aNbComp, aDataType);
808 aField->myEntity = aVEntity;
809 aField->myName = aFieldName;
810 aField->myMeshName = aMeshName;
811 aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
812 aField->myIsELNO = ( aMEntity == MED::eNOEUD_ELEMENT );
814 INITMSG(MYDEBUG,"myName = '"<<aField->myName<<"'"<<
815 "; myId = "<<aField->myId<<
816 "; myEntity = "<<aField->myEntity<<
817 "; myDataSize = "<<aField->myDataSize<<
818 "; myNbComp = "<<aField->myNbComp<<"\n");
820 for(TInt iComp = 0; iComp < aNbComp; iComp++){
821 aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
822 aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
825 for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
826 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPTimeStampInfo");
828 MED::TErr anError = 0;
829 MED::PTimeStampInfo aTimeStampInfo = theMEDWrapper->GetPTimeStampInfo(aFieldInfo,
837 TFloat aDt = aTimeStampInfo->GetDt();
838 std::string anUnitDt = aTimeStampInfo->GetUnitDt();
840 VISU::TValField& aValField = aField->myValField;
841 VISU::PMEDValForTime aValForTime = aValField[iTimeStamp](new VISU::TMEDValForTime());
842 aValForTime->myId = iTimeStamp;
843 aValForTime->myFieldName = aField->myName;
844 aValForTime->myEntity = aField->myEntity;
845 aValForTime->myMeshName = aField->myMeshName;
846 aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
847 INITMSG(MYDEBUG,"aDt = '"<<aDt<<", "<<anUnitDt<<"'\n");
849 VISU::TGeom2NbGauss& aVGeom2NbGauss = aValForTime->myGeom2NbGauss;
850 const MED::TGeom2NbGauss& aMGeom2NbGauss = aTimeStampInfo->myGeom2NbGauss;
851 MED::TGeom2NbGauss::const_iterator anIter = aMGeom2NbGauss.begin();
852 for(; anIter != aMGeom2NbGauss.end(); anIter++){
853 const MED::EGeometrieElement& aMGeom = anIter->first;
854 VISU::EGeometry aEGeom = MEDGeom2VISU( aMGeom );
855 TInt aNbGauss = anIter->second;
856 aVGeom2NbGauss[ aEGeom ] = aNbGauss;
858 // ELNO data should satisfy the following condition ( implicitly )
859 vtkIdType aNbNodes = MEDGeom2NbNodes( aMGeom );
860 aField->myIsELNO &= ( aNbGauss == aNbNodes );
867 //---------------------------------------------------------------
869 BuildFamilyMap(VISU::PMEDMesh theMesh,
870 const MED::TEntityInfo& theEntityInfo,
871 const MED::TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo,
872 const MED::TFamilyInfoSet& theFamilyInfoSet,
873 MED::PWrapper theMEDWrapper)
875 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFamilyMap");
876 INITMSG(MYDEBUG,"BuildFamilyMap\n");
878 MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
879 MED::TEntity2FamilySet aEntity2FamilySet = MED::GetEntity2FamilySet(theMEDWrapper,theEntity2TGeom2ElemInfo,theFamilyInfoSet);
880 MED::TEntity2FamilySet::const_iterator aEntity2FamilySetIter = aEntity2FamilySet.begin();
881 for(; aEntity2FamilySetIter != aEntity2FamilySet.end(); aEntity2FamilySetIter++){
882 const MED::EEntiteMaillage& aMEntity = aEntity2FamilySetIter->first;
883 const MED::TFamilyTSizeSet& aFamilyTSizeSet = aEntity2FamilySetIter->second;
885 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
886 VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
887 const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
888 VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
889 VISU::TFamilyIDMap& aFamilyIDMap = aMeshOnEntity->myFamilyIDMap;
891 if(aFamilyTSizeSet.empty())
894 INITMSG(MY_FAMILY_DEBUG,
895 "- aMEntity = "<<aMEntity<<
896 "; aVEntity = "<<aVEntity<<
899 MED::TFamilyTSizeSet::const_iterator aFamilyTSizeSetIter = aFamilyTSizeSet.begin();
900 for(; aFamilyTSizeSetIter != aFamilyTSizeSet.end(); aFamilyTSizeSetIter++){
901 const MED::TFamilyTSize& aFamilyTSize = *aFamilyTSizeSetIter;
902 const MED::PFamilyInfo& aFamilyInfo = boost::get<0>(aFamilyTSize);
903 TInt aSize = boost::get<1>(aFamilyTSize);
904 TInt anId = aFamilyInfo->GetId();
908 std::string aFamilyName = aFamilyInfo->GetName();
910 VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily());
911 aFamily->myId = anId;
912 aFamily->myEntity = aVEntity;
913 aFamily->myName = aFamilyName;
914 aFamily->myNbCells = aSize;
916 aFamily->myCellsSize = 0;
917 VISU::TFamilyID2CellsSize::const_iterator anIter = aFamilyID2CellsSize.find(anId);
918 if(anIter != aFamilyID2CellsSize.end())
919 aFamily->myCellsSize = anIter->second;
921 const TInt aNbGroup = aFamilyInfo->GetNbGroup();
922 VISU::TNames& aGroupNames = aFamily->myGroupNames;
923 aGroupNames.resize(aNbGroup);
924 for(TInt i = 0; i < aNbGroup; i++){
925 std::string aGroupName = aFamilyInfo->GetGroupName(i);
926 aGroupNames[i] = aGroupName;
929 aFamilyIDMap[anId] = aFamily;
931 INITMSG(MY_FAMILY_DEBUG,
932 "- aFamilyName = '"<<aFamilyName<<"'"<<
933 "; myId = "<<aFamily->myId<<"; "<<
934 "; aNbAttr = "<<aFamilyInfo->GetNbAttr()<<
935 "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
936 "; aVEntity = "<<aVEntity<<
937 "; myNbCells = "<<aFamily->myNbCells<<
938 "; myCellsSize = "<<aFamily->myCellsSize<<
941 for(TInt i = 0; i < aNbGroup; i++){
942 std::string aGroupName = aFamilyInfo->GetGroupName(i);
943 INITMSG(MY_FAMILY_DEBUG,"- aGroupName = '"<<aGroupName<<"'\n");
953 * Build grille family map
956 BuildGrilleFamilyMap(VISU::PMEDMesh theMesh,
957 const MED::TEntityInfo& theEntityInfo,
958 const MED::TFamilyInfoSet& theFamilyInfoSet,
959 MED::PWrapper theMEDWrapper)
961 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGrilleFamilyMap");
962 INITMSG(MYDEBUG,"BuildGrilleFamilyMap\n");
964 VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
966 MED::TEntityInfo::const_iterator aEntityIter = theEntityInfo.begin();
968 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
969 MED::PGrilleInfo aGrilleInfo = theMEDWrapper->GetPGrilleInfo(aMeshInfo);
971 const MED::TFamilyID2NbCells& aFam2NbCells = MED::GetFamilyID2NbCells(aGrilleInfo);
973 MED::TFamilyInfoSet::const_iterator aFamInter = theFamilyInfoSet.begin();
974 for(; aFamInter != theFamilyInfoSet.end(); aFamInter++){
975 const MED::PFamilyInfo& aFamilyInfo = *aFamInter;
976 TInt anId = aFamilyInfo->GetId();
981 std::string aFamilyName = aFamilyInfo->GetName();
982 const MED::EEntiteMaillage& aMEntity = MED::GetEntityByFamilyId(aGrilleInfo,
984 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
986 VISU::PMEDMeshOnEntity aMeshOnEntity;
987 VISU::TMeshOnEntityMap::iterator aMeshOnEntityIter = aMeshOnEntityMap.find(aVEntity);
988 if(aMeshOnEntityIter != aMeshOnEntityMap.end())
989 aMeshOnEntity = aMeshOnEntityIter->second;
991 VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
992 VISU::TFamilyIDMap& aFamilyIDMap = aMeshOnEntity->myFamilyIDMap;
994 VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily());
995 aFamily->myId = anId;
996 aFamily->myEntity = aVEntity;
997 aFamily->myName = aFamilyName;
998 aFamily->myNbCells = 0;
999 aFamily->myCellsSize = 0;
1001 const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
1002 VISU::TFamilyID2CellsSize::const_iterator aFamilyid2CellsSizeIter = aFamilyID2CellsSize.find(anId);
1003 if(aFamilyid2CellsSizeIter != (aMeshOnEntity->myFamilyID2CellsSize).end())
1004 aFamily->myCellsSize = aFamilyid2CellsSizeIter->second;
1005 MED::TFamilyID2NbCells::const_iterator aFam2NbCellsIter = aFam2NbCells.find(anId);
1006 if(aFam2NbCellsIter != aFam2NbCells.end())
1007 aFamily->myNbCells = aFam2NbCellsIter->second;
1009 const TInt aNbGroup = aFamilyInfo->GetNbGroup();
1010 VISU::TNames& aGroupNames = aFamily->myGroupNames;
1011 aGroupNames.resize(aNbGroup);
1012 for(TInt i = 0; i < aNbGroup; i++){
1013 std::string aGroupName = aFamilyInfo->GetGroupName(i);
1014 aGroupNames[i] = aGroupName;
1017 aFamilyIDMap[anId] = aFamily;
1019 INITMSG(MY_FAMILY_DEBUG,
1020 "- aFamilyName =|"<<aFamily->myName<<"|"
1021 << "; myId = "<<aFamily->myId
1022 << "; aNbAttr = "<<aFamilyInfo->GetNbAttr()
1023 << "; aNbGroup = "<<aFamilyInfo->GetNbGroup()
1024 << "; aVEntity = "<<aVEntity
1025 << "; myNbCells = "<<aFamily->myNbCells
1026 << "; myCellsSize = "<<aFamily->myCellsSize
1033 //---------------------------------------------------------------
1035 BuildGroupMap(VISU::PMEDMesh theMesh,
1036 const MED::TFamilyInfoSet& theFamilyInfoSet)
1038 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGroupMap");
1039 INITMSG(MYDEBUG,"BuildGroupMap\n");
1041 VISU::TGroupMap& aGroupMap = theMesh->myGroupMap;
1042 MED::TGroupInfo aGroupInfo = MED::GetGroupInfo(theFamilyInfoSet);
1043 MED::TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
1044 for(; aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
1045 const std::string& aGroupName = aGroupInfoIter->first;
1046 INITMSG(MY_GROUP_DEBUG,"aGroupName = '"<<aGroupName<<"'\n");
1048 VISU::PMEDGroup aGroup(new VISU::TMEDGroup());
1049 VISU::TFamilySet& aFamilySet = aGroup->myFamilySet;
1051 const MED::TFamilyInfoSet& aFamilyInfoSet = aGroupInfoIter->second;
1052 MED::TFamilyInfoSet::const_iterator aFamilyIter = aFamilyInfoSet.begin();
1053 for(; aFamilyIter != aFamilyInfoSet.end(); aFamilyIter++){
1054 const MED::PFamilyInfo& aFamilyInfo = *aFamilyIter;
1055 std::string aFamilyName = aFamilyInfo->GetName();
1057 VISU::TEntity aVEntity = VISU::TEntity(-1);
1058 VISU::PMEDFamily aFamily;
1061 const VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
1062 VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
1063 for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
1064 const VISU::PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
1065 const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
1066 VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
1067 for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
1068 const std::string& aName = aFamilyMapIter->first;
1069 if(aName == aFamilyName){
1070 aFamily = aFamilyMapIter->second;
1071 aVEntity = aFamily->myEntity;
1072 if(aFamily && aVEntity >= 0){
1073 aFamilySet.insert(VISU::TEnity2Family(aVEntity, aFamily));
1074 INITMSG(MY_GROUP_DEBUG,
1075 "- aFamilyName = '"<<aFamilyName<<"'"<<
1076 "; aVEntity = "<<aVEntity<<
1083 if(!aFamilySet.empty())
1084 aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
1089 //---------------------------------------------------------------
1093 TSetIsDone(bool& theIsDone):
1105 //---------------------------------------------------------------
1110 //---------------------------------------------------------------
1112 TMEDNamedPointCoords
1113 ::Init(const MED::PNodeInfo& theNodeInfo,
1114 MED::EVersion theVersion)
1116 TMEDCoordHolder* aCoordHolder = new TMEDCoordHolder();
1117 TInt aNbElem = theNodeInfo->GetNbElem();
1118 TInt aDim = theNodeInfo->GetMeshInfo()->GetDim();
1119 aCoordHolder->Init(aNbElem, aDim, theNodeInfo->myCoord);
1120 TNamedPointCoords::Init(PCoordHolder(aCoordHolder));
1121 myVersion = theVersion;
1123 for(TInt iDim = 0; iDim < aDim; iDim++)
1124 myPointsDim[iDim] = theNodeInfo->GetCoordName(iDim);
1126 myIsElemNum = theNodeInfo->IsElemNum();
1127 if(theNodeInfo->IsElemNum())
1128 myElemNum = theNodeInfo->myElemNum;
1130 myIsElemNames = theNodeInfo->IsElemNames();
1131 if(theNodeInfo->IsElemNames())
1132 myElemNames = theNodeInfo->myElemNames;
1136 TMEDNamedPointCoords
1137 ::Init(const MED::PGrilleInfo& theGrilleInfo)
1139 TMEDCoordHolder* aCoordHolder = new TMEDCoordHolder();
1140 TInt aNbElem = theGrilleInfo->GetNbNodes();
1141 TInt aDim = theGrilleInfo->GetMeshInfo()->GetDim();
1142 MED::PNodeCoord aCoord(new MED::TNodeCoord(aNbElem * aDim));
1143 aCoordHolder->Init(aNbElem, aDim, aCoord);
1144 TNamedPointCoords::Init(PCoordHolder(aCoordHolder));
1146 for(TInt iDim = 0; iDim < aDim; iDim++)
1147 myPointsDim[iDim] = theGrilleInfo->GetCoordName(iDim);
1149 for(TInt iElem = 0; iElem < aNbElem; iElem++){
1150 VISU::TCoordSlice aVCoordSlice = GetCoordSlice(iElem);
1151 MED::TNodeCoord aMCoord = theGrilleInfo->GetCoord(iElem);
1152 for(TInt iDim = 0; iDim < aDim; iDim++){
1153 aVCoordSlice[iDim] = aMCoord[iDim];
1159 TMEDNamedPointCoords
1160 ::GetObjID(vtkIdType theID) const
1163 return (*myElemNum)[theID];
1164 return TNamedPointCoords::GetObjID(theID);
1169 TMEDNamedPointCoords
1170 ::GetVTKID(vtkIdType theID) const
1173 // To prepare corresponding mapper engine
1174 if(myObj2VTKID.empty()){
1175 vtkIdType anEnd = myElemNum->size();
1176 for(vtkIdType anID = 0; anID < anEnd; anID++)
1177 myObj2VTKID[(*myElemNum)[anID]] = anID;
1179 TObj2VTKID::const_iterator anIter = myObj2VTKID.find(theID);
1180 if(anIter != myObj2VTKID.end())
1181 return anIter->second;
1184 return TNamedPointCoords::GetVTKID(theID);
1188 GetPNOMLength(MED::EVersion theVersion)
1190 if(theVersion == MED::eV2_1)
1191 return MED::GetPNOMLength<MED::eV2_1>();
1192 return MED::GetPNOMLength<MED::eV2_2>();
1196 TMEDNamedPointCoords
1197 ::GetNodeName(vtkIdType theObjID) const
1200 return GetString(theObjID, GetPNOMLength(myVersion), *myElemNames);
1201 return TNamedPointCoords::GetNodeName(theObjID);
1205 TMEDNamedPointCoords
1208 size_t aSize = TNamedPointCoords::GetMemorySize();
1211 aSize += myObj2VTKID.size() * sizeof(vtkIdType) * 2;
1212 aSize += myElemNum->size() * sizeof(MED::TInt);
1216 aSize += myElemNames->size() * sizeof(char);
1221 //---------------------------------------------------------------
1224 ::GetElemObjID(vtkIdType theID) const
1226 if ( !mySubMeshID.empty() )
1227 theID = mySubMeshID[theID];
1230 return (*myElemNum)[theID];
1236 //---------------------------------------------------------------
1239 ::GetElemVTKID(vtkIdType theID) const
1242 for ( size_t anId = 0; anId < (*myElemNum).size(); anId++ )
1243 if ( (*myElemNum)[ anId ] == theID ) {
1248 return TSubProfileImpl::GetElemVTKID( theID );
1252 //----------------------------------------------------------------
1257 size_t aSize = TSubProfileImpl::GetMemorySize();
1259 aSize += myElemNum->size() * sizeof(MED::TInt);
1264 //---------------------------------------------------------------
1267 ::LessThan(const PGaussImpl& theGauss,
1268 bool& theResult) const
1270 TGaussImpl::LessThan(theGauss,theResult);
1272 if(PMEDGauss aGauss = theGauss){
1273 const MED::TGaussInfo& aLeft = myGaussInfo;
1274 const MED::TGaussInfo& aReight = aGauss->myGaussInfo;
1275 theResult = MED::TGaussInfo::TLess()(aLeft,aReight);
1281 //---------------------------------------------------------------
1284 ::GetObjID(vtkIdType theID) const
1286 vtkIdType aNbPoints = myGauss->myNbPoints;
1287 TCellID aCellID = theID / aNbPoints;
1288 TLocalPntID aLocalPntID = theID % aNbPoints;
1291 aCellID = GetElemObjID(aCellID);
1293 aCellID += myStartID;
1295 return TGaussPointID(aCellID, aLocalPntID);
1299 //---------------------------------------------------------------
1302 ::GetVTKID( const TGaussPointID& theID ) const
1304 vtkIdType aResult = -1;
1306 TCellID aCellID = theID.first;
1307 TLocalPntID aLocalPntID = theID.second;
1309 vtkIdType aNbPoints = myGauss->myNbPoints;
1310 if ( aLocalPntID >= aNbPoints )
1313 if ( myIsElemNum ) {
1314 aCellID = GetElemVTKID( aCellID );
1316 aCellID -= myStartID;
1318 return aCellID * aNbPoints + aLocalPntID + myStartID;
1322 //---------------------------------------------------------------
1327 size_t aSize = TGaussSubMeshImpl::GetMemorySize();
1329 aSize += myElemNum->size() * sizeof(MED::TInt);
1334 //---------------------------------------------------------------
1337 ::Init(const MED::PElemInfo& theElemInfo,
1338 MED::EVersion theVersion)
1340 myVersion = theVersion;
1341 myIsElemNum = theElemInfo->IsElemNum();
1343 myElemNum = theElemInfo->myElemNum;
1345 myIsElemNames = theElemInfo->IsElemNames();
1346 if(theElemInfo->IsElemNames())
1347 myElemNames = theElemInfo->myElemNames;
1353 ::Init(const MED::PGrilleInfo& theGrilleInfo)
1358 ::GetElemObjID(vtkIdType theID) const
1361 return (*myElemNum)[theID];
1363 return TSubMeshImpl::GetElemObjID(theID);
1368 ::GetElemName(vtkIdType theObjID) const
1371 return GetString(theObjID, GetPNOMLength(myVersion), *myElemNames);
1372 return TSubMeshImpl::GetElemName(theObjID);
1379 size_t aSize = TSubMeshImpl::GetMemorySize();
1382 aSize += myElemNum->size() * sizeof(MED::TInt);
1385 aSize += myElemNames->size() * sizeof(char);
1391 //---------------------------------------------------------------
1395 //---------------------------------------------------------------
1398 CreateConvertor(const std::string& theFileName)
1400 if(MED::PWrapper aMed = MED::CrWrapper(theFileName,true))
1401 return new VISU_MedConvertor(theFileName, aMed);
1406 ::VISU_MedConvertor(const std::string& theFileName, MED::PWrapper theMed):
1407 myIsEntitiesDone(false),
1408 myIsFieldsDone(false),
1409 myIsGroupsDone(false),
1410 myIsMinMaxDone(false),
1413 myName = theFileName;
1417 //---------------------------------------------------------------
1422 if(myIsEntitiesDone)
1425 TSetIsDone aSetIsDone(myIsEntitiesDone);
1426 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildEntities");
1428 TInt aNbMeshes = myMed->GetNbMeshes();
1429 VISU::TMeshMap& aMeshMap = myMeshMap;
1431 INITMSG(MYDEBUG,"BuildEntities aNbMeshes = "<<aNbMeshes<<"\n");
1433 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
1437 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
1439 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
1440 std::string aMeshName = aMeshInfo->GetName();
1441 TInt aDim = aMeshInfo->GetDim();
1442 MED::EMaillage aType = aMeshInfo->GetType();
1444 // creating TMesh structure and TMeshOnEntityMap
1445 VISU::PMEDMesh aMesh = aMeshMap[aMeshName](new VISU::TMEDMesh());
1447 aMesh->myDim = aDim;
1448 aMesh->myName = aMeshName;
1449 aMesh->myMeshInfo = aMeshInfo;
1450 aMesh->myNamedPointCoords(new VISU::TMEDNamedPointCoords());
1452 INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
1453 "; aDim = "<<aDim<<"\n");
1455 if(aType == MED::eNON_STRUCTURE){
1457 if(MED::PNodeInfo aNodeInfo = myMed->GetPNodeInfo(aMeshInfo)){
1458 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
1460 aMesh->myNbPoints = aNodeInfo->GetNbElem();
1461 aMesh->myEntityInfo = anEntityInfo;
1467 INITMSG(MYDEBUG,"myNbPoints = "<<aMesh->myNbPoints<<
1468 "; anEntityInfo.size() = "<<anEntityInfo.size()<<
1471 BuildMeshOnEntityMap(aMesh,
1477 }catch(std::exception& exc){
1478 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1480 MSG(MYDEBUG,"Unknown exception !!!");
1484 } // NON STRUCTURED MESH
1486 MED::PGrilleInfo aGrilleInfo = myMed->GetPGrilleInfo(aMeshInfo);
1488 MED::TEntityInfo anEntityInfo;
1489 anEntityInfo[MED::eNOEUD][MED::ePOINT1] = aGrilleInfo->GetNbNodes();
1490 anEntityInfo[aGrilleInfo->GetEntity()][aGrilleInfo->GetGeom()] = aGrilleInfo->GetNbCells();
1491 anEntityInfo[aGrilleInfo->GetSubEntity()][aGrilleInfo->GetSubGeom()] = aGrilleInfo->GetNbSubCells();
1493 aMesh->myNbPoints = aGrilleInfo->GetNbNodes();
1494 aMesh->myEntityInfo = anEntityInfo;
1496 aMesh->myIsPolarType = (MED::eGRILLE_POLAIRE == aGrilleInfo->GetGrilleType());
1497 aMesh->myIsStructured = true;
1501 BEGMSG(MYDEBUG,"anEntityInfo.size() = "<<anEntityInfo.size()<<"\n");
1503 BuildMeshGrilleOnEntityMap(aMesh,
1509 }catch(std::exception& exc){
1510 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1512 MSG(MYDEBUG,"Unknown exception !!!");
1519 }catch(std::exception& exc){
1520 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1522 MSG(MYDEBUG,"Unknown exception !!!");
1531 //---------------------------------------------------------------
1539 VISU_Convertor_impl::BuildFields();
1541 TSetIsDone aSetIsDone(myIsFieldsDone);
1542 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFields");
1544 TInt aNbMeshes = myMed->GetNbMeshes();
1545 VISU::TMeshMap& aMeshMap = myMeshMap;
1547 INITMSG(MYDEBUG,"BuildFields - aNbMeshes = "<<aNbMeshes<<"\n");
1549 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
1553 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
1555 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
1556 std::string aMeshName = aMeshInfo->GetName();
1558 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
1559 if(anIter == aMeshMap.end())
1561 VISU::PMEDMesh aMesh = anIter->second;
1563 INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
1567 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
1569 BuildFieldMap(aMesh,
1573 }catch(std::exception& exc){
1574 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1576 MSG(MYDEBUG,"Unknown exception !!!");
1581 }catch(std::exception& exc){
1582 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1584 MSG(MYDEBUG,"Unknown exception !!!");
1593 //---------------------------------------------------------------
1594 template<class TimeStampValueType>
1596 BuildTimeStampMinMax(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
1597 const VISU::PMEDMeshOnEntity theMeshOnEntity,
1598 const MED::TGeom2Gauss& theGeom2Gauss,
1599 VISU::TMetric2Comp2MinMax& theMetric2Comp2MinMax,
1600 VISU::TMetric2Comp2MinMax& theMetric2Comp2AverageMinMax,
1601 VISU::TMetric2Comp2Group2MinMax& theMetric2Comp2Group2MinMax,
1602 VISU::TMetric2Comp2Group2MinMax& theMetric2Comp2Group2AverageMinMax,
1606 const VISU::TFamilyIDMap& aFamilyIDMap = theMeshOnEntity->myFamilyIDMap;
1607 VISU::TGeom2ElemID2FamilyID aGeom2ElemID2FamilyID = theMeshOnEntity->myGeom2ElemID2FamilyID;
1609 VISU::TVector<double> aBaseAverageValues;
1610 aBaseAverageValues.resize(3);
1611 aBaseAverageValues[VISU::AVERAGE_METRIC] = 0.0;
1612 aBaseAverageValues[VISU::MINIMUM_METRIC] = VTK_LARGE_FLOAT;
1613 aBaseAverageValues[VISU::MAXIMUM_METRIC] = -VTK_LARGE_FLOAT;
1615 const typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValue->myGeom2Value;
1616 typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
1617 for(; anIter != aGeom2Value.end(); anIter++){
1618 const typename TimeStampValueType::TTMeshValue& aMMeshValue = anIter->second;
1619 MED::EGeometrieElement aMGeom = anIter->first;
1621 TInt aNbElem = aMMeshValue.myNbElem;
1622 TInt aNbGauss = aMMeshValue.myNbGauss;
1624 MED::TGeom2Gauss::const_iterator aGaussIter = theGeom2Gauss.find(aMGeom);
1625 if(aGaussIter == theGeom2Gauss.end())
1629 "- aMGeom = "<<aMGeom<<
1630 "; aNbElem = "<<aNbElem<<
1631 "; aNbGauss = "<<aNbGauss<<
1634 VISU::TElemID2FamilyID anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom];
1636 bool isAverageByGaussPoints = (aNbGauss > 1);
1637 // To calculate min/max per components
1638 for(TInt iElem = 0; iElem < aNbElem; iElem++){
1639 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
1641 for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
1642 VISU::TComp2MinMax& aComp2MinMax = theMetric2Comp2MinMax[aGaussMetric];
1643 VISU::TComp2MinMax& aComp2AverageMinMax = theMetric2Comp2AverageMinMax[aGaussMetric];
1644 VISU::TComp2Group2MinMax& aComp2Group2MinMax = theMetric2Comp2Group2MinMax[aGaussMetric];
1645 VISU::TComp2Group2MinMax& aComp2Group2AverageMinMax = theMetric2Comp2Group2AverageMinMax[aGaussMetric];
1647 for(TInt iComp = 0; iComp < theNbComp; iComp++){
1648 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
1650 VISU::TMinMax& aMinMax = aComp2MinMax[iComp+1];
1651 vtkFloatingPointType& aMin = aMinMax.first;
1652 vtkFloatingPointType& aMax = aMinMax.second;
1653 VISU::TMinMax& anAverageMinMax = aComp2AverageMinMax[iComp+1];
1654 vtkFloatingPointType& anAverageMin = anAverageMinMax.first;
1655 vtkFloatingPointType& anAverageMax = anAverageMinMax.second;
1656 vtkFloatingPointType anAverageValue = aBaseAverageValues[aGaussMetric];
1658 VISU::TGroup2MinMax& aGroup2MinMax = aComp2Group2MinMax[iComp+1];
1659 VISU::TGroup2MinMax& aGroup2AverageMinMax = aComp2Group2AverageMinMax[iComp+1];
1660 std::map<VISU::TName,vtkFloatingPointType> aGroup2AverageValue;
1662 // get names of groups, to which the element belongs
1663 VISU::TNames aGroupNames;
1664 VISU::TElemID2FamilyID::const_iterator anIter = anElemID2FamilyID.find(iElem);
1665 if(anIter != anElemID2FamilyID.end()){
1666 int aFamilyId = anIter->second;
1668 VISU::TFamilyIDMap::const_iterator aFamilyIter = aFamilyIDMap.find(aFamilyId);
1669 if(aFamilyIter != aFamilyIDMap.end()){
1670 VISU::PMEDFamily aFamily = aFamilyIter->second;
1671 aGroupNames = aFamily->myGroupNames;
1672 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1673 for(; aGroupIter != aGroupNames.end(); aGroupIter++)
1674 aGroup2AverageValue[*aGroupIter] = aBaseAverageValues[aGaussMetric];
1679 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1680 const vtkFloatingPointType& aVal = aMValueSlice[iGauss];
1681 aMin = isnan(aVal) ? aVal : std::min(aMin,aVal);
1682 aMax = isnan(aVal) ? aVal : std::max(aMax,aVal);
1683 if(isAverageByGaussPoints){
1684 switch(aGaussMetric) {
1685 case VISU::AVERAGE_METRIC: anAverageValue += aVal; break;
1686 case VISU::MINIMUM_METRIC: anAverageValue = std::min(anAverageValue, aVal); break;
1687 case VISU::MAXIMUM_METRIC: anAverageValue = std::max(anAverageValue, aVal); break;
1691 anAverageMin = aMin;
1692 anAverageMax = aMax;
1695 // additional calculation for each group, to which the element belongs
1696 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1697 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1698 VISU::TName aGroupName = *aGroupIter;
1699 bool isGroupFound = aGroup2MinMax.find(aGroupName) != aGroup2MinMax.end();
1700 VISU::TMinMax& aGroupMinMax = aGroup2MinMax[aGroupName];
1701 vtkFloatingPointType& aGroupMin = aGroupMinMax.first;
1702 vtkFloatingPointType& aGroupMax = aGroupMinMax.second;
1703 aGroupMin = isGroupFound ? std::min(aGroupMin,aVal) : aVal;
1704 aGroupMax = isGroupFound ? std::max(aGroupMax,aVal) : aVal;
1706 if(isAverageByGaussPoints){
1707 switch(aGaussMetric) {
1708 case VISU::AVERAGE_METRIC: aGroup2AverageValue[aGroupName] = aGroup2AverageValue[aGroupName] + aVal; break;
1709 case VISU::MINIMUM_METRIC: aGroup2AverageValue[aGroupName] = std::min(aGroup2AverageValue[aGroupName], aVal); break;
1710 case VISU::MAXIMUM_METRIC: aGroup2AverageValue[aGroupName] = std::max(aGroup2AverageValue[aGroupName], aVal); break;
1714 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1715 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1716 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1717 aGroupAverageMin = aGroupMin;
1718 aGroupAverageMax = aGroupMax;
1722 if(isAverageByGaussPoints){
1723 if(aGaussMetric == VISU::AVERAGE_METRIC)
1724 anAverageValue /= aNbGauss;
1725 anAverageMin = std::min(anAverageMin,anAverageValue);
1726 anAverageMax = std::max(anAverageMax,anAverageValue);
1728 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1729 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1730 VISU::TName aGroupName = *aGroupIter;
1731 vtkFloatingPointType aGroupAverageValue = aGroup2AverageValue[aGroupName];
1732 if(aGaussMetric == VISU::AVERAGE_METRIC)
1733 aGroupAverageValue /= aNbGauss;
1734 bool isGroupFound = aGroup2AverageMinMax.find(aGroupName) != aGroup2AverageMinMax.end();
1735 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1736 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1737 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1738 aGroupAverageMin = isGroupFound ? std::min(aGroupAverageMin,aGroupAverageValue) : aGroupAverageValue;
1739 aGroupAverageMax = isGroupFound ? std::max(aGroupAverageMax,aGroupAverageValue) : aGroupAverageValue;
1746 // To calculate min/max per vector modulus
1747 for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
1748 VISU::TComp2MinMax& aComp2MinMax = theMetric2Comp2MinMax[aGaussMetric];
1749 VISU::TComp2MinMax& aComp2AverageMinMax = theMetric2Comp2AverageMinMax[aGaussMetric];
1750 VISU::TComp2Group2MinMax& aComp2Group2MinMax = theMetric2Comp2Group2MinMax[aGaussMetric];
1751 VISU::TComp2Group2MinMax& aComp2Group2AverageMinMax = theMetric2Comp2Group2AverageMinMax[aGaussMetric];
1753 VISU::TMinMax& aMinMax = aComp2MinMax[0];
1754 vtkFloatingPointType& aMin = aMinMax.first;
1755 vtkFloatingPointType& aMax = aMinMax.second;
1756 VISU::TMinMax& anAverageMinMax = aComp2AverageMinMax[0];
1757 vtkFloatingPointType& anAverageMin = anAverageMinMax.first;
1758 vtkFloatingPointType& anAverageMax = anAverageMinMax.second;
1760 VISU::TGroup2MinMax& aGroup2MinMax = aComp2Group2MinMax[0];
1761 VISU::TGroup2MinMax& aGroup2AverageMinMax = aComp2Group2AverageMinMax[0];
1763 for(TInt iElem = 0; iElem < aNbElem; iElem++){
1764 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
1766 // get names of groups, to which the element belongs
1767 VISU::TNames aGroupNames;
1768 VISU::TElemID2FamilyID::const_iterator anIter = anElemID2FamilyID.find(iElem);
1769 if(anIter != anElemID2FamilyID.end()){
1770 int aFamilyId = anIter->second;
1772 VISU::TFamilyIDMap::const_iterator aFamilyIter = aFamilyIDMap.find(aFamilyId);
1773 if(aFamilyIter != aFamilyIDMap.end()){
1774 VISU::PMEDFamily aFamily = aFamilyIter->second;
1775 aGroupNames = aFamily->myGroupNames;
1780 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1781 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
1782 vtkFloatingPointType aValue = 0.0;
1783 for(TInt iComp = 0; iComp < theNbComp2; iComp++){
1784 vtkFloatingPointType aVal = aMValueSlice[iComp];
1785 aValue += aVal*aVal;
1787 aValue = sqrt(aValue);
1788 aMin = isnan(aValue) ? aValue : std::min(aMin,aValue);
1789 aMax = isnan(aValue) ? aValue : std::max(aMax,aValue);
1791 // additional calculation for each group, to which the element belongs
1792 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1793 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1794 VISU::TName aGroupName = *aGroupIter;
1795 bool isGroupFound = aGroup2MinMax.find(aGroupName) != aGroup2MinMax.end();
1796 VISU::TMinMax& aGroupMinMax = aGroup2MinMax[aGroupName];
1797 vtkFloatingPointType& aGroupMin = aGroupMinMax.first;
1798 vtkFloatingPointType& aGroupMax = aGroupMinMax.second;
1799 aGroupMin = isGroupFound ? std::min(aGroupMin,aValue) : aValue;
1800 aGroupMax = isGroupFound ? std::max(aGroupMax,aValue) : aValue;
1803 if(isAverageByGaussPoints){
1804 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMCompValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
1805 vtkFloatingPointType aValue = 0.0;
1806 for(TInt iComp = 0; iComp < theNbComp2; iComp++){
1807 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMCompValueSlice = aMCompValueSliceArr[iComp];
1808 vtkFloatingPointType anAverageValue = aBaseAverageValues[aGaussMetric];
1809 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1810 const vtkFloatingPointType& aVal = aMCompValueSlice[iGauss];
1811 switch(aGaussMetric) {
1812 case VISU::AVERAGE_METRIC: anAverageValue += aVal; break;
1813 case VISU::MINIMUM_METRIC: anAverageValue = std::min(anAverageValue, aVal); break;
1814 case VISU::MAXIMUM_METRIC: anAverageValue = std::max(anAverageValue, aVal); break;
1817 if(aGaussMetric == VISU::AVERAGE_METRIC)
1818 anAverageValue /= aNbGauss;
1819 aValue += anAverageValue*anAverageValue;
1821 aValue = sqrt(aValue);
1822 anAverageMin = std::min(anAverageMin,aValue);
1823 anAverageMax = std::max(anAverageMax,aValue);
1825 // additional calculation for each group, to which the element belongs
1826 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1827 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1828 VISU::TName aGroupName = *aGroupIter;
1829 bool isGroupFound = aGroup2AverageMinMax.find(aGroupName) != aGroup2AverageMinMax.end();
1830 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1831 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1832 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1833 aGroupAverageMin = isGroupFound ? std::min(aGroupAverageMin,aValue) : aValue;
1834 aGroupAverageMax = isGroupFound ? std::max(aGroupAverageMax,aValue) : aValue;
1838 anAverageMin = aMin;
1839 anAverageMax = aMax;
1841 // additional calculation for each group, to which the element belongs
1842 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1843 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1844 VISU::TName aGroupName = *aGroupIter;
1845 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1846 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1847 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1848 aGroupAverageMin = aGroup2MinMax[aGroupName].first;
1849 aGroupAverageMax = aGroup2MinMax[aGroupName].second;
1858 //---------------------------------------------------------------
1866 VISU_Convertor_impl::BuildMinMax();
1868 TSetIsDone aSetIsDone(myIsMinMaxDone);
1869 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax");
1871 MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(myMed);
1872 MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(myMed);
1874 TInt aNbMeshes = myMed->GetNbMeshes();
1875 VISU::TMeshMap& aMeshMap = myMeshMap;
1877 INITMSG(MYDEBUG,"BuildMinMax - aNbMeshes = "<<aNbMeshes<<"\n");
1879 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
1883 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPMeshInfo");
1885 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
1886 std::string aMeshName = aMeshInfo->GetName();
1888 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
1889 if(anIter == aMeshMap.end())
1891 VISU::PMEDMesh aMesh = anIter->second;
1896 TInt aNbFields = myMed->GetNbFields();
1899 "- aMeshName = '"<<aMeshName<<"'"<<
1900 "; aNbFields = "<<aNbFields<<"\n");
1902 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
1904 for(TInt iField = 1; iField <= aNbFields; iField++){
1905 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()");
1907 MED::TErr anError = 0;
1908 MED::PFieldInfo aFieldInfo = myMed->GetPFieldInfo(aMeshInfo, iField, &anError);
1912 std::string aFieldName = aFieldInfo->GetName();
1913 INITMSG(MYDEBUG,"- aFieldName = '"<<aFieldName<<"'\n");
1915 MED::TGeom2Size aGeom2Size;
1916 MED::EEntiteMaillage aMEntity;
1917 TInt aNbTimeStamps = myMed->GetNbTimeStamps(aFieldInfo,
1921 if(aNbTimeStamps < 1)
1924 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
1925 VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
1926 VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
1927 VISU::PMEDField aField = aFieldMap[aFieldName];
1929 TInt aNbComp = aField->myNbComp;
1930 int aNbComp2 = aNbComp;
1931 if(aNbComp == 2 || aNbComp == 4)
1933 else if(aNbComp > 4)
1936 VISU::TMetric2Comp2MinMax& aMetric2Comp2MinMax = aField->myMetric2Comp2MinMax;
1937 VISU::TMetric2Comp2MinMax& aMetric2Comp2AverageMinMax = aField->myMetric2Comp2AverageMinMax;
1938 VISU::TMetric2Comp2Group2MinMax& aMetric2Comp2Group2MinMax = aField->myMetric2Comp2Group2MinMax;
1939 VISU::TMetric2Comp2Group2MinMax& aMetric2Comp2Group2AverageMinMax = aField->myMetric2Comp2Group2AverageMinMax;
1940 TSetIsDone aSetIsDone(aField->myIsMinMaxInitilized);
1941 for(TInt iTimeStamp = aNbTimeStamps; iTimeStamp >= 1; iTimeStamp--){
1942 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()");
1943 INITMSG(MYDEBUG,"- iTimeStamp = "<<iTimeStamp<<endl);
1951 MED::PTimeStampInfo aTimeStampInfo =
1952 myMed->GetPTimeStampInfo(aFieldInfo,
1957 MED::PTimeStampValueBase aTimeStampValue =
1958 myMed->GetPTimeStampValue(aTimeStampInfo,
1962 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
1964 if(aFieldInfo->GetType() == MED::eFLOAT64)
1965 BuildTimeStampMinMax<MED::TFloatTimeStampValue>(CastToFloatTimeStampValue(aTimeStampValue),
1968 aMetric2Comp2MinMax,
1969 aMetric2Comp2AverageMinMax,
1970 aMetric2Comp2Group2MinMax,
1971 aMetric2Comp2Group2AverageMinMax,
1975 BuildTimeStampMinMax<MED::TIntTimeStampValue>(CastToIntTimeStampValue(aTimeStampValue),
1978 aMetric2Comp2MinMax,
1979 aMetric2Comp2AverageMinMax,
1980 aMetric2Comp2Group2MinMax,
1981 aMetric2Comp2Group2AverageMinMax,
1986 }catch(Standard_Failure){
1987 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1988 MSG(MYDEBUG,"Follow signal was occured in:\n"<<aFail->GetMessageString());
1989 }catch(std::exception& exc){
1990 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1992 MSG(MYDEBUG,"Unknown exception !!!");
1996 for(TInt iComp = 0; iComp <= aNbComp; iComp++){
1997 VISU::TMinMax aMinMax = aField->GetMinMax(iComp, VISU::TNames());
1998 INITMSG(MYDEBUG,"- "<<iComp<<": "<<aMinMax.first<<"; "<<aMinMax.second<<endl);
2002 }catch(std::exception& exc){
2003 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2005 MSG(MYDEBUG,"Unknown exception !!!");
2010 }catch(std::exception& exc){
2011 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2013 MSG(MYDEBUG,"Unknown exception !!!");
2022 //---------------------------------------------------------------
2030 TSetIsDone aSetIsDone(myIsGroupsDone);
2031 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGroups");
2033 TInt aNbMeshes = myMed->GetNbMeshes();
2034 VISU::TMeshMap& aMeshMap = myMeshMap;
2036 INITMSG(MYDEBUG,"BuildGroups - aNbMeshes = "<<aNbMeshes<<"\n");
2038 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
2042 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
2044 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
2045 std::string aMeshName = aMeshInfo->GetName();
2047 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
2048 if(anIter == aMeshMap.end())
2050 VISU::PMEDMesh aMesh = anIter->second;
2052 INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
2054 MED::EMaillage aType = aMeshInfo->GetType();
2056 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
2058 MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo =
2059 MED::GetEntity2TGeom2ElemInfo(myMed, aMeshInfo, anEntityInfo);
2064 MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(myMed, aMeshInfo);
2066 if(aType == MED::eNON_STRUCTURE)
2067 BuildFamilyMap(aMesh,
2069 anEntity2TGeom2ElemInfo,
2073 BuildGrilleFamilyMap(aMesh,
2078 BuildGroupMap(aMesh,
2081 }catch(std::exception& exc){
2082 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2084 MSG(MYDEBUG,"Unknown exception !!!");
2089 }catch(std::exception& exc){
2090 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2092 MSG(MYDEBUG,"Unknown exception !!!");
2101 //---------------------------------------------------------------
2104 ::LoadMeshOnEntity(VISU::PMeshImpl theMesh,
2105 VISU::PMeshOnEntityImpl theMeshOnEntity)
2107 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnEntity");
2108 INITMSG(MYDEBUG,"LoadMeshOnEntity"<<endl);
2110 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2112 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2113 if(anEntity == VISU::NODE_ENTITY){
2114 isPointsUpdated += LoadPoints(myMed, theMesh);
2116 isPointsUpdated += LoadPoints(myMed, theMesh);
2117 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed, theMesh, theMeshOnEntity);
2120 return (isPointsUpdated || isCellsOnEntityUpdated);
2124 //---------------------------------------------------------------
2127 ::LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
2128 VISU::PMeshOnEntityImpl theMeshOnEntity,
2129 VISU::PFamilyImpl theFamily)
2131 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity");
2132 INITMSG(MYDEBUG,"LoadFamilyOnEntity"<<endl);
2134 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2136 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2137 if(anEntity == VISU::NODE_ENTITY){
2138 isPointsUpdated += LoadPointsOnFamily(myMed, theMesh, theFamily);
2140 isPointsUpdated += LoadPoints(myMed, theMesh);
2141 isCellsOnEntityUpdated += LoadCellsOnFamily(myMed, theMesh, theMeshOnEntity, theFamily);
2144 return (isPointsUpdated || isCellsOnEntityUpdated);
2148 //---------------------------------------------------------------
2151 ::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
2152 const VISU::TFamilySet& theFamilySet)
2154 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup");
2155 INITMSG(MYDEBUG,"LoadMeshOnGroup"<<endl);
2157 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2158 VISU::TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
2159 for(; aFamilyIter != theFamilySet.end(); aFamilyIter++){
2160 VISU::PMEDFamily aFamily = (*aFamilyIter).second;
2161 const VISU::TEntity& anEntity = aFamily->myEntity;
2162 const VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
2163 isPointsUpdated += LoadPoints(myMed, theMesh);
2164 if(anEntity == VISU::NODE_ENTITY){
2165 isPointsUpdated += LoadPointsOnFamily(myMed, theMesh, aFamily);
2167 isCellsOnEntityUpdated += LoadCellsOnFamily(myMed,theMesh,aMeshOnEntity,aFamily);
2171 return (isPointsUpdated || isCellsOnEntityUpdated);
2175 //---------------------------------------------------------------
2178 ::LoadValForTimeOnMesh(VISU::PMeshImpl theMesh,
2179 VISU::PMeshOnEntityImpl theMeshOnEntity,
2180 VISU::PFieldImpl theField,
2181 VISU::PValForTimeImpl theValForTime)
2183 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh");
2184 INITMSG(MYDEBUG,"LoadValForTimeOnMesh"<<endl);
2186 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2187 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2188 isPointsUpdated += LoadPoints(myMed,theMesh);
2189 if(anEntity != VISU::NODE_ENTITY)
2190 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity);
2191 int isFieldUpdated = LoadValForTimeOnMesh(myMed,theMesh,theMeshOnEntity,theField,theValForTime);
2193 return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
2197 //---------------------------------------------------------------
2200 ::LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh,
2201 VISU::PMeshOnEntityImpl theMeshOnEntity,
2202 VISU::PFieldImpl theField,
2203 VISU::PValForTimeImpl theValForTime)
2205 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts");
2206 INITMSG(MYDEBUG,"LoadValForTimeOnGaussPts"<<endl);
2208 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2209 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2210 if(anEntity != VISU::NODE_ENTITY)
2211 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity);
2212 int isFieldUpdated = LoadValForTimeOnGaussPts(myMed,theMesh,theMeshOnEntity,theField,theValForTime);
2214 return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
2218 //---------------------------------------------------------------
2221 ::LoadPoints(const MED::PWrapper& theMed,
2222 VISU::PMEDMesh theMesh)
2224 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPoints");
2226 //Check on existing family
2227 VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
2228 aMeshOnEntity->myMeshName = theMesh->myName;
2229 aMeshOnEntity->myEntity = VISU::NODE_ENTITY;
2231 INITMSG(MYDEBUG,"LoadPoints - theMesh->myIsDone = "<<theMesh->myIsDone<<"'\n");
2233 //Check on loading already done
2234 if(theMesh->myIsDone)
2237 MED::EMaillage aType = theMesh->myMeshInfo->GetType();
2239 if(aType == MED::eNON_STRUCTURE){
2241 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
2242 TInt aNbElem = aNodeInfo->GetNbElem();
2244 VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
2245 aNamedPointCoords->Init(aNodeInfo, theMed->GetVersion());
2247 VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
2248 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
2250 aSubMesh->Init(MED::PElemInfo(aNodeInfo), theMed->GetVersion());
2251 aSubMesh->myNbCells = theMesh->myNbPoints;
2252 aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
2254 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2255 aCell2Connect.resize(aNbElem);
2256 for (int iElem = 0; iElem < aNbElem; iElem++)
2257 aCell2Connect[iElem] = VISU::TConnect(1,iElem);
2258 } // END NON_STRUCTURED
2259 else { // STRUCTURED
2261 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(theMesh->myMeshInfo);
2262 TInt aNbElem = aGrilleInfo->GetNbNodes();
2264 VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
2265 aNamedPointCoords->Init(aGrilleInfo);
2267 VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
2268 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
2270 aSubMesh->Init(aGrilleInfo);
2271 aSubMesh->myNbCells = theMesh->myNbPoints;
2272 aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
2274 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2275 aCell2Connect.resize(aNbElem);
2276 for(int iElem = 0; iElem < aNbElem; iElem++)
2277 aCell2Connect[iElem] = VISU::TConnect(1,iElem);
2281 theMesh->myIsDone = true;
2285 }catch(std::exception& exc){
2288 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2295 //---------------------------------------------------------------
2298 ::LoadPointsOnFamily(const MED::PWrapper& theMed,
2299 const VISU::PMEDMesh theMesh,
2300 const VISU::PMEDFamily theFamily)
2302 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPointsOnFamily");
2304 if(theFamily->myIsDone)
2307 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2308 MED::EMaillage aType = aMeshInfo->GetType();
2311 if(aType == MED::eNON_STRUCTURE){
2312 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
2313 TInt aNbElem = aNodeInfo->GetNbElem();
2316 TInt anId = theFamily->myId;
2317 VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
2318 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2319 if(aNodeInfo->GetFamNum(iElem) == anId)
2320 aSubMeshID.push_back(iElem);
2324 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo);
2325 TInt aNbElem = aGrilleInfo->GetNbNodes();
2328 TInt anId = theFamily->myId;
2329 VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
2330 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2331 if(aGrilleInfo->GetFamNumNode(iElem) == anId)
2332 aSubMeshID.push_back(iElem);
2336 theFamily->myIsDone = true;
2340 }catch(std::exception& exc){
2343 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2350 //---------------------------------------------------------------
2353 ::LoadCellsOnEntity(const MED::PWrapper& theMed,
2354 const VISU::PMEDMesh theMesh,
2355 const VISU::PMEDMeshOnEntity theMeshOnEntity)
2357 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnEntity");
2361 const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
2362 const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
2364 INITMSG(MYDEBUG,"LoadCellsOnEntity - aVEntity = "<<aVEntity<<"\n");
2366 if(theMeshOnEntity->myIsDone)
2369 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2371 MED::EMaillage aType = aMeshInfo->GetType();
2373 if(aType == MED::eSTRUCTURE){
2375 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo);
2376 TInt aNbPoints = aGrilleInfo->GetNbNodes();
2378 std::map<TInt,TInt> aNodeIdMap;
2379 EBooleen anIsNodeNum = MED::eFAUX;
2381 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2382 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2383 VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
2385 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2386 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2387 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2388 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"; aEGeom = "<<aEGeom<<"\n");
2390 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
2391 INITMSG(MYDEBUG,"aVNbNodes = "<<aVNbNodes<<"\n");
2393 TInt aNbElem = aGeom2SizeIter->second;//aGrilleInfo->GetNbCells();
2396 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2398 aSubMesh->Init(aGrilleInfo);
2399 aSubMesh->myNbCells = aNbElem;
2400 aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
2402 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2403 aCell2Connect.resize(aNbElem);
2405 TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
2406 VISU::TVector<TInt> aConnect(aMNbNodes);
2408 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2409 MED::TIntVector aConn = aGrilleInfo->GetConn(iElem, theMeshOnEntity->myEntity != VISU::CELL_ENTITY);
2410 VISU::TConnect& anArray = aCell2Connect[iElem];
2411 anArray.resize(aVNbNodes);
2414 for(TInt iConn = 0; iConn < aMNbNodes; iConn++){
2415 aConnect[iConn] = aNodeIdMap[aConn[iConn] - 1];
2418 for(int iConn = 0; iConn < aMNbNodes; ++iConn){
2419 aConnect[iConn] = aConn[iConn];
2425 anArray[0] = aConnect[0];
2426 anArray[1] = aConnect[2];
2427 anArray[2] = aConnect[3];
2428 anArray[3] = aConnect[1];
2431 anArray[0] = aConnect[0];
2432 anArray[1] = aConnect[2];
2433 anArray[2] = aConnect[3];
2434 anArray[3] = aConnect[1];
2435 anArray[4] = aConnect[4];
2436 anArray[5] = aConnect[6];
2437 anArray[6] = aConnect[7];
2438 anArray[7] = aConnect[5];
2441 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2442 anArray[iNode] = aConnect[iNode];
2445 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2446 if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
2447 EXCEPTION(std::runtime_error,"LoadCellsOnEntity - "<<
2448 " aNbPoints("<<aNbPoints<<") "<<
2449 "<= anArray["<<iElem<<"]"<<
2451 "("<<anArray[iNode]<<") < 0");
2457 theMeshOnEntity->myIsDone = true;
2463 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
2464 TInt aNbPoints = aNodeInfo->GetNbElem();
2466 std::map<TInt,TInt> aNodeIdMap;
2467 #ifdef _EDF_NODE_IDS_
2468 EBooleen anIsNodeNum = MED::eFAUX;
2470 EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
2472 for(TInt i = 0; i < aNbPoints; i++){
2473 aNodeIdMap[aNodeInfo->GetElemNum(i)-1] = i;
2478 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2479 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2480 VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
2482 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2483 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2484 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2485 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"; aEGeom = "<<aEGeom<<"\n");
2487 case MED::ePOLYGONE: {
2488 MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
2489 TInt aNbElem = aPolygoneInfo->GetNbElem();
2491 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2493 aSubMesh->Init(MED::PElemInfo(aPolygoneInfo),theMed->GetVersion());
2494 aSubMesh->myNbCells = aNbElem;
2496 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2497 aCell2Connect.resize(aNbElem);
2499 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2500 MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem);
2501 TInt aNbConn = aPolygoneInfo->GetNbConn(iElem);
2502 aSubMesh->myCellsSize += aNbConn;
2503 VISU::TConnect& anArray = aCell2Connect[iElem];
2504 anArray.resize(aNbConn);
2505 for(TInt iConn = 0; iConn < aNbConn; iConn++)
2506 anArray[iConn] = aConnSlice[iConn] - 1;
2511 case MED::ePOLYEDRE: {
2512 MED::PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
2513 TInt aNbElem = aPolyedreInfo->GetNbElem();
2516 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2518 aSubMesh->Init(MED::PElemInfo(aPolyedreInfo),theMed->GetVersion());
2519 aSubMesh->myNbCells = aNbElem;
2521 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2522 aCell2Connect.resize(aNbElem);
2524 for(TInt iElem = 0; iElem < aNbElem; iElem++){
2525 MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem);
2526 VISU::TConnect& anArray = aCell2Connect[iElem];
2527 typedef std::set<TInt> TConnectSet;
2528 TConnectSet aConnectSet;
2529 TInt aNbFaces = aConnSliceArr.size();
2530 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
2531 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
2532 TInt aNbConn = aConnSlice.size();
2533 aSubMesh->myCellsSize += aNbConn;
2534 for(TInt iConn = 0; iConn < aNbConn; iConn++){
2535 aConnectSet.insert(aConnSlice[iConn]);
2539 int aNbConn = aConnectSet.size();
2540 anArray.resize(aNbConn);
2541 TConnectSet::iterator anIter = aConnectSet.begin();
2542 for(int i = 0; anIter != aConnectSet.end(); anIter++, i++){
2543 TInt anId = *anIter;
2544 anArray[i] = anId - 1;
2552 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
2553 INITMSG(MYDEBUG,"aVNbNodes = "<<aVNbNodes<<"\n");
2555 MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
2556 TInt aNbElem = aCellInfo->GetNbElem();
2559 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2561 aSubMesh->Init(MED::PElemInfo(aCellInfo), theMed->GetVersion());
2562 aSubMesh->myNbCells = aNbElem;
2563 aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
2565 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2566 aCell2Connect.resize(aNbElem);
2568 TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
2569 VISU::TVector<TInt> aConnect(aMNbNodes);
2571 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2572 MED::TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
2573 VISU::TConnect& anArray = aCell2Connect[iElem];
2574 anArray.resize(aVNbNodes);
2577 for(TInt iConn = 0; iConn < aMNbNodes; iConn++){
2578 aConnect[iConn] = aNodeIdMap[aConnSlice[iConn] - 1];
2581 for(int iConn = 0; iConn < aMNbNodes; iConn++){
2582 aConnect[iConn] = aConnSlice[iConn] - 1;
2587 #if !(defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2589 anArray[0] = aConnect[0];
2590 anArray[2] = aConnect[1];
2592 anArray[1] = aConnect[2];
2595 #if !(defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2597 anArray[0] = aConnect[0];
2598 anArray[2] = aConnect[1];
2599 anArray[4] = aConnect[2];
2601 anArray[1] = aConnect[3];
2602 anArray[3] = aConnect[4];
2603 anArray[5] = aConnect[5];
2606 #if !(defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2608 anArray[0] = aConnect[0];
2609 anArray[2] = aConnect[1];
2610 anArray[4] = aConnect[2];
2611 anArray[6] = aConnect[3];
2613 anArray[1] = aConnect[4];
2614 anArray[3] = aConnect[5];
2615 anArray[5] = aConnect[6];
2616 anArray[7] = aConnect[7];
2619 #if (defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2621 anArray[0] = aConnect[0];
2622 anArray[1] = aConnect[2];
2623 anArray[2] = aConnect[1];
2624 anArray[3] = aConnect[3];
2626 anArray[4] = aConnect[6];
2627 anArray[5] = aConnect[5];
2628 anArray[6] = aConnect[4];
2630 anArray[7] = aConnect[7];
2631 anArray[8] = aConnect[9];
2632 anArray[9] = aConnect[8];
2636 anArray[0] = aConnect[0];
2637 anArray[1] = aConnect[2];
2638 anArray[2] = aConnect[1];
2639 anArray[3] = aConnect[3];
2641 #if (defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2643 anArray[0] = aConnect[0];
2644 anArray[1] = aConnect[3];
2645 anArray[2] = aConnect[2];
2646 anArray[3] = aConnect[1];
2647 anArray[4] = aConnect[4];
2649 anArray[5] = aConnect[8];
2650 anArray[6] = aConnect[7];
2651 anArray[7] = aConnect[6];
2652 anArray[8] = aConnect[5];
2654 anArray[9] = aConnect[9];
2655 anArray[10] = aConnect[12];
2656 anArray[11] = aConnect[11];
2657 anArray[12] = aConnect[10];
2661 anArray[0] = aConnect[0];
2662 anArray[1] = aConnect[3];
2663 anArray[2] = aConnect[2];
2664 anArray[3] = aConnect[1];
2665 anArray[4] = aConnect[4];
2668 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2669 anArray[iNode] = aConnect[iNode];
2671 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2672 if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
2673 EXCEPTION(std::runtime_error,"LoadCellsOnEntity - "<<
2674 " aNbPoints("<<aNbPoints<<") "<<
2675 "<= anArray["<<iElem<<"]"<<
2677 "("<<anArray[iNode]<<") < 0");
2683 // END NON_STRUCTURED
2685 theMeshOnEntity->myIsDone = true;
2690 }catch(std::exception& exc){
2693 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2701 //---------------------------------------------------------------
2704 ::LoadCellsOnFamily(const MED::PWrapper& theMed,
2705 const VISU::PMEDMesh theMesh,
2706 const VISU::PMEDMeshOnEntity theMeshOnEntity,
2707 const VISU::PMEDFamily theFamily)
2709 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnFamily");
2713 const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
2714 const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
2716 INITMSG(MYDEBUG,"LoadCellsOnFamily - aVEntity = "<<aVEntity<<"\n");
2718 if(theFamily->myIsDone)
2721 TInt anId = theFamily->myId;
2723 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2724 VISU::TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
2725 MED::EMaillage aType = aMeshInfo->GetType();
2727 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2728 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2729 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2730 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2731 if(aType == MED::eNON_STRUCTURE){
2732 MED::PElemInfo anElemInfo;
2734 case MED::ePOLYGONE: {
2735 anElemInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
2738 case MED::ePOLYEDRE: {
2739 anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
2743 anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
2747 if(TInt aNbElem = anElemInfo->GetNbElem()){
2748 VISU::TSubMeshID aSubMeshID;
2749 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2750 if(anElemInfo->GetFamNum(iElem) == anId)
2751 aSubMeshID.push_back(iElem);
2752 if(!aSubMeshID.empty()){
2753 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2754 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
2755 aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
2760 MED::PGrilleInfo anElemInfo = theMed->GetPGrilleInfo(aMeshInfo);
2762 TInt aNbElem = anElemInfo->GetNbCells();
2763 if(aNbElem>0 && (aMGeom == anElemInfo->GetGeom()) ){
2764 VISU::TSubMeshID aSubMeshID;
2765 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2766 if(anElemInfo->GetFamNum(iElem) == anId)
2767 aSubMeshID.push_back(iElem);
2768 if(!aSubMeshID.empty()){
2769 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2770 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
2771 aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
2778 theFamily->myIsDone = true;
2783 }catch(std::exception& exc){
2786 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2794 //---------------------------------------------------------------
2796 LoadProfile(const MED::PWrapper& theMed,
2797 VISU::PMEDMesh theMesh,
2798 MED::PTimeStampValueBase theTimeStampValue,
2799 VISU::TMEDValForTime& theValForTime,
2800 VISU::TMEDMeshOnEntity& theMeshOnEntity)
2802 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadProfile");
2803 INITMSG(MYDEBUG,"LoadProfile"<<endl);
2805 VISU::PMEDProfile aProfile = theValForTime.myProfile;
2806 if(aProfile->myIsDone)
2809 const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
2810 const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
2811 MED::TGeom2Profile::const_iterator anIter = aGeom2Profile.begin();
2812 for(; anIter != aGeom2Profile.end(); anIter++){
2813 MED::PProfileInfo aProfileInfo = anIter->second;
2814 MED::EGeometrieElement aMGeom = anIter->first;
2815 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2817 VISU::TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aEGeom);
2818 if(anIter2 != aGeom2SubProfile.end()){
2819 VISU::PMEDSubProfile aSubProfile = anIter2->second;
2821 MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
2822 if(!anElemNum.empty()){
2823 VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
2824 TInt aSize = anElemNum.size();
2825 aSubMeshID.resize(aSize);
2826 for(TInt anId = 0; anId < aSize; anId++)
2827 aSubMeshID[anId] = anElemNum[anId] - 1;
2831 "- aEGeom = "<<aEGeom<<
2832 "; aNbCells = "<<aSubProfile->mySubMeshID.size()<<
2837 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2839 VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
2840 MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
2842 const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
2843 VISU::TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
2844 for(; anIter != aGeom2SubProfile.end(); anIter++){
2845 const VISU::PMEDSubProfile& aSubProfile = anIter->second;
2846 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
2847 MED::PElemInfo anElemInfo;
2848 anElemInfo = theMed->GetPElemInfo(aMeshInfo,aMEntity,aMGeom);
2849 aSubProfile->myIsElemNum = anElemInfo->IsElemNum();
2850 aSubProfile->myElemNum = anElemInfo->myElemNum;
2854 aProfile->myIsDone = true;
2858 //---------------------------------------------------------------
2860 LoadGaussMesh(const MED::PWrapper& theMed,
2861 VISU::PMEDMesh theMesh,
2862 MED::PTimeStampValueBase theTimeStampValue,
2863 VISU::TMEDValForTime& theValForTime,
2864 VISU::TMEDMeshOnEntity& theMeshOnEntity)
2866 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadGaussMesh");
2867 INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
2869 // this part of code must be reimplemented in connection with GRILLE structures
2870 if(theMesh->myMeshInfo->GetType() == MED::eSTRUCTURE)
2871 EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
2873 VISU::PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
2874 if(!aGaussMesh || aGaussMesh->myIsDone)
2877 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2878 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
2880 VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
2881 MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
2883 const VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
2884 const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
2885 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
2887 VISU::TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin();
2888 for(; aSubMeshIter != aGeom2GaussSubMesh.end(); aSubMeshIter++){
2889 VISU::PMEDGaussSubMesh aGaussSubMesh = aSubMeshIter->second;
2890 VISU::EGeometry aEGeom = aSubMeshIter->first;
2892 if(aGaussSubMesh->myIsDone)
2895 VISU::PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
2896 const VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
2897 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
2899 MED::PPolygoneInfo aPolygoneInfo;
2900 MED::PPolyedreInfo aPolyedreInfo;
2901 MED::PCellInfo aCellInfo;
2902 MED::PElemInfo anElemInfo;
2905 case MED::ePOLYGONE:
2906 aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,
2909 anElemInfo = aPolygoneInfo;
2911 case MED::ePOLYEDRE:
2912 aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,
2915 anElemInfo = aPolyedreInfo;
2918 aCellInfo = theMed->GetPCellInfo(aMeshInfo,
2921 anElemInfo = aCellInfo;
2923 aGaussSubMesh->myIsElemNum = anElemInfo->IsElemNum();
2924 aGaussSubMesh->myElemNum = anElemInfo->myElemNum;
2927 bool anIsGaussCoord3D = false;
2928 MED::PGaussCoord aGaussCoordPtr(new MED::TGaussCoord());
2929 MED::TGaussCoord& aGaussCoord = *aGaussCoordPtr;
2931 MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
2932 if(aGaussIter != aGeom2Gauss.end()){
2933 VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss;
2934 MED::PGaussInfo aGaussInfo = aGauss->myGaussInfo;
2936 aName = aGaussInfo->GetName();
2937 if(!aSubMeshID.empty()){
2938 const std::string& aProfileName = aSubProfile->myName;
2939 MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed,
2942 const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
2943 anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo,
2950 anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo,
2956 if(!aSubMeshID.empty()){
2957 const std::string& aProfileName = aSubProfile->myName;
2958 MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed,
2961 const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
2963 case MED::ePOLYGONE:
2964 anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo,
2969 case MED::ePOLYEDRE:
2970 anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo,
2976 anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo,
2984 case MED::ePOLYGONE:
2985 anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo,
2989 case MED::ePOLYEDRE:
2990 anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo,
2995 anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo,
3001 if(anIsGaussCoord3D){
3002 VISU::TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
3003 VISU::TMEDGaussCoordHolder* aCoordHolder = new VISU::TMEDGaussCoordHolder();
3004 aCoordHolder->Init(aGaussCoordPtr);
3005 aCoords.Init(VISU::PCoordHolder(aCoordHolder));
3007 aGaussSubMesh->myIsDone = true;
3009 TInt aNbGauss = aGaussCoord.GetNbGauss();
3010 TInt aNbElem = aGaussCoord.GetNbElem();
3011 TInt aNbCells = aNbElem*aNbGauss;
3014 "- aEGeom = "<<aEGeom<<
3015 "; aName = '"<<aName<<"'"<<
3016 "; aStatus = "<<aGaussSubMesh->myStatus<<
3017 "; aNbElem = "<<aNbElem<<
3018 "; aNbGauss = "<<aNbGauss<<
3019 "; aNbCells = "<<aNbCells<<
3022 EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
3025 aGaussMesh->myIsDone = true;
3029 //---------------------------------------------------------------
3030 template<class TimeStampValueType>
3032 FillValForTime(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
3033 const VISU::TGeom2SubProfile& theGeom2SubProfile,
3034 VISU::PMEDValForTime theValForTime,
3035 VISU::PMEDField theField)
3037 theField->myDataSize = 0;
3038 TInt aNbComp = theField->myNbComp;
3040 VISU::TGeom2SubProfile::const_iterator anIter = theGeom2SubProfile.begin();
3041 for(; anIter != theGeom2SubProfile.end(); anIter++){
3042 VISU::EGeometry aEGeom = anIter->first;
3043 VISU::PMEDSubProfile aSubProfile(anIter->second);
3045 TInt aNbElem = aSubProfile->myNbCells;
3046 theField->myDataSize += aNbElem * aNbComp;
3048 if(aSubProfile->myStatus != VISU::eRemoveAll){
3049 TInt aNbGauss = theValForTime->GetNbGauss(aEGeom);
3052 "- aEGeom = "<<aEGeom<<
3053 "; aNbElem = "<<aNbElem<<
3054 "; aNbGauss = "<<aNbGauss<<
3057 VISU::PMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
3058 typedef typename TimeStampValueType::TElement TElement;
3059 typedef VISU::TTMEDMeshValue<TElement> TVMeshValue;
3060 TVMeshValue* aMeshValue = new TVMeshValue();
3062 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
3063 typedef typename TimeStampValueType::PTMeshValue PTMeshValue;
3064 PTMeshValue aMeshValuePtr = theTimeStampValue->GetMeshValuePtr(aMGeom);
3065 aMeshValue->Init(aNbElem, aNbGauss, aNbComp, aMeshValuePtr);
3066 aVMeshValue.reset(aMeshValue);
3071 //---------------------------------------------------------------
3073 LoadValForTime(const MED::PWrapper& theMed,
3074 VISU::PMEDMesh theMesh,
3075 VISU::PMEDMeshOnEntity theMeshOnEntity,
3076 VISU::PMEDField theField,
3077 VISU::PMEDValForTime theValForTime,
3081 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTime");
3082 INITMSG(MYDEBUG,"LoadValForTime - theIsGauss = "<<theIsGauss<<endl);
3084 //Check on loading already done
3089 const std::string& aMeshName = theMeshOnEntity->myMeshName;
3090 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
3091 MED::PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,
3094 MED::TGeom2Size aGeom2Size;
3095 MED::EEntiteMaillage aMEntity;
3096 theMed->GetNbTimeStamps(aFieldInfo,
3097 theMesh->myEntityInfo,
3101 MED::PTimeStampInfo aTimeStampInfo =
3102 theMed->GetPTimeStampInfo(aFieldInfo,
3105 theValForTime->myId);
3107 MED::TKey2Gauss aKey2Gauss = GetKey2Gauss(theMed);
3108 MED::TMKey2Profile aMKey2Profile = GetMKey2Profile(theMed);
3110 MED::PTimeStampValueBase aTimeStampValue =
3111 theMed->GetPTimeStampValue(aTimeStampInfo,
3130 InitGaussMesh(aTimeStampValue,
3135 LoadGaussMesh(theMed,
3142 VISU::PMEDProfile aProfile = theValForTime->myProfile;
3143 VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
3146 "- aMeshName = '"<<aMeshName<<"'"<<
3147 "; aFieldName = '"<<aFieldInfo->GetName()<<"'"<<
3148 "; aMEntity = "<<aMEntity<<
3149 "; aNbComp = "<<theField->myNbComp<<
3152 if(aFieldInfo->GetType() == MED::eFLOAT64)
3153 FillValForTime<MED::TFloatTimeStampValue>(CastToFloatTimeStampValue(aTimeStampValue),
3158 FillValForTime<MED::TIntTimeStampValue>(CastToIntTimeStampValue(aTimeStampValue),
3168 //---------------------------------------------------------------
3171 ::LoadValForTimeOnMesh(const MED::PWrapper& theMed,
3172 VISU::PMEDMesh theMesh,
3173 VISU::PMEDMeshOnEntity theMeshOnEntity,
3174 VISU::PMEDField theField,
3175 VISU::PMEDValForTime theValForTime)
3177 VISU::PUnstructuredGridIDMapperImpl anUnstructuredGridIDMapper = theValForTime->myUnstructuredGridIDMapper;
3178 return LoadValForTime(theMed,
3184 anUnstructuredGridIDMapper->myIsVTKDone);
3188 //---------------------------------------------------------------
3191 ::LoadValForTimeOnGaussPts(const MED::PWrapper& theMed,
3192 VISU::PMEDMesh theMesh,
3193 VISU::PMEDMeshOnEntity theMeshOnEntity,
3194 VISU::PMEDField theField,
3195 VISU::PMEDValForTime theValForTime)
3197 VISU::PGaussPtsIDFilter aGaussPtsIDFilter = theValForTime->myGaussPtsIDFilter;
3198 return LoadValForTime(theMed,
3204 aGaussPtsIDFilter->myIsVTKDone);