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 // AKL: fix of 0021175 issue. Non-regression test is GVIEW10561(import zzzz121b.med).
1625 // MED::TGeom2Gauss::const_iterator aGaussIter = theGeom2Gauss.find(aMGeom);
1626 // if(aGaussIter == theGeom2Gauss.end())
1630 "- aMGeom = "<<aMGeom<<
1631 "; aNbElem = "<<aNbElem<<
1632 "; aNbGauss = "<<aNbGauss<<
1635 VISU::TElemID2FamilyID anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom];
1637 bool isAverageByGaussPoints = (aNbGauss > 1);
1638 // To calculate min/max per components
1639 for(TInt iElem = 0; iElem < aNbElem; iElem++){
1640 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
1642 for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
1643 VISU::TComp2MinMax& aComp2MinMax = theMetric2Comp2MinMax[aGaussMetric];
1644 VISU::TComp2MinMax& aComp2AverageMinMax = theMetric2Comp2AverageMinMax[aGaussMetric];
1645 VISU::TComp2Group2MinMax& aComp2Group2MinMax = theMetric2Comp2Group2MinMax[aGaussMetric];
1646 VISU::TComp2Group2MinMax& aComp2Group2AverageMinMax = theMetric2Comp2Group2AverageMinMax[aGaussMetric];
1648 for(TInt iComp = 0; iComp < theNbComp; iComp++){
1649 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
1651 VISU::TMinMax& aMinMax = aComp2MinMax[iComp+1];
1652 vtkFloatingPointType& aMin = aMinMax.first;
1653 vtkFloatingPointType& aMax = aMinMax.second;
1654 VISU::TMinMax& anAverageMinMax = aComp2AverageMinMax[iComp+1];
1655 vtkFloatingPointType& anAverageMin = anAverageMinMax.first;
1656 vtkFloatingPointType& anAverageMax = anAverageMinMax.second;
1657 vtkFloatingPointType anAverageValue = aBaseAverageValues[aGaussMetric];
1659 VISU::TGroup2MinMax& aGroup2MinMax = aComp2Group2MinMax[iComp+1];
1660 VISU::TGroup2MinMax& aGroup2AverageMinMax = aComp2Group2AverageMinMax[iComp+1];
1661 std::map<VISU::TName,vtkFloatingPointType> aGroup2AverageValue;
1663 // get names of groups, to which the element belongs
1664 VISU::TNames aGroupNames;
1665 VISU::TElemID2FamilyID::const_iterator anIter = anElemID2FamilyID.find(iElem);
1666 if(anIter != anElemID2FamilyID.end()){
1667 int aFamilyId = anIter->second;
1669 VISU::TFamilyIDMap::const_iterator aFamilyIter = aFamilyIDMap.find(aFamilyId);
1670 if(aFamilyIter != aFamilyIDMap.end()){
1671 VISU::PMEDFamily aFamily = aFamilyIter->second;
1672 aGroupNames = aFamily->myGroupNames;
1673 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1674 for(; aGroupIter != aGroupNames.end(); aGroupIter++)
1675 aGroup2AverageValue[*aGroupIter] = aBaseAverageValues[aGaussMetric];
1680 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1681 const vtkFloatingPointType& aVal = aMValueSlice[iGauss];
1682 aMin = isnan(aVal) ? aVal : std::min(aMin,aVal);
1683 aMax = isnan(aVal) ? aVal : std::max(aMax,aVal);
1684 if(isAverageByGaussPoints){
1685 switch(aGaussMetric) {
1686 case VISU::AVERAGE_METRIC: anAverageValue += aVal; break;
1687 case VISU::MINIMUM_METRIC: anAverageValue = std::min(anAverageValue, aVal); break;
1688 case VISU::MAXIMUM_METRIC: anAverageValue = std::max(anAverageValue, aVal); break;
1692 anAverageMin = aMin;
1693 anAverageMax = aMax;
1696 // additional calculation for each group, to which the element belongs
1697 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1698 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1699 VISU::TName aGroupName = *aGroupIter;
1700 bool isGroupFound = aGroup2MinMax.find(aGroupName) != aGroup2MinMax.end();
1701 VISU::TMinMax& aGroupMinMax = aGroup2MinMax[aGroupName];
1702 vtkFloatingPointType& aGroupMin = aGroupMinMax.first;
1703 vtkFloatingPointType& aGroupMax = aGroupMinMax.second;
1704 aGroupMin = isGroupFound ? std::min(aGroupMin,aVal) : aVal;
1705 aGroupMax = isGroupFound ? std::max(aGroupMax,aVal) : aVal;
1707 if(isAverageByGaussPoints){
1708 switch(aGaussMetric) {
1709 case VISU::AVERAGE_METRIC: aGroup2AverageValue[aGroupName] = aGroup2AverageValue[aGroupName] + aVal; break;
1710 case VISU::MINIMUM_METRIC: aGroup2AverageValue[aGroupName] = std::min(aGroup2AverageValue[aGroupName], aVal); break;
1711 case VISU::MAXIMUM_METRIC: aGroup2AverageValue[aGroupName] = std::max(aGroup2AverageValue[aGroupName], aVal); break;
1715 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1716 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1717 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1718 aGroupAverageMin = aGroupMin;
1719 aGroupAverageMax = aGroupMax;
1723 if(isAverageByGaussPoints){
1724 if(aGaussMetric == VISU::AVERAGE_METRIC)
1725 anAverageValue /= aNbGauss;
1726 anAverageMin = std::min(anAverageMin,anAverageValue);
1727 anAverageMax = std::max(anAverageMax,anAverageValue);
1729 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1730 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1731 VISU::TName aGroupName = *aGroupIter;
1732 vtkFloatingPointType aGroupAverageValue = aGroup2AverageValue[aGroupName];
1733 if(aGaussMetric == VISU::AVERAGE_METRIC)
1734 aGroupAverageValue /= aNbGauss;
1735 bool isGroupFound = aGroup2AverageMinMax.find(aGroupName) != aGroup2AverageMinMax.end();
1736 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1737 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1738 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1739 aGroupAverageMin = isGroupFound ? std::min(aGroupAverageMin,aGroupAverageValue) : aGroupAverageValue;
1740 aGroupAverageMax = isGroupFound ? std::max(aGroupAverageMax,aGroupAverageValue) : aGroupAverageValue;
1747 // To calculate min/max per vector modulus
1748 for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
1749 VISU::TComp2MinMax& aComp2MinMax = theMetric2Comp2MinMax[aGaussMetric];
1750 VISU::TComp2MinMax& aComp2AverageMinMax = theMetric2Comp2AverageMinMax[aGaussMetric];
1751 VISU::TComp2Group2MinMax& aComp2Group2MinMax = theMetric2Comp2Group2MinMax[aGaussMetric];
1752 VISU::TComp2Group2MinMax& aComp2Group2AverageMinMax = theMetric2Comp2Group2AverageMinMax[aGaussMetric];
1754 VISU::TMinMax& aMinMax = aComp2MinMax[0];
1755 vtkFloatingPointType& aMin = aMinMax.first;
1756 vtkFloatingPointType& aMax = aMinMax.second;
1757 VISU::TMinMax& anAverageMinMax = aComp2AverageMinMax[0];
1758 vtkFloatingPointType& anAverageMin = anAverageMinMax.first;
1759 vtkFloatingPointType& anAverageMax = anAverageMinMax.second;
1761 VISU::TGroup2MinMax& aGroup2MinMax = aComp2Group2MinMax[0];
1762 VISU::TGroup2MinMax& aGroup2AverageMinMax = aComp2Group2AverageMinMax[0];
1764 for(TInt iElem = 0; iElem < aNbElem; iElem++){
1765 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
1767 // get names of groups, to which the element belongs
1768 VISU::TNames aGroupNames;
1769 VISU::TElemID2FamilyID::const_iterator anIter = anElemID2FamilyID.find(iElem);
1770 if(anIter != anElemID2FamilyID.end()){
1771 int aFamilyId = anIter->second;
1773 VISU::TFamilyIDMap::const_iterator aFamilyIter = aFamilyIDMap.find(aFamilyId);
1774 if(aFamilyIter != aFamilyIDMap.end()){
1775 VISU::PMEDFamily aFamily = aFamilyIter->second;
1776 aGroupNames = aFamily->myGroupNames;
1781 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1782 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
1783 vtkFloatingPointType aValue = 0.0;
1784 for(TInt iComp = 0; iComp < theNbComp2; iComp++){
1785 vtkFloatingPointType aVal = aMValueSlice[iComp];
1786 aValue += aVal*aVal;
1788 aValue = sqrt(aValue);
1789 aMin = isnan(aValue) ? aValue : std::min(aMin,aValue);
1790 aMax = isnan(aValue) ? aValue : std::max(aMax,aValue);
1792 // additional calculation for each group, to which the element belongs
1793 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1794 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1795 VISU::TName aGroupName = *aGroupIter;
1796 bool isGroupFound = aGroup2MinMax.find(aGroupName) != aGroup2MinMax.end();
1797 VISU::TMinMax& aGroupMinMax = aGroup2MinMax[aGroupName];
1798 vtkFloatingPointType& aGroupMin = aGroupMinMax.first;
1799 vtkFloatingPointType& aGroupMax = aGroupMinMax.second;
1800 aGroupMin = isGroupFound ? std::min(aGroupMin,aValue) : aValue;
1801 aGroupMax = isGroupFound ? std::max(aGroupMax,aValue) : aValue;
1804 if(isAverageByGaussPoints){
1805 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMCompValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
1806 vtkFloatingPointType aValue = 0.0;
1807 for(TInt iComp = 0; iComp < theNbComp2; iComp++){
1808 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMCompValueSlice = aMCompValueSliceArr[iComp];
1809 vtkFloatingPointType anAverageValue = aBaseAverageValues[aGaussMetric];
1810 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1811 const vtkFloatingPointType& aVal = aMCompValueSlice[iGauss];
1812 switch(aGaussMetric) {
1813 case VISU::AVERAGE_METRIC: anAverageValue += aVal; break;
1814 case VISU::MINIMUM_METRIC: anAverageValue = std::min(anAverageValue, aVal); break;
1815 case VISU::MAXIMUM_METRIC: anAverageValue = std::max(anAverageValue, aVal); break;
1818 if(aGaussMetric == VISU::AVERAGE_METRIC)
1819 anAverageValue /= aNbGauss;
1820 aValue += anAverageValue*anAverageValue;
1822 aValue = sqrt(aValue);
1823 anAverageMin = std::min(anAverageMin,aValue);
1824 anAverageMax = std::max(anAverageMax,aValue);
1826 // additional calculation for each group, to which the element belongs
1827 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1828 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1829 VISU::TName aGroupName = *aGroupIter;
1830 bool isGroupFound = aGroup2AverageMinMax.find(aGroupName) != aGroup2AverageMinMax.end();
1831 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1832 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1833 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1834 aGroupAverageMin = isGroupFound ? std::min(aGroupAverageMin,aValue) : aValue;
1835 aGroupAverageMax = isGroupFound ? std::max(aGroupAverageMax,aValue) : aValue;
1839 anAverageMin = aMin;
1840 anAverageMax = aMax;
1842 // additional calculation for each group, to which the element belongs
1843 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1844 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1845 VISU::TName aGroupName = *aGroupIter;
1846 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1847 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1848 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1849 aGroupAverageMin = aGroup2MinMax[aGroupName].first;
1850 aGroupAverageMax = aGroup2MinMax[aGroupName].second;
1859 //---------------------------------------------------------------
1867 VISU_Convertor_impl::BuildMinMax();
1869 TSetIsDone aSetIsDone(myIsMinMaxDone);
1870 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax");
1872 MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(myMed);
1873 MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(myMed);
1875 TInt aNbMeshes = myMed->GetNbMeshes();
1876 VISU::TMeshMap& aMeshMap = myMeshMap;
1878 INITMSG(MYDEBUG,"BuildMinMax - aNbMeshes = "<<aNbMeshes<<"\n");
1880 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
1884 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPMeshInfo");
1886 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
1887 std::string aMeshName = aMeshInfo->GetName();
1889 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
1890 if(anIter == aMeshMap.end())
1892 VISU::PMEDMesh aMesh = anIter->second;
1897 TInt aNbFields = myMed->GetNbFields();
1900 "- aMeshName = '"<<aMeshName<<"'"<<
1901 "; aNbFields = "<<aNbFields<<"\n");
1903 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
1905 for(TInt iField = 1; iField <= aNbFields; iField++){
1906 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()");
1908 MED::TErr anError = 0;
1909 MED::PFieldInfo aFieldInfo = myMed->GetPFieldInfo(aMeshInfo, iField, &anError);
1913 std::string aFieldName = aFieldInfo->GetName();
1914 INITMSG(MYDEBUG,"- aFieldName = '"<<aFieldName<<"'\n");
1916 MED::TGeom2Size aGeom2Size;
1917 MED::EEntiteMaillage aMEntity;
1918 TInt aNbTimeStamps = myMed->GetNbTimeStamps(aFieldInfo,
1922 if(aNbTimeStamps < 1)
1925 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
1926 VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
1927 VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
1928 VISU::PMEDField aField = aFieldMap[aFieldName];
1930 TInt aNbComp = aField->myNbComp;
1931 int aNbComp2 = aNbComp;
1932 if(aNbComp == 2 || aNbComp == 4)
1934 else if(aNbComp > 4)
1937 VISU::TMetric2Comp2MinMax& aMetric2Comp2MinMax = aField->myMetric2Comp2MinMax;
1938 VISU::TMetric2Comp2MinMax& aMetric2Comp2AverageMinMax = aField->myMetric2Comp2AverageMinMax;
1939 VISU::TMetric2Comp2Group2MinMax& aMetric2Comp2Group2MinMax = aField->myMetric2Comp2Group2MinMax;
1940 VISU::TMetric2Comp2Group2MinMax& aMetric2Comp2Group2AverageMinMax = aField->myMetric2Comp2Group2AverageMinMax;
1941 TSetIsDone aSetIsDone(aField->myIsMinMaxInitilized);
1942 for(TInt iTimeStamp = aNbTimeStamps; iTimeStamp >= 1; iTimeStamp--){
1943 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()");
1944 INITMSG(MYDEBUG,"- iTimeStamp = "<<iTimeStamp<<endl);
1952 MED::PTimeStampInfo aTimeStampInfo =
1953 myMed->GetPTimeStampInfo(aFieldInfo,
1958 MED::PTimeStampValueBase aTimeStampValue =
1959 myMed->GetPTimeStampValue(aTimeStampInfo,
1963 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
1965 if(aFieldInfo->GetType() == MED::eFLOAT64)
1966 BuildTimeStampMinMax<MED::TFloatTimeStampValue>(CastToFloatTimeStampValue(aTimeStampValue),
1969 aMetric2Comp2MinMax,
1970 aMetric2Comp2AverageMinMax,
1971 aMetric2Comp2Group2MinMax,
1972 aMetric2Comp2Group2AverageMinMax,
1976 BuildTimeStampMinMax<MED::TIntTimeStampValue>(CastToIntTimeStampValue(aTimeStampValue),
1979 aMetric2Comp2MinMax,
1980 aMetric2Comp2AverageMinMax,
1981 aMetric2Comp2Group2MinMax,
1982 aMetric2Comp2Group2AverageMinMax,
1987 }catch(Standard_Failure){
1988 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1989 MSG(MYDEBUG,"Follow signal was occured in:\n"<<aFail->GetMessageString());
1990 }catch(std::exception& exc){
1991 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1993 MSG(MYDEBUG,"Unknown exception !!!");
1997 for(TInt iComp = 0; iComp <= aNbComp; iComp++){
1998 VISU::TMinMax aMinMax = aField->GetMinMax(iComp, VISU::TNames());
1999 INITMSG(MYDEBUG,"- "<<iComp<<": "<<aMinMax.first<<"; "<<aMinMax.second<<endl);
2003 }catch(std::exception& exc){
2004 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2006 MSG(MYDEBUG,"Unknown exception !!!");
2011 }catch(std::exception& exc){
2012 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2014 MSG(MYDEBUG,"Unknown exception !!!");
2023 //---------------------------------------------------------------
2031 TSetIsDone aSetIsDone(myIsGroupsDone);
2032 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGroups");
2034 TInt aNbMeshes = myMed->GetNbMeshes();
2035 VISU::TMeshMap& aMeshMap = myMeshMap;
2037 INITMSG(MYDEBUG,"BuildGroups - aNbMeshes = "<<aNbMeshes<<"\n");
2039 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
2043 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
2045 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
2046 std::string aMeshName = aMeshInfo->GetName();
2048 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
2049 if(anIter == aMeshMap.end())
2051 VISU::PMEDMesh aMesh = anIter->second;
2053 INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
2055 MED::EMaillage aType = aMeshInfo->GetType();
2057 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
2059 MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo =
2060 MED::GetEntity2TGeom2ElemInfo(myMed, aMeshInfo, anEntityInfo);
2065 MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(myMed, aMeshInfo);
2067 if(aType == MED::eNON_STRUCTURE)
2068 BuildFamilyMap(aMesh,
2070 anEntity2TGeom2ElemInfo,
2074 BuildGrilleFamilyMap(aMesh,
2079 BuildGroupMap(aMesh,
2082 }catch(std::exception& exc){
2083 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2085 MSG(MYDEBUG,"Unknown exception !!!");
2090 }catch(std::exception& exc){
2091 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2093 MSG(MYDEBUG,"Unknown exception !!!");
2102 //---------------------------------------------------------------
2105 ::LoadMeshOnEntity(VISU::PMeshImpl theMesh,
2106 VISU::PMeshOnEntityImpl theMeshOnEntity)
2108 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnEntity");
2109 INITMSG(MYDEBUG,"LoadMeshOnEntity"<<endl);
2111 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2113 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2114 if(anEntity == VISU::NODE_ENTITY){
2115 isPointsUpdated += LoadPoints(myMed, theMesh);
2117 isPointsUpdated += LoadPoints(myMed, theMesh);
2118 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed, theMesh, theMeshOnEntity);
2121 return (isPointsUpdated || isCellsOnEntityUpdated);
2125 //---------------------------------------------------------------
2128 ::LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
2129 VISU::PMeshOnEntityImpl theMeshOnEntity,
2130 VISU::PFamilyImpl theFamily)
2132 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity");
2133 INITMSG(MYDEBUG,"LoadFamilyOnEntity"<<endl);
2135 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2137 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2138 if(anEntity == VISU::NODE_ENTITY){
2139 isPointsUpdated += LoadPointsOnFamily(myMed, theMesh, theFamily);
2141 isPointsUpdated += LoadPoints(myMed, theMesh);
2142 isCellsOnEntityUpdated += LoadCellsOnFamily(myMed, theMesh, theMeshOnEntity, theFamily);
2145 return (isPointsUpdated || isCellsOnEntityUpdated);
2149 //---------------------------------------------------------------
2152 ::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
2153 const VISU::TFamilySet& theFamilySet)
2155 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup");
2156 INITMSG(MYDEBUG,"LoadMeshOnGroup"<<endl);
2158 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2159 VISU::TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
2160 for(; aFamilyIter != theFamilySet.end(); aFamilyIter++){
2161 VISU::PMEDFamily aFamily = (*aFamilyIter).second;
2162 const VISU::TEntity& anEntity = aFamily->myEntity;
2163 const VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
2164 isPointsUpdated += LoadPoints(myMed, theMesh);
2165 if(anEntity == VISU::NODE_ENTITY){
2166 isPointsUpdated += LoadPointsOnFamily(myMed, theMesh, aFamily);
2168 isCellsOnEntityUpdated += LoadCellsOnFamily(myMed,theMesh,aMeshOnEntity,aFamily);
2172 return (isPointsUpdated || isCellsOnEntityUpdated);
2176 //---------------------------------------------------------------
2179 ::LoadValForTimeOnMesh(VISU::PMeshImpl theMesh,
2180 VISU::PMeshOnEntityImpl theMeshOnEntity,
2181 VISU::PFieldImpl theField,
2182 VISU::PValForTimeImpl theValForTime)
2184 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh");
2185 INITMSG(MYDEBUG,"LoadValForTimeOnMesh"<<endl);
2187 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2188 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2189 isPointsUpdated += LoadPoints(myMed,theMesh);
2190 if(anEntity != VISU::NODE_ENTITY)
2191 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity);
2192 int isFieldUpdated = LoadValForTimeOnMesh(myMed,theMesh,theMeshOnEntity,theField,theValForTime);
2194 return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
2198 //---------------------------------------------------------------
2201 ::LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh,
2202 VISU::PMeshOnEntityImpl theMeshOnEntity,
2203 VISU::PFieldImpl theField,
2204 VISU::PValForTimeImpl theValForTime)
2206 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts");
2207 INITMSG(MYDEBUG,"LoadValForTimeOnGaussPts"<<endl);
2209 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2210 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2211 if(anEntity != VISU::NODE_ENTITY)
2212 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity);
2213 int isFieldUpdated = LoadValForTimeOnGaussPts(myMed,theMesh,theMeshOnEntity,theField,theValForTime);
2215 return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
2219 //---------------------------------------------------------------
2222 ::LoadPoints(const MED::PWrapper& theMed,
2223 VISU::PMEDMesh theMesh)
2225 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPoints");
2227 //Check on existing family
2228 VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
2229 aMeshOnEntity->myMeshName = theMesh->myName;
2230 aMeshOnEntity->myEntity = VISU::NODE_ENTITY;
2232 INITMSG(MYDEBUG,"LoadPoints - theMesh->myIsDone = "<<theMesh->myIsDone<<"'\n");
2234 //Check on loading already done
2235 if(theMesh->myIsDone)
2238 MED::EMaillage aType = theMesh->myMeshInfo->GetType();
2240 if(aType == MED::eNON_STRUCTURE){
2242 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
2243 TInt aNbElem = aNodeInfo->GetNbElem();
2245 VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
2246 aNamedPointCoords->Init(aNodeInfo, theMed->GetVersion());
2248 VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
2249 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
2251 aSubMesh->Init(MED::PElemInfo(aNodeInfo), theMed->GetVersion());
2252 aSubMesh->myNbCells = theMesh->myNbPoints;
2253 aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
2255 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2256 aCell2Connect.resize(aNbElem);
2257 for (int iElem = 0; iElem < aNbElem; iElem++)
2258 aCell2Connect[iElem] = VISU::TConnect(1,iElem);
2259 } // END NON_STRUCTURED
2260 else { // STRUCTURED
2262 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(theMesh->myMeshInfo);
2263 TInt aNbElem = aGrilleInfo->GetNbNodes();
2265 VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
2266 aNamedPointCoords->Init(aGrilleInfo);
2268 VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
2269 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
2271 aSubMesh->Init(aGrilleInfo);
2272 aSubMesh->myNbCells = theMesh->myNbPoints;
2273 aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
2275 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2276 aCell2Connect.resize(aNbElem);
2277 for(int iElem = 0; iElem < aNbElem; iElem++)
2278 aCell2Connect[iElem] = VISU::TConnect(1,iElem);
2282 theMesh->myIsDone = true;
2286 }catch(std::exception& exc){
2289 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2296 //---------------------------------------------------------------
2299 ::LoadPointsOnFamily(const MED::PWrapper& theMed,
2300 const VISU::PMEDMesh theMesh,
2301 const VISU::PMEDFamily theFamily)
2303 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPointsOnFamily");
2305 if(theFamily->myIsDone)
2308 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2309 MED::EMaillage aType = aMeshInfo->GetType();
2312 if(aType == MED::eNON_STRUCTURE){
2313 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
2314 TInt aNbElem = aNodeInfo->GetNbElem();
2317 TInt anId = theFamily->myId;
2318 VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
2319 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2320 if(aNodeInfo->GetFamNum(iElem) == anId)
2321 aSubMeshID.push_back(iElem);
2325 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo);
2326 TInt aNbElem = aGrilleInfo->GetNbNodes();
2329 TInt anId = theFamily->myId;
2330 VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
2331 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2332 if(aGrilleInfo->GetFamNumNode(iElem) == anId)
2333 aSubMeshID.push_back(iElem);
2337 theFamily->myIsDone = true;
2341 }catch(std::exception& exc){
2344 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2351 //---------------------------------------------------------------
2354 ::LoadCellsOnEntity(const MED::PWrapper& theMed,
2355 const VISU::PMEDMesh theMesh,
2356 const VISU::PMEDMeshOnEntity theMeshOnEntity)
2358 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnEntity");
2362 const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
2363 const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
2365 INITMSG(MYDEBUG,"LoadCellsOnEntity - aVEntity = "<<aVEntity<<"\n");
2367 if(theMeshOnEntity->myIsDone)
2370 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2372 MED::EMaillage aType = aMeshInfo->GetType();
2374 if(aType == MED::eSTRUCTURE){
2376 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo);
2377 TInt aNbPoints = aGrilleInfo->GetNbNodes();
2379 std::map<TInt,TInt> aNodeIdMap;
2380 EBooleen anIsNodeNum = MED::eFAUX;
2382 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2383 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2384 VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
2386 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2387 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2388 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2389 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"; aEGeom = "<<aEGeom<<"\n");
2391 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
2392 INITMSG(MYDEBUG,"aVNbNodes = "<<aVNbNodes<<"\n");
2394 TInt aNbElem = aGeom2SizeIter->second;//aGrilleInfo->GetNbCells();
2397 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2399 aSubMesh->Init(aGrilleInfo);
2400 aSubMesh->myNbCells = aNbElem;
2401 aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
2403 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2404 aCell2Connect.resize(aNbElem);
2406 TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
2407 VISU::TVector<TInt> aConnect(aMNbNodes);
2409 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2410 MED::TIntVector aConn = aGrilleInfo->GetConn(iElem, theMeshOnEntity->myEntity != VISU::CELL_ENTITY);
2411 VISU::TConnect& anArray = aCell2Connect[iElem];
2412 anArray.resize(aVNbNodes);
2415 for(TInt iConn = 0; iConn < aMNbNodes; iConn++){
2416 aConnect[iConn] = aNodeIdMap[aConn[iConn] - 1];
2419 for(int iConn = 0; iConn < aMNbNodes; ++iConn){
2420 aConnect[iConn] = aConn[iConn];
2426 anArray[0] = aConnect[0];
2427 anArray[1] = aConnect[2];
2428 anArray[2] = aConnect[3];
2429 anArray[3] = aConnect[1];
2432 anArray[0] = aConnect[0];
2433 anArray[1] = aConnect[2];
2434 anArray[2] = aConnect[3];
2435 anArray[3] = aConnect[1];
2436 anArray[4] = aConnect[4];
2437 anArray[5] = aConnect[6];
2438 anArray[6] = aConnect[7];
2439 anArray[7] = aConnect[5];
2442 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2443 anArray[iNode] = aConnect[iNode];
2446 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2447 if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
2448 EXCEPTION(std::runtime_error,"LoadCellsOnEntity - "<<
2449 " aNbPoints("<<aNbPoints<<") "<<
2450 "<= anArray["<<iElem<<"]"<<
2452 "("<<anArray[iNode]<<") < 0");
2458 theMeshOnEntity->myIsDone = true;
2464 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
2465 TInt aNbPoints = aNodeInfo->GetNbElem();
2467 std::map<TInt,TInt> aNodeIdMap;
2468 #ifdef _EDF_NODE_IDS_
2469 EBooleen anIsNodeNum = MED::eFAUX;
2471 EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
2473 for(TInt i = 0; i < aNbPoints; i++){
2474 aNodeIdMap[aNodeInfo->GetElemNum(i)-1] = i;
2479 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2480 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2481 VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
2483 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2484 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2485 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2486 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"; aEGeom = "<<aEGeom<<"\n");
2488 case MED::ePOLYGONE: {
2489 MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
2490 TInt aNbElem = aPolygoneInfo->GetNbElem();
2492 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2494 aSubMesh->Init(MED::PElemInfo(aPolygoneInfo),theMed->GetVersion());
2495 aSubMesh->myNbCells = aNbElem;
2497 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2498 aCell2Connect.resize(aNbElem);
2500 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2501 MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem);
2502 TInt aNbConn = aPolygoneInfo->GetNbConn(iElem);
2503 aSubMesh->myCellsSize += aNbConn;
2504 VISU::TConnect& anArray = aCell2Connect[iElem];
2505 anArray.resize(aNbConn);
2506 for(TInt iConn = 0; iConn < aNbConn; iConn++)
2507 anArray[iConn] = aConnSlice[iConn] - 1;
2512 case MED::ePOLYEDRE: {
2513 MED::PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
2514 TInt aNbElem = aPolyedreInfo->GetNbElem();
2517 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2519 aSubMesh->Init(MED::PElemInfo(aPolyedreInfo),theMed->GetVersion());
2520 aSubMesh->myNbCells = aNbElem;
2522 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2523 aCell2Connect.resize(aNbElem);
2525 for(TInt iElem = 0; iElem < aNbElem; iElem++){
2526 MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem);
2527 VISU::TConnect& anArray = aCell2Connect[iElem];
2528 typedef std::set<TInt> TConnectSet;
2529 TConnectSet aConnectSet;
2530 TInt aNbFaces = aConnSliceArr.size();
2531 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
2532 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
2533 TInt aNbConn = aConnSlice.size();
2534 aSubMesh->myCellsSize += aNbConn;
2535 for(TInt iConn = 0; iConn < aNbConn; iConn++){
2536 aConnectSet.insert(aConnSlice[iConn]);
2540 int aNbConn = aConnectSet.size();
2541 anArray.resize(aNbConn);
2542 TConnectSet::iterator anIter = aConnectSet.begin();
2543 for(int i = 0; anIter != aConnectSet.end(); anIter++, i++){
2544 TInt anId = *anIter;
2545 anArray[i] = anId - 1;
2553 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
2554 INITMSG(MYDEBUG,"aVNbNodes = "<<aVNbNodes<<"\n");
2556 MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
2557 TInt aNbElem = aCellInfo->GetNbElem();
2560 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2562 aSubMesh->Init(MED::PElemInfo(aCellInfo), theMed->GetVersion());
2563 aSubMesh->myNbCells = aNbElem;
2564 aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
2566 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2567 aCell2Connect.resize(aNbElem);
2569 TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
2570 VISU::TVector<TInt> aConnect(aMNbNodes);
2572 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2573 MED::TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
2574 VISU::TConnect& anArray = aCell2Connect[iElem];
2575 anArray.resize(aVNbNodes);
2578 for(TInt iConn = 0; iConn < aMNbNodes; iConn++){
2579 aConnect[iConn] = aNodeIdMap[aConnSlice[iConn] - 1];
2582 for(int iConn = 0; iConn < aMNbNodes; iConn++){
2583 aConnect[iConn] = aConnSlice[iConn] - 1;
2588 #if !(defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2590 anArray[0] = aConnect[0];
2591 anArray[2] = aConnect[1];
2593 anArray[1] = aConnect[2];
2596 #if !(defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2598 anArray[0] = aConnect[0];
2599 anArray[2] = aConnect[1];
2600 anArray[4] = aConnect[2];
2602 anArray[1] = aConnect[3];
2603 anArray[3] = aConnect[4];
2604 anArray[5] = aConnect[5];
2607 #if !(defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2609 anArray[0] = aConnect[0];
2610 anArray[2] = aConnect[1];
2611 anArray[4] = aConnect[2];
2612 anArray[6] = aConnect[3];
2614 anArray[1] = aConnect[4];
2615 anArray[3] = aConnect[5];
2616 anArray[5] = aConnect[6];
2617 anArray[7] = aConnect[7];
2620 #if (defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2622 anArray[0] = aConnect[0];
2623 anArray[1] = aConnect[2];
2624 anArray[2] = aConnect[1];
2625 anArray[3] = aConnect[3];
2627 anArray[4] = aConnect[6];
2628 anArray[5] = aConnect[5];
2629 anArray[6] = aConnect[4];
2631 anArray[7] = aConnect[7];
2632 anArray[8] = aConnect[9];
2633 anArray[9] = aConnect[8];
2637 anArray[0] = aConnect[0];
2638 anArray[1] = aConnect[2];
2639 anArray[2] = aConnect[1];
2640 anArray[3] = aConnect[3];
2642 #if (defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2644 anArray[0] = aConnect[0];
2645 anArray[1] = aConnect[3];
2646 anArray[2] = aConnect[2];
2647 anArray[3] = aConnect[1];
2648 anArray[4] = aConnect[4];
2650 anArray[5] = aConnect[8];
2651 anArray[6] = aConnect[7];
2652 anArray[7] = aConnect[6];
2653 anArray[8] = aConnect[5];
2655 anArray[9] = aConnect[9];
2656 anArray[10] = aConnect[12];
2657 anArray[11] = aConnect[11];
2658 anArray[12] = aConnect[10];
2662 anArray[0] = aConnect[0];
2663 anArray[1] = aConnect[3];
2664 anArray[2] = aConnect[2];
2665 anArray[3] = aConnect[1];
2666 anArray[4] = aConnect[4];
2669 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2670 anArray[iNode] = aConnect[iNode];
2672 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2673 if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
2674 EXCEPTION(std::runtime_error,"LoadCellsOnEntity - "<<
2675 " aNbPoints("<<aNbPoints<<") "<<
2676 "<= anArray["<<iElem<<"]"<<
2678 "("<<anArray[iNode]<<") < 0");
2684 // END NON_STRUCTURED
2686 theMeshOnEntity->myIsDone = true;
2691 }catch(std::exception& exc){
2694 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2702 //---------------------------------------------------------------
2705 ::LoadCellsOnFamily(const MED::PWrapper& theMed,
2706 const VISU::PMEDMesh theMesh,
2707 const VISU::PMEDMeshOnEntity theMeshOnEntity,
2708 const VISU::PMEDFamily theFamily)
2710 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnFamily");
2714 const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
2715 const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
2717 INITMSG(MYDEBUG,"LoadCellsOnFamily - aVEntity = "<<aVEntity<<"\n");
2719 if(theFamily->myIsDone)
2722 TInt anId = theFamily->myId;
2724 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2725 VISU::TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
2726 MED::EMaillage aType = aMeshInfo->GetType();
2728 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2729 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2730 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2731 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2732 if(aType == MED::eNON_STRUCTURE){
2733 MED::PElemInfo anElemInfo;
2735 case MED::ePOLYGONE: {
2736 anElemInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
2739 case MED::ePOLYEDRE: {
2740 anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
2744 anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
2748 if(TInt aNbElem = anElemInfo->GetNbElem()){
2749 VISU::TSubMeshID aSubMeshID;
2750 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2751 if(anElemInfo->GetFamNum(iElem) == anId)
2752 aSubMeshID.push_back(iElem);
2753 if(!aSubMeshID.empty()){
2754 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2755 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
2756 aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
2761 MED::PGrilleInfo anElemInfo = theMed->GetPGrilleInfo(aMeshInfo);
2763 TInt aNbElem = anElemInfo->GetNbCells();
2764 if(aNbElem>0 && (aMGeom == anElemInfo->GetGeom()) ){
2765 VISU::TSubMeshID aSubMeshID;
2766 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2767 if(anElemInfo->GetFamNum(iElem) == anId)
2768 aSubMeshID.push_back(iElem);
2769 if(!aSubMeshID.empty()){
2770 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2771 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
2772 aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
2779 theFamily->myIsDone = true;
2784 }catch(std::exception& exc){
2787 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2795 //---------------------------------------------------------------
2797 LoadProfile(const MED::PWrapper& theMed,
2798 VISU::PMEDMesh theMesh,
2799 MED::PTimeStampValueBase theTimeStampValue,
2800 VISU::TMEDValForTime& theValForTime,
2801 VISU::TMEDMeshOnEntity& theMeshOnEntity)
2803 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadProfile");
2804 INITMSG(MYDEBUG,"LoadProfile"<<endl);
2806 VISU::PMEDProfile aProfile = theValForTime.myProfile;
2807 if(aProfile->myIsDone)
2810 const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
2811 const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
2812 MED::TGeom2Profile::const_iterator anIter = aGeom2Profile.begin();
2813 for(; anIter != aGeom2Profile.end(); anIter++){
2814 MED::PProfileInfo aProfileInfo = anIter->second;
2815 MED::EGeometrieElement aMGeom = anIter->first;
2816 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2818 VISU::TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aEGeom);
2819 if(anIter2 != aGeom2SubProfile.end()){
2820 VISU::PMEDSubProfile aSubProfile = anIter2->second;
2822 MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
2823 if(!anElemNum.empty()){
2824 VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
2825 TInt aSize = anElemNum.size();
2826 aSubMeshID.resize(aSize);
2827 for(TInt anId = 0; anId < aSize; anId++)
2828 aSubMeshID[anId] = anElemNum[anId] - 1;
2832 "- aEGeom = "<<aEGeom<<
2833 "; aNbCells = "<<aSubProfile->mySubMeshID.size()<<
2838 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2840 VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
2841 MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
2843 const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
2844 VISU::TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
2845 for(; anIter != aGeom2SubProfile.end(); anIter++){
2846 const VISU::PMEDSubProfile& aSubProfile = anIter->second;
2847 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
2848 MED::PElemInfo anElemInfo;
2849 anElemInfo = theMed->GetPElemInfo(aMeshInfo,aMEntity,aMGeom);
2850 aSubProfile->myIsElemNum = anElemInfo->IsElemNum();
2851 aSubProfile->myElemNum = anElemInfo->myElemNum;
2855 aProfile->myIsDone = true;
2859 //---------------------------------------------------------------
2861 LoadGaussMesh(const MED::PWrapper& theMed,
2862 VISU::PMEDMesh theMesh,
2863 MED::PTimeStampValueBase theTimeStampValue,
2864 VISU::TMEDValForTime& theValForTime,
2865 VISU::TMEDMeshOnEntity& theMeshOnEntity)
2867 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadGaussMesh");
2868 INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
2870 // this part of code must be reimplemented in connection with GRILLE structures
2871 if(theMesh->myMeshInfo->GetType() == MED::eSTRUCTURE)
2872 EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
2874 VISU::PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
2875 if(!aGaussMesh || aGaussMesh->myIsDone)
2878 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2879 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
2881 VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
2882 MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
2884 const VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
2885 const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
2886 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
2888 VISU::TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin();
2889 for(; aSubMeshIter != aGeom2GaussSubMesh.end(); aSubMeshIter++){
2890 VISU::PMEDGaussSubMesh aGaussSubMesh = aSubMeshIter->second;
2891 VISU::EGeometry aEGeom = aSubMeshIter->first;
2893 if(aGaussSubMesh->myIsDone)
2896 VISU::PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
2897 const VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
2898 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
2900 MED::PPolygoneInfo aPolygoneInfo;
2901 MED::PPolyedreInfo aPolyedreInfo;
2902 MED::PCellInfo aCellInfo;
2903 MED::PElemInfo anElemInfo;
2906 case MED::ePOLYGONE:
2907 aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,
2910 anElemInfo = aPolygoneInfo;
2912 case MED::ePOLYEDRE:
2913 aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,
2916 anElemInfo = aPolyedreInfo;
2919 aCellInfo = theMed->GetPCellInfo(aMeshInfo,
2922 anElemInfo = aCellInfo;
2924 aGaussSubMesh->myIsElemNum = anElemInfo->IsElemNum();
2925 aGaussSubMesh->myElemNum = anElemInfo->myElemNum;
2928 bool anIsGaussCoord3D = false;
2929 MED::PGaussCoord aGaussCoordPtr(new MED::TGaussCoord());
2930 MED::TGaussCoord& aGaussCoord = *aGaussCoordPtr;
2932 MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
2933 if(aGaussIter != aGeom2Gauss.end()){
2934 VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss;
2935 MED::PGaussInfo aGaussInfo = aGauss->myGaussInfo;
2937 aName = aGaussInfo->GetName();
2938 if(!aSubMeshID.empty()){
2939 const std::string& aProfileName = aSubProfile->myName;
2940 MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed,
2943 const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
2944 anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo,
2951 anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo,
2957 if(!aSubMeshID.empty()){
2958 const std::string& aProfileName = aSubProfile->myName;
2959 MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed,
2962 const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
2964 case MED::ePOLYGONE:
2965 anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo,
2970 case MED::ePOLYEDRE:
2971 anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo,
2977 anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo,
2985 case MED::ePOLYGONE:
2986 anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo,
2990 case MED::ePOLYEDRE:
2991 anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo,
2996 anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo,
3002 if(anIsGaussCoord3D){
3003 VISU::TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
3004 VISU::TMEDGaussCoordHolder* aCoordHolder = new VISU::TMEDGaussCoordHolder();
3005 aCoordHolder->Init(aGaussCoordPtr);
3006 aCoords.Init(VISU::PCoordHolder(aCoordHolder));
3008 aGaussSubMesh->myIsDone = true;
3010 TInt aNbGauss = aGaussCoord.GetNbGauss();
3011 TInt aNbElem = aGaussCoord.GetNbElem();
3012 TInt aNbCells = aNbElem*aNbGauss;
3015 "- aEGeom = "<<aEGeom<<
3016 "; aName = '"<<aName<<"'"<<
3017 "; aStatus = "<<aGaussSubMesh->myStatus<<
3018 "; aNbElem = "<<aNbElem<<
3019 "; aNbGauss = "<<aNbGauss<<
3020 "; aNbCells = "<<aNbCells<<
3023 EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
3026 aGaussMesh->myIsDone = true;
3030 //---------------------------------------------------------------
3031 template<class TimeStampValueType>
3033 FillValForTime(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
3034 const VISU::TGeom2SubProfile& theGeom2SubProfile,
3035 VISU::PMEDValForTime theValForTime,
3036 VISU::PMEDField theField)
3038 if(theValForTime->myIsFilled)
3040 theField->myDataSize = 0;
3041 TInt aNbComp = theField->myNbComp;
3043 VISU::TGeom2SubProfile::const_iterator anIter = theGeom2SubProfile.begin();
3044 for(; anIter != theGeom2SubProfile.end(); anIter++) {
3045 VISU::EGeometry aEGeom = anIter->first;
3046 VISU::PMEDSubProfile aSubProfile(anIter->second);
3048 TInt aNbElem = aSubProfile->myNbCells;
3049 theField->myDataSize += aNbElem * aNbComp;
3051 if(aSubProfile->myStatus != VISU::eRemoveAll){
3052 TInt aNbGauss = theValForTime->GetNbGauss(aEGeom);
3055 "- aEGeom = "<<aEGeom<<
3056 "; aNbElem = "<<aNbElem<<
3057 "; aNbGauss = "<<aNbGauss<<
3060 VISU::PMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
3061 typedef typename TimeStampValueType::TElement TElement;
3062 typedef VISU::TTMEDMeshValue<TElement> TVMeshValue;
3063 TVMeshValue* aMeshValue = new TVMeshValue();
3065 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
3066 typedef typename TimeStampValueType::PTMeshValue PTMeshValue;
3067 PTMeshValue aMeshValuePtr = theTimeStampValue->GetMeshValuePtr(aMGeom);
3068 aMeshValue->Init(aNbElem, aNbGauss, aNbComp, aMeshValuePtr);
3069 aVMeshValue.reset(aMeshValue);
3072 theValForTime->myIsFilled = true;
3075 //---------------------------------------------------------------
3077 LoadValForTime(const MED::PWrapper& theMed,
3078 VISU::PMEDMesh theMesh,
3079 VISU::PMEDMeshOnEntity theMeshOnEntity,
3080 VISU::PMEDField theField,
3081 VISU::PMEDValForTime theValForTime,
3085 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTime");
3086 INITMSG(MYDEBUG,"LoadValForTime - theIsGauss = "<<theIsGauss<<endl);
3088 //Check on loading already done
3093 const std::string& aMeshName = theMeshOnEntity->myMeshName;
3094 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
3095 MED::PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,
3098 MED::TGeom2Size aGeom2Size;
3099 MED::EEntiteMaillage aMEntity;
3100 theMed->GetNbTimeStamps(aFieldInfo,
3101 theMesh->myEntityInfo,
3105 MED::PTimeStampInfo aTimeStampInfo =
3106 theMed->GetPTimeStampInfo(aFieldInfo,
3109 theValForTime->myId);
3111 MED::TKey2Gauss aKey2Gauss = GetKey2Gauss(theMed);
3112 MED::TMKey2Profile aMKey2Profile = GetMKey2Profile(theMed);
3114 MED::PTimeStampValueBase aTimeStampValue =
3115 theMed->GetPTimeStampValue(aTimeStampInfo,
3134 InitGaussMesh(aTimeStampValue,
3139 LoadGaussMesh(theMed,
3146 VISU::PMEDProfile aProfile = theValForTime->myProfile;
3147 VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
3150 "- aMeshName = '"<<aMeshName<<"'"<<
3151 "; aFieldName = '"<<aFieldInfo->GetName()<<"'"<<
3152 "; aMEntity = "<<aMEntity<<
3153 "; aNbComp = "<<theField->myNbComp<<
3156 if(aFieldInfo->GetType() == MED::eFLOAT64)
3157 FillValForTime<MED::TFloatTimeStampValue>(CastToFloatTimeStampValue(aTimeStampValue),
3162 FillValForTime<MED::TIntTimeStampValue>(CastToIntTimeStampValue(aTimeStampValue),
3172 //---------------------------------------------------------------
3175 ::LoadValForTimeOnMesh(const MED::PWrapper& theMed,
3176 VISU::PMEDMesh theMesh,
3177 VISU::PMEDMeshOnEntity theMeshOnEntity,
3178 VISU::PMEDField theField,
3179 VISU::PMEDValForTime theValForTime)
3181 VISU::PUnstructuredGridIDMapperImpl anUnstructuredGridIDMapper = theValForTime->myUnstructuredGridIDMapper;
3182 return LoadValForTime(theMed,
3188 anUnstructuredGridIDMapper->myIsVTKDone);
3192 //---------------------------------------------------------------
3195 ::LoadValForTimeOnGaussPts(const MED::PWrapper& theMed,
3196 VISU::PMEDMesh theMesh,
3197 VISU::PMEDMeshOnEntity theMeshOnEntity,
3198 VISU::PMEDField theField,
3199 VISU::PMEDValForTime theValForTime)
3201 VISU::PGaussPtsIDFilter aGaussPtsIDFilter = theValForTime->myGaussPtsIDFilter;
3202 return LoadValForTime(theMed,
3208 aGaussPtsIDFilter->myIsVTKDone);