1 // Copyright (C) 2007-2008 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
22 // VISU OBJECT : interactive object for VISU entities implementation
23 // File : VISU_MedConvertor.cxx
24 // Author : Alexey PETROV
27 #include "VISU_MedConvertor.hxx"
28 #include "VISU_ConvertorUtils.hxx"
30 #include "MED_Factory.hxx"
31 #include "MED_Algorithm.hxx"
32 #include "MED_GaussUtils.hxx"
33 #include "MED_Utilities.hxx"
35 #include "SALOMEconfig.h"
37 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
41 #include <Standard_Failure.hxx>
44 #include <Standard_ErrorHandler.hxx>
47 #include <vtkCellType.h>
59 static int MYDEBUG = 0;
60 static int MYVALUEDEBUG = 0;
61 static int MY_FAMILY_DEBUG = 0;
62 static int MY_GROUP_DEBUG = 0;
65 static int MYDEBUG = 0;
66 static int MYVALUEDEBUG = 0;
67 static int MY_FAMILY_DEBUG = 0;
68 static int MY_GROUP_DEBUG = 0;
71 #define _LOAD_FAMILIES_
72 #define _EDF_NODE_IDS_
78 //---------------------------------------------------------------
80 MEDGeom2NbNodes(MED::EGeometrieElement theMEDGeomType)
82 return theMEDGeomType % 100;
86 //---------------------------------------------------------------
88 MEDGeom2VISU(MED::EGeometrieElement theGeom)
91 case MED::ePOINT1: return VISU::ePOINT1;
92 case MED::eSEG2: return VISU::eSEG2;
93 case MED::eTRIA3: return VISU::eTRIA3;
94 case MED::eQUAD4: return VISU::eQUAD4;
95 case MED::eTETRA4: return VISU::eTETRA4;
96 case MED::eHEXA8: return VISU::eHEXA8;
97 case MED::ePENTA6: return VISU::ePENTA6;
98 case MED::ePYRA5: return VISU::ePYRA5;
100 case MED::eSEG3: return VISU::eSEG3;
101 case MED::eTRIA6: return VISU::eTRIA6;
102 case MED::eQUAD8: return VISU::eQUAD8;
103 case MED::eTETRA10: return VISU::eTETRA10;
104 case MED::eHEXA20: return VISU::eHEXA20;
105 case MED::ePENTA15: return VISU::ePENTA15;
106 case MED::ePYRA13: return VISU::ePYRA13;
108 case MED::ePOLYGONE: return VISU::ePOLYGONE;
109 case MED::ePOLYEDRE: return VISU::ePOLYEDRE;
115 //---------------------------------------------------------------
116 MED::EGeometrieElement
117 VISUGeom2MED(int theGeom)
120 case VISU::ePOINT1: return MED::ePOINT1;
121 case VISU::eSEG2: return MED::eSEG2;
122 case VISU::eTRIA3: return MED::eTRIA3;
123 case VISU::eQUAD4: return MED::eQUAD4;
124 case VISU::eTETRA4: return MED::eTETRA4;
125 case VISU::eHEXA8: return MED::eHEXA8;
126 case VISU::ePENTA6: return MED::ePENTA6;
127 case VISU::ePYRA5: return MED::ePYRA5;
129 case VISU::eSEG3: return MED::eSEG3;
130 case VISU::eTRIA6: return MED::eTRIA6;
131 case VISU::eQUAD8: return MED::eQUAD8;
132 case VISU::eTETRA10: return MED::eTETRA10;
133 case VISU::eHEXA20: return MED::eHEXA20;
134 case VISU::ePENTA15: return MED::ePENTA15;
135 case VISU::ePYRA13: return MED::ePYRA13;
137 case VISU::ePOLYGONE: return MED::ePOLYGONE;
138 case VISU::ePOLYEDRE: return MED::ePOLYEDRE;
140 return MED::EGeometrieElement(-1);
144 //---------------------------------------------------------------
146 MEDEntityToVTK( MED::EEntiteMaillage theMEDEntity )
148 VISU::TEntity anEntity = VISU::TEntity( -1 );
150 switch(theMEDEntity){
152 anEntity = VISU::NODE_ENTITY;
155 anEntity = VISU::EDGE_ENTITY;
158 anEntity = VISU::FACE_ENTITY;
161 anEntity = VISU::CELL_ENTITY;
163 case MED::eNOEUD_ELEMENT :
164 anEntity = VISU::CELL_ENTITY;
172 //---------------------------------------------------------------
174 VTKEntityToMED(VISU::TEntity theVTKEntity)
176 switch(theVTKEntity){
177 case VISU::NODE_ENTITY: return MED::eNOEUD;
178 case VISU::EDGE_ENTITY: return MED::eARETE;
179 case VISU::FACE_ENTITY: return MED::eFACE;
180 case VISU::CELL_ENTITY: return MED::eMAILLE;
182 return MED::EEntiteMaillage(-1);
186 //---------------------------------------------------------------
188 CrSubProfile(const MED::PWrapper& theMEDWrapper,
189 const MED::PMeshInfo& theMeshInfo,
190 MED::EEntiteMaillage theMEntity,
191 MED::EGeometrieElement theMGeom,
192 const MED::TGeom2Size& theGeom2Size,
193 const MED::TGeom2Profile& theGeom2Profile)
195 VISU::EGeometry aEGeom = MEDGeom2VISU(theMGeom);
196 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
198 VISU::PMEDSubProfile aSubProfile(new VISU::TMEDSubProfile());
199 aSubProfile->myGeom = aEGeom;
200 aSubProfile->myMGeom = theMGeom;
201 aSubProfile->myStatus = VISU::eAddAll;
203 MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(theMGeom);
204 if(aTimeStampIter == theGeom2Size.end())
205 aSubProfile->myStatus = VISU::eRemoveAll;
207 MED::TGeom2Profile::const_iterator aProfileIter = theGeom2Profile.find(theMGeom);
208 if(aProfileIter != theGeom2Profile.end()){
209 MED::PProfileInfo aProfileInfo = aProfileIter->second;
211 aSubProfile->myName = aProfileInfo->GetName();
212 aSubProfile->myStatus = VISU::eAddPart;
214 const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
215 TInt aNbElem = anElemNum.size();
216 aSubProfile->myNbCells = aNbElem;
218 case MED::ePOLYGONE: {
219 MED::PPolygoneInfo aPolygoneInfo =
220 theMEDWrapper->GetPPolygoneInfo(theMeshInfo,theMEntity,theMGeom);
221 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
222 TInt aNbConn = aPolygoneInfo->GetNbConn( anElemNum[ anElemId ] - 1 );
223 aSubProfile->myCellsSize += aNbConn;
227 case MED::ePOLYEDRE: {
228 MED::PPolyedreInfo aPolyedreInfo =
229 theMEDWrapper->GetPPolyedreInfo(theMeshInfo,theMEntity,theMGeom);
230 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
231 MED::TCConnSliceArr aConnSliceArr =
232 aPolyedreInfo->GetConnSliceArr( anElemNum[ anElemId ] - 1 );
233 TInt aNbFaces = aConnSliceArr.size();
235 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
236 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
237 TInt aNbConn = aConnSlice.size();
238 aCellSize += aNbConn;
240 aSubProfile->myCellsSize += aCellSize;
245 aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes;
248 TInt aNbElem = aTimeStampIter->second;
249 aSubProfile->myNbCells = aNbElem;
251 case MED::ePOLYGONE: {
252 MED::PPolygoneInfo aPolygoneInfo =
253 theMEDWrapper->GetPPolygoneInfo(theMeshInfo,theMEntity,theMGeom);
254 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
255 TInt aNbConn = aPolygoneInfo->GetNbConn(anElemId);
256 aSubProfile->myCellsSize += aNbConn;
260 case MED::ePOLYEDRE: {
261 MED::PPolyedreInfo aPolyedreInfo =
262 theMEDWrapper->GetPPolyedreInfo(theMeshInfo,theMEntity,theMGeom);
263 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
264 MED::TCConnSliceArr aConnSliceArr =
265 aPolyedreInfo->GetConnSliceArr(anElemId);
266 TInt aNbFaces = aConnSliceArr.size();
268 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
269 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
270 TInt aNbConn = aConnSlice.size();
271 aCellSize += aNbConn;
273 aSubProfile->myCellsSize += aCellSize;
278 aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes;
283 "- aMGeom = "<<theMGeom<<
284 "; aEGeom = "<<aEGeom<<
285 "; aName = '"<<aSubProfile->myName<<"'"<<
286 "; aStatus = "<<aSubProfile->myStatus<<
287 "; aNbCells = "<<aSubProfile->myNbCells<<
288 "; aCellsSize = "<<aSubProfile->myCellsSize<<
295 //---------------------------------------------------------------
297 GetProfileKey(const MED::PWrapper& theMEDWrapper,
298 const MED::PMeshInfo& theMeshInfo,
299 const MED::PTimeStampValueBase& theTimeStampValue,
300 const VISU::TMEDMeshOnEntity& theMeshOnEntity,
301 MED::EEntiteMaillage theMEntity,
302 const MED::TGeom2Size& theGeom2Size)
304 INITMSG(MYDEBUG,"GetProfileKey"<<endl);
306 VISU::TProfileKey aProfileKey;
307 const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
309 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
310 MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin();
311 for(; anIter != aGeom2Size.end(); anIter++){
312 MED::EGeometrieElement aMGeom = anIter->first;
313 VISU::PSubProfile aSubProfile = CrSubProfile(theMEDWrapper,
319 aProfileKey.insert(aSubProfile);
326 //---------------------------------------------------------------
328 InitProfile(const MED::PWrapper& theMEDWrapper,
329 const MED::PMeshInfo& theMeshInfo,
330 MED::PTimeStampValueBase& theTimeStampValue,
331 VISU::TMEDMeshOnEntity& theMeshOnEntity,
332 MED::EEntiteMaillage theMEntity,
333 const MED::TGeom2Size& theGeom2Size,
334 VISU::TMEDValForTime& theValForTime)
336 VISU::TTimerLog aTimerLog(MYDEBUG,"InitProfile");
337 INITMSG(MYDEBUG,"InitProfile"<<endl);
339 VISU::TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap;
341 VISU::TProfileKey aProfileKey = GetProfileKey(theMEDWrapper,
348 VISU::TProfileMap::const_iterator anIter = aProfileMap.find(aProfileKey);
349 if(anIter != aProfileMap.end()){
350 theValForTime.myProfile = anIter->second;
351 INITMSG(MYDEBUG,"aProfileMap.find(aProfileKey)"<<endl);
353 VISU::PMEDProfile aProfile(new VISU::TMEDProfile());
354 VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
356 VISU::TProfileKey::const_iterator anIter = aProfileKey.begin();
357 for(; anIter != aProfileKey.end(); anIter++){
358 VISU::PMEDSubProfile aSubProfile(*anIter);
360 if(aProfile->myIsAll && aSubProfile->myStatus != VISU::eAddAll)
361 aProfile->myIsAll = false;
363 VISU::EGeometry aEGeom = aSubProfile->myGeom;
364 aGeom2SubProfile[aEGeom] = aSubProfile;
367 aProfileMap[aProfileKey] = aProfile;
368 theValForTime.myProfile = aProfile;
373 //---------------------------------------------------------------
375 GetGaussKey(const MED::PTimeStampValueBase& theTimeStampValue,
376 const VISU::TMEDMeshOnEntity& theMeshOnEntity,
377 const MED::TGeom2Size& theGeom2Size,
378 VISU::TMEDValForTime& theValForTime)
380 VISU::TTimerLog aTimerLog(MYDEBUG,"GetGaussKey");
381 INITMSG(MYDEBUG,"GetGaussKey"<<endl);
383 VISU::TGaussKey aGaussKey;
384 VISU::PMEDProfile aProfile = theValForTime.myProfile;
385 VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
387 const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
388 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
390 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
391 MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin();
392 for(; anIter != aGeom2Size.end(); anIter++){
393 MED::EGeometrieElement aMGeom = anIter->first;
394 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
396 VISU::TGeom2SubProfile::iterator anIter2 = aGeom2SubProfile.find(aEGeom);
397 if(anIter2 == aGeom2SubProfile.end()){
398 INITMSG(MYDEBUG,"anIter2 == aGeom2SubProfile.end!!"<<endl);
401 VISU::PMEDSubProfile aSubProfile = anIter2->second;
403 MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(aMGeom);
404 if(aTimeStampIter != theGeom2Size.end()){
405 TInt aNbCells = aTimeStampIter->second;
406 if(aSubProfile->myStatus == VISU::eAddPart)
407 aNbCells = aSubProfile->myNbCells;
409 VISU::PMEDGaussSubMesh aGaussSubMesh(new VISU::TMEDGaussSubMesh());
410 aGaussSubMesh->mySubProfile = aSubProfile;
411 aGaussSubMesh->myStatus = aSubProfile->myStatus;
413 VISU::PMEDGauss aGauss(new VISU::TMEDGauss());
414 aGaussSubMesh->myGauss = aGauss;
415 aGauss->myGeom = aEGeom;
416 aGauss->myNbPoints = 1;
418 MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
419 if(aGaussIter != aGeom2Gauss.end()){
420 MED::PGaussInfo aGaussInfo = aGaussIter->second;
421 aGauss->myGaussInfo = aGaussInfo;
422 aGauss->myName = aGaussInfo->GetName();
423 aGauss->myNbPoints = aGaussInfo->GetNbGauss();
424 } else if ( aTimeStampInfo.GetNbGauss(aMGeom) > 1 )
425 EXCEPTION( std::runtime_error, "aGaussIter == aGeom2Gauss.end()"
426 " && aTimeStampInfo.GetNbGauss(aMGeom) > 1 !!!" );
428 aGaussSubMesh->myNbCells = aNbCells*aGauss->myNbPoints;
429 aGaussSubMesh->myCellsSize = aGaussSubMesh->myNbCells*2;
431 aGaussKey.insert(aGaussSubMesh);
434 "- aEGeom = "<<aGauss->myGeom<<
435 "; aName = '"<<aGauss->myName<<"'"<<
436 "; aNbGauss = "<<aGauss->myNbPoints<<
437 "; aStatus = "<<aGaussSubMesh->myStatus<<
438 "; aNbCells = "<<aGaussSubMesh->myNbCells<<
439 "; aCellsSize = "<<aGaussSubMesh->myCellsSize<<
450 //---------------------------------------------------------------
452 InitGaussMesh(MED::PTimeStampValueBase& theTimeStampValue,
453 VISU::TMEDMeshOnEntity& theMeshOnEntity,
454 const MED::TGeom2Size& theGeom2Size,
455 VISU::TMEDValForTime& theValForTime)
457 VISU::TTimerLog aTimerLog(MYDEBUG,"InitGaussMesh");
458 INITMSG(MYDEBUG,"InitGaussMesh"<<endl);
460 if(theMeshOnEntity.myEntity == VISU::NODE_ENTITY)
463 VISU::TGaussMeshMap& aGaussMeshMap = theMeshOnEntity.myGaussMeshMap;
465 VISU::TGaussKey aGaussKey = GetGaussKey(theTimeStampValue,
470 VISU::TGaussMeshMap::const_iterator anIter = aGaussMeshMap.find(aGaussKey);
471 if(anIter != aGaussMeshMap.end()){
472 theValForTime.myGaussMesh = anIter->second;
473 INITMSG(MYDEBUG,"aGaussMeshMap.find(aGaussKey)"<<endl);
475 VISU::PMEDGaussMesh aGaussMesh(new VISU::TMEDGaussMesh());
476 VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
478 VISU::TGaussKey::const_iterator anIter = aGaussKey.begin();
479 for(; anIter != aGaussKey.end(); anIter++){
480 VISU::PMEDGaussSubMesh aGaussSubMesh(*anIter);
481 VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss;
482 VISU::EGeometry aEGeom = aGauss->myGeom;
483 aGeom2GaussSubMesh[aEGeom] = aGaussSubMesh;
487 VISU::TGaussSubMeshArr& aGaussSubMeshArr = aGaussMesh->myGaussSubMeshArr;
488 aGaussSubMeshArr.resize(aGeom2GaussSubMesh.size());
489 VISU::TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
490 for(TInt anID = 0; anIter != aGeom2GaussSubMesh.end(); anIter++, anID++){
491 const VISU::PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
492 aGaussSubMeshArr[anID] = aGaussSubMesh;
495 INITMSG(MYDEBUG,"aGaussMeshMap[aGaussKey] = aGaussMesh"<<std::endl);
496 aGaussMeshMap[aGaussKey] = aGaussMesh;
497 theValForTime.myGaussMesh = aGaussMesh;
501 //---------------------------------------------------------------
503 BuildMeshOnEntityMap(VISU::PMEDMesh theMesh,
504 const MED::TEntityInfo& theEntityInfo,
505 const MED::PNodeInfo& theNodeInfo,
506 const MED::PWrapper& theMEDWrapper)
508 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMeshOnEntityMap");
509 INITMSG(MYDEBUG,"BuildMeshOnEntityMap"<<endl);
511 MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
512 const std::string& aMeshName = theMesh->myName;
513 VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
514 MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
515 for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
516 const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
517 const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
519 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
520 VISU::PMEDMeshOnEntity aMeshOnEntity =
521 aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
522 aMeshOnEntity->myEntity = aVEntity;
523 aMeshOnEntity->myMeshName = aMeshName;
524 aMeshOnEntity->myGeom2Size = aGeom2Size;
525 VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
526 VISU::TGeom2ElemID2FamilyID& aGeom2ElemID2FamilyID = aMeshOnEntity->myGeom2ElemID2FamilyID;
529 "- aMEntity = "<<aMEntity<<
530 "; aVEntity = "<<aVEntity<<
533 if(aMEntity == MED::eNOEUD){
534 aMeshOnEntity->myNbCells = theMesh->myNbPoints;
535 aMeshOnEntity->myCellsSize = 2*theMesh->myNbPoints;
537 VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[MED::ePOINT1];
539 for(TInt iElem = 0; iElem < theMesh->myNbPoints; iElem++){
540 TInt aFamId = theNodeInfo->GetFamNum(iElem);
542 aFamilyID2CellsSize[aFamId] += 2;
543 anElemID2FamilyID[iElem] = aFamId;
547 "- myNbCells = "<<aMeshOnEntity->myNbCells<<
548 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
552 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
553 aMeshOnEntity->myNbCells = 0;
554 aMeshOnEntity->myCellsSize = 0;
555 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
556 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
558 VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom];
560 case MED::ePOLYGONE: {
561 MED::PPolygoneInfo aPolygoneInfo = theMEDWrapper->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
562 TInt aNbElem = aPolygoneInfo->GetNbElem();
565 "- aMGeom = "<<aMGeom<<
566 "; aNbElem = "<<aNbElem<<
569 aMeshOnEntity->myNbCells += aNbElem;
570 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
571 TInt aNbConn = aPolygoneInfo->GetNbConn(anElemId);
572 aMeshOnEntity->myCellsSize += aNbConn;
573 TInt aFamId = aPolygoneInfo->GetFamNum(anElemId);
575 aFamilyID2CellsSize[aFamId] += aNbConn + 1;
576 anElemID2FamilyID[anElemId] = aFamId;
580 case MED::ePOLYEDRE: {
581 MED::PPolyedreInfo aPolyedreInfo = theMEDWrapper->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
582 TInt aNbElem = aPolyedreInfo->GetNbElem();
585 "- aMGeom = "<<aMGeom<<
586 "; aNbElem = "<<aNbElem<<
589 aMeshOnEntity->myNbCells += aNbElem;
590 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
591 MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(anElemId);
592 TInt aNbFaces = aConnSliceArr.size();
594 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
595 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
596 TInt aNbConn = aConnSlice.size();
597 aCellSize += aNbConn;
599 aMeshOnEntity->myCellsSize += aCellSize;
600 TInt aFamId = aPolyedreInfo->GetFamNum(anElemId);
602 aFamilyID2CellsSize[aFamId] += aCellSize + 1;
603 anElemID2FamilyID[anElemId] = aFamId;
608 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
609 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
610 MED::PCellInfo aCellInfo = theMEDWrapper->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
611 TInt aNbElem = aCellInfo->GetNbElem();
612 aMeshOnEntity->myNbCells += aNbElem;
613 aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
616 "- aMGeom = "<<aMGeom<<
617 "; aNbElem = "<<aNbElem<<
618 "; myNbCells = "<<aMeshOnEntity->myNbCells<<
619 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
622 for(TInt iElem = 0; iElem < aNbElem; iElem++){
623 TInt aFamId = aCellInfo->GetFamNum(iElem);
625 aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
626 anElemID2FamilyID[iElem] = aFamId;
628 }} // end switch(...)
634 //---------------------------------------------------------------
636 BuildMeshGrilleOnEntityMap(VISU::PMEDMesh theMesh,
637 const MED::TEntityInfo& theEntityInfo,
638 const MED::PGrilleInfo& theGrilleInfo,
639 const MED::PWrapper& theMEDWrapper)
641 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMeshGrilleOnEntityMap");
642 INITMSG(MYDEBUG,"BuildMeshGrilleOnEntityMap"<<endl);
644 MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
645 const std::string& aMeshName = theMesh->myName;
646 VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
647 MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
649 VISU::TStructuredId& aGrilleStructure = theMesh->myGrilleStructure;
650 if ( theGrilleInfo->GetGrilleType() != MED::eGRILLE_STANDARD )
651 for ( int aDimId = 0; aDimId < theMesh->myDim; aDimId++ )
652 aGrilleStructure[aDimId] = theGrilleInfo->GetNbIndexes(aDimId);
654 MED::TIntVector aVector = theGrilleInfo->GetGrilleStructure();
655 for ( int aDimId = 0; aDimId < aVector.size(); aDimId++ )
656 aGrilleStructure[aDimId] = aVector[aDimId];
659 int kMax = aGrilleStructure[2];
660 int jMax = aGrilleStructure[1];
661 int iMax = aGrilleStructure[0];
664 VISU::TObj2StructuredId& aObj2StructuredId = theMesh->myObj2StructuredId;
665 switch ( theMesh->myDim ) {
667 for ( int i = 1; i <= iMax; i++ )
668 aObj2StructuredId[i-1][0] = i;
671 for ( int j = 1; j <= jMax; j++ )
672 for ( int i = 1; i <= iMax; i++ ) {
673 aObj2StructuredId[iii][0] = i;
674 aObj2StructuredId[iii][1] = j;
679 for ( int k = 1; k <= kMax; k++ )
680 for ( int j = 1; j <= jMax; j++ )
681 for ( int i = 1; i <= iMax; i++ ) {
682 aObj2StructuredId[iii][0] = i;
683 aObj2StructuredId[iii][1] = j;
684 aObj2StructuredId[iii][2] = k;
689 for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
690 const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
691 const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
693 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
694 VISU::PMEDMeshOnEntity aMeshOnEntity =
695 aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
696 aMeshOnEntity->myEntity = aVEntity;
697 aMeshOnEntity->myMeshName = aMeshName;
698 aMeshOnEntity->myGeom2Size = aGeom2Size;
699 VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
700 VISU::TGeom2ElemID2FamilyID& aGeom2ElemID2FamilyID = aMeshOnEntity->myGeom2ElemID2FamilyID;
703 "- aMEntity = "<<aMEntity<<
704 "; aVEntity = "<<aVEntity<<
707 if(aMEntity == MED::eNOEUD){
708 aMeshOnEntity->myNbCells = theGrilleInfo->GetNbNodes();
709 aMeshOnEntity->myCellsSize = 2*theGrilleInfo->GetNbNodes();
711 VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[MED::ePOINT1];
713 if((theGrilleInfo->myFamNumNode).size() > 0)
714 for(TInt iElem = 0; iElem < theGrilleInfo->GetNbNodes(); iElem++){
715 TInt aFamId = theGrilleInfo->GetFamNumNode(iElem);
717 aFamilyID2CellsSize[aFamId] += 2;
718 anElemID2FamilyID[iElem] = aFamId;
722 "- myNbCells = "<<aMeshOnEntity->myNbCells<<
723 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
727 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
728 aMeshOnEntity->myNbCells = 0;
729 aMeshOnEntity->myCellsSize = 0;
730 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
731 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
732 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
733 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
734 TInt aNbElem = aGeom2SizeIter->second;//theGrilleInfo->GetNbCells();
735 aMeshOnEntity->myNbCells += aNbElem;
736 aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
738 VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom];
741 "- aMGeom = "<<aMGeom<<
742 "; aNbElem = "<<aNbElem<<
743 "; myNbCells = "<<aMeshOnEntity->myNbCells<<
744 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
747 if((theGrilleInfo->myFamNum).size() > 0)
748 for(TInt iElem = 0; iElem < aNbElem; iElem++){
749 TInt aFamId = theGrilleInfo->GetFamNum(iElem);
751 aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
752 anElemID2FamilyID[iElem] = aFamId;
760 //---------------------------------------------------------------
762 BuildFieldMap(VISU::PMEDMesh theMesh,
763 const MED::TEntityInfo& theEntityInfo,
764 MED::PWrapper theMEDWrapper)
766 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFieldMap");
767 TInt aNbFields = theMEDWrapper->GetNbFields();
768 MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
769 const std::string& aMeshName = theMesh->myName;
770 INITMSG(MYDEBUG,"BuildFieldMap: aNbFields = "<<aNbFields<<"\n");
771 for(TInt iField = 1; iField <= aNbFields; iField++){
772 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPFieldInfo");
774 MED::TErr anError = 0;
775 MED::PFieldInfo aFieldInfo = theMEDWrapper->GetPFieldInfo(aMeshInfo, iField, &anError);
779 TInt aNbComp = aFieldInfo->GetNbComp();
780 std::string aFieldName = aFieldInfo->GetName();
782 MED::TGeom2Size aGeom2Size;
783 MED::EEntiteMaillage aMEntity;
784 TInt aNbTimeStamps = theMEDWrapper->GetNbTimeStamps(aFieldInfo,
788 if(aNbTimeStamps < 1)
791 VISU::TEntity aVEntity = MEDEntityToVTK( aMEntity );
792 vtkIdType aDataType = VTK_DOUBLE;
793 if ( aFieldInfo->GetType() != MED::eFLOAT64 ) {
794 #if defined(HAVE_F77INT64)
795 aDataType = VTK_LONG;
800 VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
801 VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
802 VISU::PMEDField aField = aFieldMap[aFieldName](new VISU::TMEDField());
803 aField->myId = iField;
804 aField->Init(aNbComp, aDataType);
805 aField->myEntity = aVEntity;
806 aField->myName = aFieldName;
807 aField->myMeshName = aMeshName;
808 aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
809 aField->myIsELNO = ( aMEntity == MED::eNOEUD_ELEMENT );
811 INITMSG(MYDEBUG,"myName = '"<<aField->myName<<"'"<<
812 "; myId = "<<aField->myId<<
813 "; myEntity = "<<aField->myEntity<<
814 "; myDataSize = "<<aField->myDataSize<<
815 "; myNbComp = "<<aField->myNbComp<<"\n");
817 for(TInt iComp = 0; iComp < aNbComp; iComp++){
818 aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
819 aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
822 for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
823 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPTimeStampInfo");
825 MED::TErr anError = 0;
826 MED::PTimeStampInfo aTimeStampInfo = theMEDWrapper->GetPTimeStampInfo(aFieldInfo,
834 TFloat aDt = aTimeStampInfo->GetDt();
835 std::string anUnitDt = aTimeStampInfo->GetUnitDt();
837 VISU::TValField& aValField = aField->myValField;
838 VISU::PMEDValForTime aValForTime = aValField[iTimeStamp](new VISU::TMEDValForTime());
839 aValForTime->myId = iTimeStamp;
840 aValForTime->myFieldName = aField->myName;
841 aValForTime->myEntity = aField->myEntity;
842 aValForTime->myMeshName = aField->myMeshName;
843 aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
844 INITMSG(MYDEBUG,"aDt = '"<<aDt<<", "<<anUnitDt<<"'\n");
846 VISU::TGeom2NbGauss& aVGeom2NbGauss = aValForTime->myGeom2NbGauss;
847 const MED::TGeom2NbGauss& aMGeom2NbGauss = aTimeStampInfo->myGeom2NbGauss;
848 MED::TGeom2NbGauss::const_iterator anIter = aMGeom2NbGauss.begin();
849 for(; anIter != aMGeom2NbGauss.end(); anIter++){
850 const MED::EGeometrieElement& aMGeom = anIter->first;
851 VISU::EGeometry aEGeom = MEDGeom2VISU( aMGeom );
852 TInt aNbGauss = anIter->second;
853 aVGeom2NbGauss[ aEGeom ] = aNbGauss;
855 // ELNO data should satisfy the following condition ( implicitly )
856 vtkIdType aNbNodes = MEDGeom2NbNodes( aMGeom );
857 aField->myIsELNO &= ( aNbGauss == aNbNodes );
864 //---------------------------------------------------------------
866 BuildFamilyMap(VISU::PMEDMesh theMesh,
867 const MED::TEntityInfo& theEntityInfo,
868 const MED::TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo,
869 const MED::TFamilyInfoSet& theFamilyInfoSet,
870 MED::PWrapper theMEDWrapper)
872 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFamilyMap");
873 INITMSG(MYDEBUG,"BuildFamilyMap\n");
875 MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
876 MED::TEntity2FamilySet aEntity2FamilySet = MED::GetEntity2FamilySet(theMEDWrapper,theEntity2TGeom2ElemInfo,theFamilyInfoSet);
877 MED::TEntity2FamilySet::const_iterator aEntity2FamilySetIter = aEntity2FamilySet.begin();
878 for(; aEntity2FamilySetIter != aEntity2FamilySet.end(); aEntity2FamilySetIter++){
879 const MED::EEntiteMaillage& aMEntity = aEntity2FamilySetIter->first;
880 const MED::TFamilyTSizeSet& aFamilyTSizeSet = aEntity2FamilySetIter->second;
882 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
883 VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
884 const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
885 VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
886 VISU::TFamilyIDMap& aFamilyIDMap = aMeshOnEntity->myFamilyIDMap;
888 if(aFamilyTSizeSet.empty())
891 INITMSG(MY_FAMILY_DEBUG,
892 "- aMEntity = "<<aMEntity<<
893 "; aVEntity = "<<aVEntity<<
896 MED::TFamilyTSizeSet::const_iterator aFamilyTSizeSetIter = aFamilyTSizeSet.begin();
897 for(; aFamilyTSizeSetIter != aFamilyTSizeSet.end(); aFamilyTSizeSetIter++){
898 const MED::TFamilyTSize& aFamilyTSize = *aFamilyTSizeSetIter;
899 const MED::PFamilyInfo& aFamilyInfo = boost::get<0>(aFamilyTSize);
900 TInt aSize = boost::get<1>(aFamilyTSize);
901 TInt anId = aFamilyInfo->GetId();
905 std::string aFamilyName = aFamilyInfo->GetName();
907 VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily());
908 aFamily->myId = anId;
909 aFamily->myEntity = aVEntity;
910 aFamily->myName = aFamilyName;
911 aFamily->myNbCells = aSize;
913 aFamily->myCellsSize = 0;
914 VISU::TFamilyID2CellsSize::const_iterator anIter = aFamilyID2CellsSize.find(anId);
915 if(anIter != aFamilyID2CellsSize.end())
916 aFamily->myCellsSize = anIter->second;
918 const TInt aNbGroup = aFamilyInfo->GetNbGroup();
919 VISU::TNames& aGroupNames = aFamily->myGroupNames;
920 aGroupNames.resize(aNbGroup);
921 for(TInt i = 0; i < aNbGroup; i++){
922 std::string aGroupName = aFamilyInfo->GetGroupName(i);
923 aGroupNames[i] = aGroupName;
926 aFamilyIDMap[anId] = aFamily;
928 INITMSG(MY_FAMILY_DEBUG,
929 "- aFamilyName = '"<<aFamilyName<<"'"<<
930 "; myId = "<<aFamily->myId<<"; "<<
931 "; aNbAttr = "<<aFamilyInfo->GetNbAttr()<<
932 "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
933 "; aVEntity = "<<aVEntity<<
934 "; myNbCells = "<<aFamily->myNbCells<<
935 "; myCellsSize = "<<aFamily->myCellsSize<<
938 for(TInt i = 0; i < aNbGroup; i++){
939 std::string aGroupName = aFamilyInfo->GetGroupName(i);
940 INITMSG(MY_FAMILY_DEBUG,"- aGroupName = '"<<aGroupName<<"'\n");
950 * Build grille family map
953 BuildGrilleFamilyMap(VISU::PMEDMesh theMesh,
954 const MED::TEntityInfo& theEntityInfo,
955 const MED::TFamilyInfoSet& theFamilyInfoSet,
956 MED::PWrapper theMEDWrapper)
958 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGrilleFamilyMap");
959 INITMSG(MYDEBUG,"BuildGrilleFamilyMap\n");
961 VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
963 MED::TEntityInfo::const_iterator aEntityIter = theEntityInfo.begin();
965 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
966 MED::PGrilleInfo aGrilleInfo = theMEDWrapper->GetPGrilleInfo(aMeshInfo);
968 const MED::TFamilyID2NbCells& aFam2NbCells = MED::GetFamilyID2NbCells(aGrilleInfo);
970 MED::TFamilyInfoSet::const_iterator aFamInter = theFamilyInfoSet.begin();
971 for(; aFamInter != theFamilyInfoSet.end(); aFamInter++){
972 const MED::PFamilyInfo& aFamilyInfo = *aFamInter;
973 TInt anId = aFamilyInfo->GetId();
978 std::string aFamilyName = aFamilyInfo->GetName();
979 const MED::EEntiteMaillage& aMEntity = MED::GetEntityByFamilyId(aGrilleInfo,
981 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
983 VISU::PMEDMeshOnEntity aMeshOnEntity;
984 VISU::TMeshOnEntityMap::iterator aMeshOnEntityIter = aMeshOnEntityMap.find(aVEntity);
985 if(aMeshOnEntityIter != aMeshOnEntityMap.end())
986 aMeshOnEntity = aMeshOnEntityIter->second;
988 VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
989 VISU::TFamilyIDMap& aFamilyIDMap = aMeshOnEntity->myFamilyIDMap;
991 VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily());
992 aFamily->myId = anId;
993 aFamily->myEntity = aVEntity;
994 aFamily->myName = aFamilyName;
995 aFamily->myNbCells = 0;
996 aFamily->myCellsSize = 0;
998 const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
999 VISU::TFamilyID2CellsSize::const_iterator aFamilyid2CellsSizeIter = aFamilyID2CellsSize.find(anId);
1000 if(aFamilyid2CellsSizeIter != (aMeshOnEntity->myFamilyID2CellsSize).end())
1001 aFamily->myCellsSize = aFamilyid2CellsSizeIter->second;
1002 MED::TFamilyID2NbCells::const_iterator aFam2NbCellsIter = aFam2NbCells.find(anId);
1003 if(aFam2NbCellsIter != aFam2NbCells.end())
1004 aFamily->myNbCells = aFam2NbCellsIter->second;
1006 const TInt aNbGroup = aFamilyInfo->GetNbGroup();
1007 VISU::TNames& aGroupNames = aFamily->myGroupNames;
1008 aGroupNames.resize(aNbGroup);
1009 for(TInt i = 0; i < aNbGroup; i++){
1010 std::string aGroupName = aFamilyInfo->GetGroupName(i);
1011 aGroupNames[i] = aGroupName;
1014 aFamilyIDMap[anId] = aFamily;
1016 INITMSG(MY_FAMILY_DEBUG,
1017 "- aFamilyName =|"<<aFamily->myName<<"|"
1018 << "; myId = "<<aFamily->myId
1019 << "; aNbAttr = "<<aFamilyInfo->GetNbAttr()
1020 << "; aNbGroup = "<<aFamilyInfo->GetNbGroup()
1021 << "; aVEntity = "<<aVEntity
1022 << "; myNbCells = "<<aFamily->myNbCells
1023 << "; myCellsSize = "<<aFamily->myCellsSize
1030 //---------------------------------------------------------------
1032 BuildGroupMap(VISU::PMEDMesh theMesh,
1033 const MED::TFamilyInfoSet& theFamilyInfoSet)
1035 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGroupMap");
1036 INITMSG(MYDEBUG,"BuildGroupMap\n");
1038 VISU::TGroupMap& aGroupMap = theMesh->myGroupMap;
1039 MED::TGroupInfo aGroupInfo = MED::GetGroupInfo(theFamilyInfoSet);
1040 MED::TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
1041 for(; aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
1042 const std::string& aGroupName = aGroupInfoIter->first;
1043 INITMSG(MY_GROUP_DEBUG,"aGroupName = '"<<aGroupName<<"'\n");
1045 VISU::PMEDGroup aGroup(new VISU::TMEDGroup());
1046 VISU::TFamilySet& aFamilySet = aGroup->myFamilySet;
1048 const MED::TFamilyInfoSet& aFamilyInfoSet = aGroupInfoIter->second;
1049 MED::TFamilyInfoSet::const_iterator aFamilyIter = aFamilyInfoSet.begin();
1050 for(; aFamilyIter != aFamilyInfoSet.end(); aFamilyIter++){
1051 const MED::PFamilyInfo& aFamilyInfo = *aFamilyIter;
1052 std::string aFamilyName = aFamilyInfo->GetName();
1054 VISU::TEntity aVEntity = VISU::TEntity(-1);
1055 VISU::PMEDFamily aFamily;
1058 const VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
1059 VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
1060 for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
1061 const VISU::PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
1062 const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
1063 VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
1064 for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
1065 const std::string& aName = aFamilyMapIter->first;
1066 if(aName == aFamilyName){
1067 aFamily = aFamilyMapIter->second;
1068 aVEntity = aFamily->myEntity;
1074 if(aFamily && aVEntity >= 0){
1075 aFamilySet.insert(aFamily);
1076 INITMSG(MY_GROUP_DEBUG,
1077 "- aFamilyName = '"<<aFamilyName<<"'"<<
1078 "; aVEntity = "<<aVEntity<<
1082 if(!aFamilySet.empty())
1083 aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
1088 //---------------------------------------------------------------
1092 TSetIsDone(bool& theIsDone):
1104 //---------------------------------------------------------------
1109 //---------------------------------------------------------------
1111 TMEDNamedPointCoords
1112 ::Init(const MED::PNodeInfo& theNodeInfo,
1113 MED::EVersion theVersion)
1115 TMEDCoordHolder* aCoordHolder = new TMEDCoordHolder();
1116 TInt aNbElem = theNodeInfo->GetNbElem();
1117 TInt aDim = theNodeInfo->GetMeshInfo()->GetDim();
1118 aCoordHolder->Init(aNbElem, aDim, theNodeInfo->myCoord);
1119 TNamedPointCoords::Init(PCoordHolder(aCoordHolder));
1120 myVersion = theVersion;
1122 for(TInt iDim = 0; iDim < aDim; iDim++)
1123 myPointsDim[iDim] = theNodeInfo->GetCoordName(iDim);
1125 myIsElemNum = theNodeInfo->IsElemNum();
1126 if(theNodeInfo->IsElemNum())
1127 myElemNum = theNodeInfo->myElemNum;
1129 myIsElemNames = theNodeInfo->IsElemNames();
1130 if(theNodeInfo->IsElemNames())
1131 myElemNames = theNodeInfo->myElemNames;
1135 TMEDNamedPointCoords
1136 ::Init(const MED::PGrilleInfo& theGrilleInfo)
1138 TMEDCoordHolder* aCoordHolder = new TMEDCoordHolder();
1139 TInt aNbElem = theGrilleInfo->GetNbNodes();
1140 TInt aDim = theGrilleInfo->GetMeshInfo()->GetDim();
1141 MED::PNodeCoord aCoord(new MED::TNodeCoord(aNbElem * aDim));
1142 aCoordHolder->Init(aNbElem, aDim, aCoord);
1143 TNamedPointCoords::Init(PCoordHolder(aCoordHolder));
1145 for(TInt iDim = 0; iDim < aDim; iDim++)
1146 myPointsDim[iDim] = theGrilleInfo->GetCoordName(iDim);
1148 for(TInt iElem = 0; iElem < aNbElem; iElem++){
1149 VISU::TCoordSlice aVCoordSlice = GetCoordSlice(iElem);
1150 MED::TNodeCoord aMCoord = theGrilleInfo->GetCoord(iElem);
1151 for(TInt iDim = 0; iDim < aDim; iDim++){
1152 aVCoordSlice[iDim] = aMCoord[iDim];
1158 TMEDNamedPointCoords
1159 ::GetObjID(vtkIdType theID) const
1162 return (*myElemNum)[theID];
1163 return TNamedPointCoords::GetObjID(theID);
1168 TMEDNamedPointCoords
1169 ::GetVTKID(vtkIdType theID) const
1172 // To prepare corresponding mapper engine
1173 if(myObj2VTKID.empty()){
1174 vtkIdType anEnd = myElemNum->size();
1175 for(vtkIdType anID = 0; anID < anEnd; anID++)
1176 myObj2VTKID[(*myElemNum)[anID]] = anID;
1178 TObj2VTKID::const_iterator anIter = myObj2VTKID.find(theID);
1179 if(anIter != myObj2VTKID.end())
1180 return anIter->second;
1183 return TNamedPointCoords::GetVTKID(theID);
1187 GetPNOMLength(MED::EVersion theVersion)
1189 if(theVersion == MED::eV2_1)
1190 return MED::GetPNOMLength<MED::eV2_1>();
1191 return MED::GetPNOMLength<MED::eV2_2>();
1195 TMEDNamedPointCoords
1196 ::GetNodeName(vtkIdType theObjID) const
1199 return GetString(theObjID, GetPNOMLength(myVersion), *myElemNames);
1200 return TNamedPointCoords::GetNodeName(theObjID);
1204 TMEDNamedPointCoords
1207 size_t aSize = TNamedPointCoords::GetMemorySize();
1210 aSize += myObj2VTKID.size() * sizeof(vtkIdType) * 2;
1211 aSize += myElemNum->size() * sizeof(MED::TInt);
1215 aSize += myElemNames->size() * sizeof(char);
1220 //---------------------------------------------------------------
1223 ::GetElemObjID(vtkIdType theID) const
1225 if ( !mySubMeshID.empty() )
1226 theID = mySubMeshID[theID];
1229 return (*myElemNum)[theID];
1235 //---------------------------------------------------------------
1238 ::GetElemVTKID(vtkIdType theID) const
1241 for ( size_t anId = 0; anId < (*myElemNum).size(); anId++ )
1242 if ( (*myElemNum)[ anId ] == theID ) {
1247 return TSubProfileImpl::GetElemVTKID( theID );
1251 //----------------------------------------------------------------
1256 size_t aSize = TSubProfileImpl::GetMemorySize();
1258 aSize += myElemNum->size() * sizeof(MED::TInt);
1263 //---------------------------------------------------------------
1266 ::LessThan(const PGaussImpl& theGauss,
1267 bool& theResult) const
1269 TGaussImpl::LessThan(theGauss,theResult);
1271 if(PMEDGauss aGauss = theGauss){
1272 const MED::TGaussInfo& aLeft = myGaussInfo;
1273 const MED::TGaussInfo& aReight = aGauss->myGaussInfo;
1274 theResult = MED::TGaussInfo::TLess()(aLeft,aReight);
1280 //---------------------------------------------------------------
1283 ::GetObjID(vtkIdType theID) const
1285 vtkIdType aNbPoints = myGauss->myNbPoints;
1286 TCellID aCellID = theID / aNbPoints;
1287 TLocalPntID aLocalPntID = theID % aNbPoints;
1290 aCellID = GetElemObjID(aCellID);
1292 aCellID += myStartID;
1294 return TGaussPointID(aCellID, aLocalPntID);
1298 //---------------------------------------------------------------
1301 ::GetVTKID( const TGaussPointID& theID ) const
1303 vtkIdType aResult = -1;
1305 TCellID aCellID = theID.first;
1306 TLocalPntID aLocalPntID = theID.second;
1308 vtkIdType aNbPoints = myGauss->myNbPoints;
1309 if ( aLocalPntID >= aNbPoints )
1312 if ( myIsElemNum ) {
1313 aCellID = GetElemVTKID( aCellID );
1315 aCellID -= myStartID;
1317 return aCellID * aNbPoints + aLocalPntID + myStartID;
1321 //---------------------------------------------------------------
1326 size_t aSize = TGaussSubMeshImpl::GetMemorySize();
1328 aSize += myElemNum->size() * sizeof(MED::TInt);
1333 //---------------------------------------------------------------
1336 ::Init(const MED::PElemInfo& theElemInfo,
1337 MED::EVersion theVersion)
1339 myVersion = theVersion;
1340 myIsElemNum = theElemInfo->IsElemNum();
1342 myElemNum = theElemInfo->myElemNum;
1344 myIsElemNames = theElemInfo->IsElemNames();
1345 if(theElemInfo->IsElemNames())
1346 myElemNames = theElemInfo->myElemNames;
1352 ::Init(const MED::PGrilleInfo& theGrilleInfo)
1357 ::GetElemObjID(vtkIdType theID) const
1360 return (*myElemNum)[theID];
1362 return TSubMeshImpl::GetElemObjID(theID);
1367 ::GetElemName(vtkIdType theObjID) const
1370 return GetString(theObjID, GetPNOMLength(myVersion), *myElemNames);
1371 return TSubMeshImpl::GetElemName(theObjID);
1378 size_t aSize = TSubMeshImpl::GetMemorySize();
1381 aSize += myElemNum->size() * sizeof(MED::TInt);
1384 aSize += myElemNames->size() * sizeof(char);
1390 //---------------------------------------------------------------
1394 //---------------------------------------------------------------
1397 CreateConvertor(const std::string& theFileName)
1399 if(MED::PWrapper aMed = MED::CrWrapper(theFileName,true))
1400 return new VISU_MedConvertor(theFileName, aMed);
1405 ::VISU_MedConvertor(const std::string& theFileName, MED::PWrapper theMed):
1406 myIsEntitiesDone(false),
1407 myIsFieldsDone(false),
1408 myIsGroupsDone(false),
1409 myIsMinMaxDone(false),
1412 myName = theFileName;
1416 //---------------------------------------------------------------
1421 if(myIsEntitiesDone)
1424 TSetIsDone aSetIsDone(myIsEntitiesDone);
1425 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildEntities");
1427 TInt aNbMeshes = myMed->GetNbMeshes();
1428 VISU::TMeshMap& aMeshMap = myMeshMap;
1430 INITMSG(MYDEBUG,"BuildEntities aNbMeshes = "<<aNbMeshes<<"\n");
1432 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
1436 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
1438 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
1439 std::string aMeshName = aMeshInfo->GetName();
1440 TInt aDim = aMeshInfo->GetDim();
1441 MED::EMaillage aType = aMeshInfo->GetType();
1443 // creating TMesh structure and TMeshOnEntityMap
1444 VISU::PMEDMesh aMesh = aMeshMap[aMeshName](new VISU::TMEDMesh());
1446 aMesh->myDim = aDim;
1447 aMesh->myName = aMeshName;
1448 aMesh->myMeshInfo = aMeshInfo;
1449 aMesh->myNamedPointCoords(new VISU::TMEDNamedPointCoords());
1451 INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
1452 "; aDim = "<<aDim<<"\n");
1454 if(aType == MED::eNON_STRUCTURE){
1456 if(MED::PNodeInfo aNodeInfo = myMed->GetPNodeInfo(aMeshInfo)){
1457 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
1459 aMesh->myNbPoints = aNodeInfo->GetNbElem();
1460 aMesh->myEntityInfo = anEntityInfo;
1466 INITMSG(MYDEBUG,"myNbPoints = "<<aMesh->myNbPoints<<
1467 "; anEntityInfo.size() = "<<anEntityInfo.size()<<
1470 BuildMeshOnEntityMap(aMesh,
1476 }catch(std::exception& exc){
1477 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1479 MSG(MYDEBUG,"Unknown exception !!!");
1483 } // NON STRUCTURED MESH
1485 MED::PGrilleInfo aGrilleInfo = myMed->GetPGrilleInfo(aMeshInfo);
1487 MED::TEntityInfo anEntityInfo;
1488 anEntityInfo[MED::eNOEUD][MED::ePOINT1] = aGrilleInfo->GetNbNodes();
1489 anEntityInfo[aGrilleInfo->GetEntity()][aGrilleInfo->GetGeom()] = aGrilleInfo->GetNbCells();
1491 aMesh->myNbPoints = aGrilleInfo->GetNbNodes();
1492 aMesh->myEntityInfo = anEntityInfo;
1494 aMesh->myIsPolarType = (MED::eGRILLE_POLAIRE == aGrilleInfo->GetGrilleType());
1495 aMesh->myIsStructured = true;
1499 BEGMSG(MYDEBUG,"anEntityInfo.size() = "<<anEntityInfo.size()<<"\n");
1501 BuildMeshGrilleOnEntityMap(aMesh,
1507 }catch(std::exception& exc){
1508 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1510 MSG(MYDEBUG,"Unknown exception !!!");
1517 }catch(std::exception& exc){
1518 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1520 MSG(MYDEBUG,"Unknown exception !!!");
1529 //---------------------------------------------------------------
1537 VISU_Convertor_impl::BuildFields();
1539 TSetIsDone aSetIsDone(myIsFieldsDone);
1540 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFields");
1542 TInt aNbMeshes = myMed->GetNbMeshes();
1543 VISU::TMeshMap& aMeshMap = myMeshMap;
1545 INITMSG(MYDEBUG,"BuildFields - aNbMeshes = "<<aNbMeshes<<"\n");
1547 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
1551 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
1553 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
1554 std::string aMeshName = aMeshInfo->GetName();
1556 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
1557 if(anIter == aMeshMap.end())
1559 VISU::PMEDMesh aMesh = anIter->second;
1561 INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
1565 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
1567 BuildFieldMap(aMesh,
1571 }catch(std::exception& exc){
1572 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1574 MSG(MYDEBUG,"Unknown exception !!!");
1579 }catch(std::exception& exc){
1580 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1582 MSG(MYDEBUG,"Unknown exception !!!");
1591 //---------------------------------------------------------------
1592 template<class TimeStampValueType>
1594 BuildTimeStampMinMax(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
1595 const VISU::PMEDMeshOnEntity theMeshOnEntity,
1596 const MED::TGeom2Gauss& theGeom2Gauss,
1597 VISU::TMetric2Comp2MinMax& theMetric2Comp2MinMax,
1598 VISU::TMetric2Comp2MinMax& theMetric2Comp2AverageMinMax,
1599 VISU::TMetric2Comp2Group2MinMax& theMetric2Comp2Group2MinMax,
1600 VISU::TMetric2Comp2Group2MinMax& theMetric2Comp2Group2AverageMinMax,
1604 const VISU::TFamilyIDMap& aFamilyIDMap = theMeshOnEntity->myFamilyIDMap;
1605 VISU::TGeom2ElemID2FamilyID aGeom2ElemID2FamilyID = theMeshOnEntity->myGeom2ElemID2FamilyID;
1607 VISU::TVector<double> aBaseAverageValues;
1608 aBaseAverageValues.resize(3);
1609 aBaseAverageValues[VISU::AVERAGE_METRIC] = 0.0;
1610 aBaseAverageValues[VISU::MINIMUM_METRIC] = VTK_LARGE_FLOAT;
1611 aBaseAverageValues[VISU::MAXIMUM_METRIC] = -VTK_LARGE_FLOAT;
1613 const typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValue->myGeom2Value;
1614 typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
1615 for(; anIter != aGeom2Value.end(); anIter++){
1616 const typename TimeStampValueType::TTMeshValue& aMMeshValue = anIter->second;
1617 MED::EGeometrieElement aMGeom = anIter->first;
1619 TInt aNbElem = aMMeshValue.myNbElem;
1620 TInt aNbGauss = aMMeshValue.myNbGauss;
1622 MED::TGeom2Gauss::const_iterator aGaussIter = theGeom2Gauss.find(aMGeom);
1623 if(aGaussIter == theGeom2Gauss.end())
1627 "- aMGeom = "<<aMGeom<<
1628 "; aNbElem = "<<aNbElem<<
1629 "; aNbGauss = "<<aNbGauss<<
1632 VISU::TElemID2FamilyID anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom];
1634 bool isAverageByGaussPoints = (aNbGauss > 1);
1635 // To calculate min/max per components
1636 for(TInt iElem = 0; iElem < aNbElem; iElem++){
1637 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
1639 for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
1640 VISU::TComp2MinMax& aComp2MinMax = theMetric2Comp2MinMax[aGaussMetric];
1641 VISU::TComp2MinMax& aComp2AverageMinMax = theMetric2Comp2AverageMinMax[aGaussMetric];
1642 VISU::TComp2Group2MinMax& aComp2Group2MinMax = theMetric2Comp2Group2MinMax[aGaussMetric];
1643 VISU::TComp2Group2MinMax& aComp2Group2AverageMinMax = theMetric2Comp2Group2AverageMinMax[aGaussMetric];
1645 for(TInt iComp = 0; iComp < theNbComp; iComp++){
1646 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
1648 VISU::TMinMax& aMinMax = aComp2MinMax[iComp+1];
1649 vtkFloatingPointType& aMin = aMinMax.first;
1650 vtkFloatingPointType& aMax = aMinMax.second;
1651 VISU::TMinMax& anAverageMinMax = aComp2AverageMinMax[iComp+1];
1652 vtkFloatingPointType& anAverageMin = anAverageMinMax.first;
1653 vtkFloatingPointType& anAverageMax = anAverageMinMax.second;
1654 vtkFloatingPointType anAverageValue = aBaseAverageValues[aGaussMetric];
1656 VISU::TGroup2MinMax& aGroup2MinMax = aComp2Group2MinMax[iComp+1];
1657 VISU::TGroup2MinMax& aGroup2AverageMinMax = aComp2Group2AverageMinMax[iComp+1];
1658 std::map<VISU::TName,vtkFloatingPointType> aGroup2AverageValue;
1660 // get names of groups, to which the element belongs
1661 VISU::TNames aGroupNames;
1662 VISU::TElemID2FamilyID::const_iterator anIter = anElemID2FamilyID.find(iElem);
1663 if(anIter != anElemID2FamilyID.end()){
1664 int aFamilyId = anIter->second;
1666 VISU::TFamilyIDMap::const_iterator aFamilyIter = aFamilyIDMap.find(aFamilyId);
1667 if(aFamilyIter != aFamilyIDMap.end()){
1668 VISU::PMEDFamily aFamily = aFamilyIter->second;
1669 aGroupNames = aFamily->myGroupNames;
1670 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1671 for(; aGroupIter != aGroupNames.end(); aGroupIter++)
1672 aGroup2AverageValue[*aGroupIter] = aBaseAverageValues[aGaussMetric];
1677 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1678 const vtkFloatingPointType& aVal = aMValueSlice[iGauss];
1679 aMin = isnan(aVal) ? aVal : std::min(aMin,aVal);
1680 aMax = isnan(aVal) ? aVal : std::max(aMax,aVal);
1681 if(isAverageByGaussPoints){
1682 switch(aGaussMetric) {
1683 case VISU::AVERAGE_METRIC: anAverageValue += aVal; break;
1684 case VISU::MINIMUM_METRIC: anAverageValue = std::min(anAverageValue, aVal); break;
1685 case VISU::MAXIMUM_METRIC: anAverageValue = std::max(anAverageValue, aVal); break;
1689 anAverageMin = aMin;
1690 anAverageMax = aMax;
1693 // additional calculation for each group, to which the element belongs
1694 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1695 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1696 VISU::TName aGroupName = *aGroupIter;
1697 bool isGroupFound = aGroup2MinMax.find(aGroupName) != aGroup2MinMax.end();
1698 VISU::TMinMax& aGroupMinMax = aGroup2MinMax[aGroupName];
1699 vtkFloatingPointType& aGroupMin = aGroupMinMax.first;
1700 vtkFloatingPointType& aGroupMax = aGroupMinMax.second;
1701 aGroupMin = isGroupFound ? std::min(aGroupMin,aVal) : aVal;
1702 aGroupMax = isGroupFound ? std::max(aGroupMax,aVal) : aVal;
1704 if(isAverageByGaussPoints){
1705 switch(aGaussMetric) {
1706 case VISU::AVERAGE_METRIC: aGroup2AverageValue[aGroupName] = aGroup2AverageValue[aGroupName] + aVal; break;
1707 case VISU::MINIMUM_METRIC: aGroup2AverageValue[aGroupName] = std::min(aGroup2AverageValue[aGroupName], aVal); break;
1708 case VISU::MAXIMUM_METRIC: aGroup2AverageValue[aGroupName] = std::max(aGroup2AverageValue[aGroupName], aVal); break;
1712 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1713 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1714 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1715 aGroupAverageMin = aGroupMin;
1716 aGroupAverageMax = aGroupMax;
1720 if(isAverageByGaussPoints){
1721 if(aGaussMetric == VISU::AVERAGE_METRIC)
1722 anAverageValue /= aNbGauss;
1723 anAverageMin = std::min(anAverageMin,anAverageValue);
1724 anAverageMax = std::max(anAverageMax,anAverageValue);
1726 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1727 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1728 VISU::TName aGroupName = *aGroupIter;
1729 vtkFloatingPointType aGroupAverageValue = aGroup2AverageValue[aGroupName];
1730 if(aGaussMetric == VISU::AVERAGE_METRIC)
1731 aGroupAverageValue /= aNbGauss;
1732 bool isGroupFound = aGroup2AverageMinMax.find(aGroupName) != aGroup2AverageMinMax.end();
1733 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1734 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1735 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1736 aGroupAverageMin = isGroupFound ? std::min(aGroupAverageMin,aGroupAverageValue) : aGroupAverageValue;
1737 aGroupAverageMax = isGroupFound ? std::max(aGroupAverageMax,aGroupAverageValue) : aGroupAverageValue;
1744 // To calculate min/max per vector modulus
1745 for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
1746 VISU::TComp2MinMax& aComp2MinMax = theMetric2Comp2MinMax[aGaussMetric];
1747 VISU::TComp2MinMax& aComp2AverageMinMax = theMetric2Comp2AverageMinMax[aGaussMetric];
1748 VISU::TComp2Group2MinMax& aComp2Group2MinMax = theMetric2Comp2Group2MinMax[aGaussMetric];
1749 VISU::TComp2Group2MinMax& aComp2Group2AverageMinMax = theMetric2Comp2Group2AverageMinMax[aGaussMetric];
1751 VISU::TMinMax& aMinMax = aComp2MinMax[0];
1752 vtkFloatingPointType& aMin = aMinMax.first;
1753 vtkFloatingPointType& aMax = aMinMax.second;
1754 VISU::TMinMax& anAverageMinMax = aComp2AverageMinMax[0];
1755 vtkFloatingPointType& anAverageMin = anAverageMinMax.first;
1756 vtkFloatingPointType& anAverageMax = anAverageMinMax.second;
1758 VISU::TGroup2MinMax& aGroup2MinMax = aComp2Group2MinMax[0];
1759 VISU::TGroup2MinMax& aGroup2AverageMinMax = aComp2Group2AverageMinMax[0];
1761 for(TInt iElem = 0; iElem < aNbElem; iElem++){
1762 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
1764 // get names of groups, to which the element belongs
1765 VISU::TNames aGroupNames;
1766 VISU::TElemID2FamilyID::const_iterator anIter = anElemID2FamilyID.find(iElem);
1767 if(anIter != anElemID2FamilyID.end()){
1768 int aFamilyId = anIter->second;
1770 VISU::TFamilyIDMap::const_iterator aFamilyIter = aFamilyIDMap.find(aFamilyId);
1771 if(aFamilyIter != aFamilyIDMap.end()){
1772 VISU::PMEDFamily aFamily = aFamilyIter->second;
1773 aGroupNames = aFamily->myGroupNames;
1778 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1779 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
1780 vtkFloatingPointType aValue = 0.0;
1781 for(TInt iComp = 0; iComp < theNbComp2; iComp++){
1782 vtkFloatingPointType aVal = aMValueSlice[iComp];
1783 aValue += aVal*aVal;
1785 aValue = sqrt(aValue);
1786 aMin = isnan(aValue) ? aValue : std::min(aMin,aValue);
1787 aMax = isnan(aValue) ? aValue : std::max(aMax,aValue);
1789 // additional calculation for each group, to which the element belongs
1790 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1791 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1792 VISU::TName aGroupName = *aGroupIter;
1793 bool isGroupFound = aGroup2MinMax.find(aGroupName) != aGroup2MinMax.end();
1794 VISU::TMinMax& aGroupMinMax = aGroup2MinMax[aGroupName];
1795 vtkFloatingPointType& aGroupMin = aGroupMinMax.first;
1796 vtkFloatingPointType& aGroupMax = aGroupMinMax.second;
1797 aGroupMin = isGroupFound ? std::min(aGroupMin,aValue) : aValue;
1798 aGroupMax = isGroupFound ? std::max(aGroupMax,aValue) : aValue;
1801 if(isAverageByGaussPoints){
1802 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMCompValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
1803 vtkFloatingPointType aValue = 0.0;
1804 for(TInt iComp = 0; iComp < theNbComp2; iComp++){
1805 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMCompValueSlice = aMCompValueSliceArr[iComp];
1806 vtkFloatingPointType anAverageValue = aBaseAverageValues[aGaussMetric];
1807 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1808 const vtkFloatingPointType& aVal = aMCompValueSlice[iGauss];
1809 switch(aGaussMetric) {
1810 case VISU::AVERAGE_METRIC: anAverageValue += aVal; break;
1811 case VISU::MINIMUM_METRIC: anAverageValue = std::min(anAverageValue, aVal); break;
1812 case VISU::MAXIMUM_METRIC: anAverageValue = std::max(anAverageValue, aVal); break;
1815 if(aGaussMetric == VISU::AVERAGE_METRIC)
1816 anAverageValue /= aNbGauss;
1817 aValue += anAverageValue*anAverageValue;
1819 aValue = sqrt(aValue);
1820 anAverageMin = std::min(anAverageMin,aValue);
1821 anAverageMax = std::max(anAverageMax,aValue);
1823 // additional calculation for each group, to which the element belongs
1824 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1825 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1826 VISU::TName aGroupName = *aGroupIter;
1827 bool isGroupFound = aGroup2AverageMinMax.find(aGroupName) != aGroup2AverageMinMax.end();
1828 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1829 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1830 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1831 aGroupAverageMin = isGroupFound ? std::min(aGroupAverageMin,aValue) : aValue;
1832 aGroupAverageMax = isGroupFound ? std::max(aGroupAverageMax,aValue) : aValue;
1836 anAverageMin = aMin;
1837 anAverageMax = aMax;
1839 // additional calculation for each group, to which the element belongs
1840 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1841 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1842 VISU::TName aGroupName = *aGroupIter;
1843 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1844 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1845 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1846 aGroupAverageMin = aGroup2MinMax[aGroupName].first;
1847 aGroupAverageMax = aGroup2MinMax[aGroupName].second;
1856 //---------------------------------------------------------------
1864 VISU_Convertor_impl::BuildMinMax();
1866 TSetIsDone aSetIsDone(myIsMinMaxDone);
1867 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax");
1869 MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(myMed);
1870 MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(myMed);
1872 TInt aNbMeshes = myMed->GetNbMeshes();
1873 VISU::TMeshMap& aMeshMap = myMeshMap;
1875 INITMSG(MYDEBUG,"BuildMinMax - aNbMeshes = "<<aNbMeshes<<"\n");
1877 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
1881 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPMeshInfo");
1883 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
1884 std::string aMeshName = aMeshInfo->GetName();
1886 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
1887 if(anIter == aMeshMap.end())
1889 VISU::PMEDMesh aMesh = anIter->second;
1894 TInt aNbFields = myMed->GetNbFields();
1897 "- aMeshName = '"<<aMeshName<<"'"<<
1898 "; aNbFields = "<<aNbFields<<"\n");
1900 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
1902 for(TInt iField = 1; iField <= aNbFields; iField++){
1903 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()");
1905 MED::TErr anError = 0;
1906 MED::PFieldInfo aFieldInfo = myMed->GetPFieldInfo(aMeshInfo, iField, &anError);
1910 std::string aFieldName = aFieldInfo->GetName();
1911 INITMSG(MYDEBUG,"- aFieldName = '"<<aFieldName<<"'\n");
1913 MED::TGeom2Size aGeom2Size;
1914 MED::EEntiteMaillage aMEntity;
1915 TInt aNbTimeStamps = myMed->GetNbTimeStamps(aFieldInfo,
1919 if(aNbTimeStamps < 1)
1922 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
1923 VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
1924 VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
1925 VISU::PMEDField aField = aFieldMap[aFieldName];
1927 TInt aNbComp = aField->myNbComp;
1928 int aNbComp2 = aNbComp;
1929 if(aNbComp == 2 || aNbComp == 4)
1931 else if(aNbComp > 4)
1934 VISU::TMetric2Comp2MinMax& aMetric2Comp2MinMax = aField->myMetric2Comp2MinMax;
1935 VISU::TMetric2Comp2MinMax& aMetric2Comp2AverageMinMax = aField->myMetric2Comp2AverageMinMax;
1936 VISU::TMetric2Comp2Group2MinMax& aMetric2Comp2Group2MinMax = aField->myMetric2Comp2Group2MinMax;
1937 VISU::TMetric2Comp2Group2MinMax& aMetric2Comp2Group2AverageMinMax = aField->myMetric2Comp2Group2AverageMinMax;
1938 TSetIsDone aSetIsDone(aField->myIsMinMaxInitilized);
1939 for(TInt iTimeStamp = aNbTimeStamps; iTimeStamp >= 1; iTimeStamp--){
1940 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()");
1941 INITMSG(MYDEBUG,"- iTimeStamp = "<<iTimeStamp<<endl);
1949 MED::PTimeStampInfo aTimeStampInfo =
1950 myMed->GetPTimeStampInfo(aFieldInfo,
1955 MED::PTimeStampValueBase aTimeStampValue =
1956 myMed->GetPTimeStampValue(aTimeStampInfo,
1960 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
1962 if(aFieldInfo->GetType() == MED::eFLOAT64)
1963 BuildTimeStampMinMax<MED::TFloatTimeStampValue>(CastToFloatTimeStampValue(aTimeStampValue),
1966 aMetric2Comp2MinMax,
1967 aMetric2Comp2AverageMinMax,
1968 aMetric2Comp2Group2MinMax,
1969 aMetric2Comp2Group2AverageMinMax,
1973 BuildTimeStampMinMax<MED::TIntTimeStampValue>(CastToIntTimeStampValue(aTimeStampValue),
1976 aMetric2Comp2MinMax,
1977 aMetric2Comp2AverageMinMax,
1978 aMetric2Comp2Group2MinMax,
1979 aMetric2Comp2Group2AverageMinMax,
1984 }catch(Standard_Failure){
1985 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1986 MSG(MYDEBUG,"Follow signal was occured in:\n"<<aFail->GetMessageString());
1987 }catch(std::exception& exc){
1988 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1990 MSG(MYDEBUG,"Unknown exception !!!");
1994 for(TInt iComp = 0; iComp <= aNbComp; iComp++){
1995 VISU::TMinMax aMinMax = aField->GetMinMax(iComp, VISU::TNames());
1996 INITMSG(MYDEBUG,"- "<<iComp<<": "<<aMinMax.first<<"; "<<aMinMax.second<<endl);
2000 }catch(std::exception& exc){
2001 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2003 MSG(MYDEBUG,"Unknown exception !!!");
2008 }catch(std::exception& exc){
2009 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2011 MSG(MYDEBUG,"Unknown exception !!!");
2020 //---------------------------------------------------------------
2028 TSetIsDone aSetIsDone(myIsGroupsDone);
2029 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGroups");
2031 TInt aNbMeshes = myMed->GetNbMeshes();
2032 VISU::TMeshMap& aMeshMap = myMeshMap;
2034 INITMSG(MYDEBUG,"BuildGroups - aNbMeshes = "<<aNbMeshes<<"\n");
2036 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
2040 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
2042 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
2043 std::string aMeshName = aMeshInfo->GetName();
2045 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
2046 if(anIter == aMeshMap.end())
2048 VISU::PMEDMesh aMesh = anIter->second;
2050 INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
2052 MED::EMaillage aType = aMeshInfo->GetType();
2054 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
2056 MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo =
2057 MED::GetEntity2TGeom2ElemInfo(myMed, aMeshInfo, anEntityInfo);
2062 MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(myMed, aMeshInfo);
2064 if(aType == MED::eNON_STRUCTURE)
2065 BuildFamilyMap(aMesh,
2067 anEntity2TGeom2ElemInfo,
2071 BuildGrilleFamilyMap(aMesh,
2076 BuildGroupMap(aMesh,
2079 }catch(std::exception& exc){
2080 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2082 MSG(MYDEBUG,"Unknown exception !!!");
2087 }catch(std::exception& exc){
2088 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2090 MSG(MYDEBUG,"Unknown exception !!!");
2099 //---------------------------------------------------------------
2102 ::LoadMeshOnEntity(VISU::PMeshImpl theMesh,
2103 VISU::PMeshOnEntityImpl theMeshOnEntity)
2105 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnEntity");
2106 INITMSG(MYDEBUG,"LoadMeshOnEntity"<<endl);
2108 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2110 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2111 if(anEntity == VISU::NODE_ENTITY){
2112 isPointsUpdated += LoadPoints(myMed, theMesh);
2114 isPointsUpdated += LoadPoints(myMed, theMesh);
2115 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed, theMesh, theMeshOnEntity);
2118 return (isPointsUpdated || isCellsOnEntityUpdated);
2122 //---------------------------------------------------------------
2125 ::LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
2126 VISU::PMeshOnEntityImpl theMeshOnEntity,
2127 VISU::PFamilyImpl theFamily)
2129 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity");
2130 INITMSG(MYDEBUG,"LoadFamilyOnEntity"<<endl);
2132 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2134 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2135 if(anEntity == VISU::NODE_ENTITY){
2136 isPointsUpdated += LoadPointsOnFamily(myMed, theMesh, theFamily);
2138 isPointsUpdated += LoadPoints(myMed, theMesh);
2139 isCellsOnEntityUpdated += LoadCellsOnFamily(myMed, theMesh, theMeshOnEntity, theFamily);
2142 return (isPointsUpdated || isCellsOnEntityUpdated);
2146 //---------------------------------------------------------------
2149 ::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
2150 const VISU::TFamilySet& theFamilySet)
2152 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup");
2153 INITMSG(MYDEBUG,"LoadMeshOnGroup"<<endl);
2155 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2156 VISU::TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
2157 for(; aFamilyIter != theFamilySet.end(); aFamilyIter++){
2158 VISU::PMEDFamily aFamily = *aFamilyIter;
2159 const VISU::TEntity& anEntity = aFamily->myEntity;
2160 const VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
2161 isPointsUpdated += LoadPoints(myMed, theMesh);
2162 if(anEntity == VISU::NODE_ENTITY){
2163 isPointsUpdated += LoadPointsOnFamily(myMed, theMesh, aFamily);
2165 isCellsOnEntityUpdated += LoadCellsOnFamily(myMed,theMesh,aMeshOnEntity,aFamily);
2169 return (isPointsUpdated || isCellsOnEntityUpdated);
2173 //---------------------------------------------------------------
2176 ::LoadValForTimeOnMesh(VISU::PMeshImpl theMesh,
2177 VISU::PMeshOnEntityImpl theMeshOnEntity,
2178 VISU::PFieldImpl theField,
2179 VISU::PValForTimeImpl theValForTime)
2181 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh");
2182 INITMSG(MYDEBUG,"LoadValForTimeOnMesh"<<endl);
2184 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2185 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2186 isPointsUpdated += LoadPoints(myMed,theMesh);
2187 if(anEntity != VISU::NODE_ENTITY)
2188 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity);
2189 int isFieldUpdated = LoadValForTimeOnMesh(myMed,theMesh,theMeshOnEntity,theField,theValForTime);
2191 return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
2195 //---------------------------------------------------------------
2198 ::LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh,
2199 VISU::PMeshOnEntityImpl theMeshOnEntity,
2200 VISU::PFieldImpl theField,
2201 VISU::PValForTimeImpl theValForTime)
2203 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts");
2204 INITMSG(MYDEBUG,"LoadValForTimeOnGaussPts"<<endl);
2206 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2207 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2208 if(anEntity != VISU::NODE_ENTITY)
2209 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity);
2210 int isFieldUpdated = LoadValForTimeOnGaussPts(myMed,theMesh,theMeshOnEntity,theField,theValForTime);
2212 return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
2216 //---------------------------------------------------------------
2219 ::LoadPoints(const MED::PWrapper& theMed,
2220 VISU::PMEDMesh theMesh)
2222 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPoints");
2224 //Check on existing family
2225 VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
2226 aMeshOnEntity->myMeshName = theMesh->myName;
2227 aMeshOnEntity->myEntity = VISU::NODE_ENTITY;
2229 INITMSG(MYDEBUG,"LoadPoints - theMesh->myIsDone = "<<theMesh->myIsDone<<"'\n");
2231 //Check on loading already done
2232 if(theMesh->myIsDone)
2235 MED::EMaillage aType = theMesh->myMeshInfo->GetType();
2237 if(aType == MED::eNON_STRUCTURE){
2239 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
2240 TInt aNbElem = aNodeInfo->GetNbElem();
2242 VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
2243 aNamedPointCoords->Init(aNodeInfo, theMed->GetVersion());
2245 VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
2246 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
2248 aSubMesh->Init(MED::PElemInfo(aNodeInfo), theMed->GetVersion());
2249 aSubMesh->myNbCells = theMesh->myNbPoints;
2250 aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
2252 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2253 aCell2Connect.resize(aNbElem);
2254 for (int iElem = 0; iElem < aNbElem; iElem++)
2255 aCell2Connect[iElem] = VISU::TConnect(1,iElem);
2256 } // END NON_STRUCTURED
2257 else { // STRUCTURED
2259 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(theMesh->myMeshInfo);
2260 TInt aNbElem = aGrilleInfo->GetNbNodes();
2262 VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
2263 aNamedPointCoords->Init(aGrilleInfo);
2265 VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
2266 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
2268 aSubMesh->Init(aGrilleInfo);
2269 aSubMesh->myNbCells = theMesh->myNbPoints;
2270 aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
2272 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2273 aCell2Connect.resize(aNbElem);
2274 for(int iElem = 0; iElem < aNbElem; iElem++)
2275 aCell2Connect[iElem] = VISU::TConnect(1,iElem);
2279 theMesh->myIsDone = true;
2283 }catch(std::exception& exc){
2286 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2293 //---------------------------------------------------------------
2296 ::LoadPointsOnFamily(const MED::PWrapper& theMed,
2297 const VISU::PMEDMesh theMesh,
2298 const VISU::PMEDFamily theFamily)
2300 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPointsOnFamily");
2302 if(theFamily->myIsDone)
2305 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2306 MED::EMaillage aType = aMeshInfo->GetType();
2309 if(aType == MED::eNON_STRUCTURE){
2310 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
2311 TInt aNbElem = aNodeInfo->GetNbElem();
2314 TInt anId = theFamily->myId;
2315 VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
2316 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2317 if(aNodeInfo->GetFamNum(iElem) == anId)
2318 aSubMeshID.push_back(iElem);
2322 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo);
2323 TInt aNbElem = aGrilleInfo->GetNbNodes();
2326 TInt anId = theFamily->myId;
2327 VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
2328 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2329 if(aGrilleInfo->GetFamNumNode(iElem) == anId)
2330 aSubMeshID.push_back(iElem);
2334 theFamily->myIsDone = true;
2338 }catch(std::exception& exc){
2341 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2348 //---------------------------------------------------------------
2351 ::LoadCellsOnEntity(const MED::PWrapper& theMed,
2352 const VISU::PMEDMesh theMesh,
2353 const VISU::PMEDMeshOnEntity theMeshOnEntity)
2355 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnEntity");
2359 const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
2360 const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
2362 INITMSG(MYDEBUG,"LoadCellsOnEntity - aVEntity = "<<aVEntity<<"\n");
2364 if(theMeshOnEntity->myIsDone)
2367 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2369 MED::EMaillage aType = aMeshInfo->GetType();
2371 if(aType == MED::eSTRUCTURE){
2373 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo);
2374 TInt aNbPoints = aGrilleInfo->GetNbNodes();
2376 std::map<TInt,TInt> aNodeIdMap;
2377 EBooleen anIsNodeNum = MED::eFAUX;
2379 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2380 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2381 VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
2383 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2384 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2385 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2386 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"; aEGeom = "<<aEGeom<<"\n");
2388 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
2389 INITMSG(MYDEBUG,"aVNbNodes = "<<aVNbNodes<<"\n");
2391 TInt aNbElem = aGeom2SizeIter->second;//aGrilleInfo->GetNbCells();
2394 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2396 aSubMesh->Init(aGrilleInfo);
2397 aSubMesh->myNbCells = aNbElem;
2398 aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
2400 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2401 aCell2Connect.resize(aNbElem);
2403 TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
2404 VISU::TVector<TInt> aConnect(aMNbNodes);
2406 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2407 MED::TIntVector aConn = aGrilleInfo->GetConn(iElem);
2408 VISU::TConnect& anArray = aCell2Connect[iElem];
2409 anArray.resize(aVNbNodes);
2412 for(TInt iConn = 0; iConn < aMNbNodes; iConn++){
2413 aConnect[iConn] = aNodeIdMap[aConn[iConn] - 1];
2416 for(int iConn = 0; iConn < aMNbNodes; ++iConn){
2417 aConnect[iConn] = aConn[iConn];
2423 anArray[0] = aConnect[0];
2424 anArray[1] = aConnect[2];
2425 anArray[2] = aConnect[3];
2426 anArray[3] = aConnect[1];
2429 anArray[0] = aConnect[0];
2430 anArray[1] = aConnect[2];
2431 anArray[2] = aConnect[3];
2432 anArray[3] = aConnect[1];
2433 anArray[4] = aConnect[4];
2434 anArray[5] = aConnect[6];
2435 anArray[6] = aConnect[7];
2436 anArray[7] = aConnect[5];
2439 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2440 anArray[iNode] = aConnect[iNode];
2443 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2444 if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
2445 EXCEPTION(std::runtime_error,"LoadCellsOnEntity - "<<
2446 " aNbPoints("<<aNbPoints<<") "<<
2447 "<= anArray["<<iElem<<"]"<<
2449 "("<<anArray[iNode]<<") < 0");
2455 theMeshOnEntity->myIsDone = true;
2461 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
2462 TInt aNbPoints = aNodeInfo->GetNbElem();
2464 std::map<TInt,TInt> aNodeIdMap;
2465 #ifdef _EDF_NODE_IDS_
2466 EBooleen anIsNodeNum = MED::eFAUX;
2468 EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
2470 for(TInt i = 0; i < aNbPoints; i++){
2471 aNodeIdMap[aNodeInfo->GetElemNum(i)-1] = i;
2476 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2477 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2478 VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
2480 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2481 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2482 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2483 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"; aEGeom = "<<aEGeom<<"\n");
2485 case MED::ePOLYGONE: {
2486 MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
2487 TInt aNbElem = aPolygoneInfo->GetNbElem();
2489 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2491 aSubMesh->Init(MED::PElemInfo(aPolygoneInfo),theMed->GetVersion());
2492 aSubMesh->myNbCells = aNbElem;
2494 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2495 aCell2Connect.resize(aNbElem);
2497 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2498 MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem);
2499 TInt aNbConn = aPolygoneInfo->GetNbConn(iElem);
2500 aSubMesh->myCellsSize += aNbConn;
2501 VISU::TConnect& anArray = aCell2Connect[iElem];
2502 anArray.resize(aNbConn);
2503 for(TInt iConn = 0; iConn < aNbConn; iConn++)
2504 anArray[iConn] = aConnSlice[iConn] - 1;
2509 case MED::ePOLYEDRE: {
2510 MED::PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
2511 TInt aNbElem = aPolyedreInfo->GetNbElem();
2514 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2516 aSubMesh->Init(MED::PElemInfo(aPolyedreInfo),theMed->GetVersion());
2517 aSubMesh->myNbCells = aNbElem;
2519 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2520 aCell2Connect.resize(aNbElem);
2522 for(TInt iElem = 0; iElem < aNbElem; iElem++){
2523 MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem);
2524 VISU::TConnect& anArray = aCell2Connect[iElem];
2525 typedef std::set<TInt> TConnectSet;
2526 TConnectSet aConnectSet;
2527 TInt aNbFaces = aConnSliceArr.size();
2528 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
2529 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
2530 TInt aNbConn = aConnSlice.size();
2531 aSubMesh->myCellsSize += aNbConn;
2532 for(TInt iConn = 0; iConn < aNbConn; iConn++){
2533 aConnectSet.insert(aConnSlice[iConn]);
2537 int aNbConn = aConnectSet.size();
2538 anArray.resize(aNbConn);
2539 TConnectSet::iterator anIter = aConnectSet.begin();
2540 for(int i = 0; anIter != aConnectSet.end(); anIter++, i++){
2541 TInt anId = *anIter;
2542 anArray[i] = anId - 1;
2550 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
2551 INITMSG(MYDEBUG,"aVNbNodes = "<<aVNbNodes<<"\n");
2553 MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
2554 TInt aNbElem = aCellInfo->GetNbElem();
2557 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2559 aSubMesh->Init(MED::PElemInfo(aCellInfo), theMed->GetVersion());
2560 aSubMesh->myNbCells = aNbElem;
2561 aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
2563 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2564 aCell2Connect.resize(aNbElem);
2566 TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
2567 VISU::TVector<TInt> aConnect(aMNbNodes);
2569 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2570 MED::TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
2571 VISU::TConnect& anArray = aCell2Connect[iElem];
2572 anArray.resize(aVNbNodes);
2575 for(TInt iConn = 0; iConn < aMNbNodes; iConn++){
2576 aConnect[iConn] = aNodeIdMap[aConnSlice[iConn] - 1];
2579 for(int iConn = 0; iConn < aMNbNodes; iConn++){
2580 aConnect[iConn] = aConnSlice[iConn] - 1;
2585 #if !(defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2587 anArray[0] = aConnect[0];
2588 anArray[2] = aConnect[1];
2590 anArray[1] = aConnect[2];
2593 #if !(defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2595 anArray[0] = aConnect[0];
2596 anArray[2] = aConnect[1];
2597 anArray[4] = aConnect[2];
2599 anArray[1] = aConnect[3];
2600 anArray[3] = aConnect[4];
2601 anArray[5] = aConnect[5];
2604 #if !(defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2606 anArray[0] = aConnect[0];
2607 anArray[2] = aConnect[1];
2608 anArray[4] = aConnect[2];
2609 anArray[6] = aConnect[3];
2611 anArray[1] = aConnect[4];
2612 anArray[3] = aConnect[5];
2613 anArray[5] = aConnect[6];
2614 anArray[7] = aConnect[7];
2617 #if (defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2619 anArray[0] = aConnect[0];
2620 anArray[1] = aConnect[2];
2621 anArray[2] = aConnect[1];
2622 anArray[3] = aConnect[3];
2624 anArray[4] = aConnect[6];
2625 anArray[5] = aConnect[5];
2626 anArray[6] = aConnect[4];
2628 anArray[7] = aConnect[7];
2629 anArray[8] = aConnect[9];
2630 anArray[9] = aConnect[8];
2634 anArray[0] = aConnect[0];
2635 anArray[1] = aConnect[2];
2636 anArray[2] = aConnect[1];
2637 anArray[3] = aConnect[3];
2639 #if (defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2641 anArray[0] = aConnect[0];
2642 anArray[1] = aConnect[3];
2643 anArray[2] = aConnect[2];
2644 anArray[3] = aConnect[1];
2645 anArray[4] = aConnect[4];
2647 anArray[5] = aConnect[8];
2648 anArray[6] = aConnect[7];
2649 anArray[7] = aConnect[6];
2650 anArray[8] = aConnect[5];
2652 anArray[9] = aConnect[9];
2653 anArray[10] = aConnect[12];
2654 anArray[11] = aConnect[11];
2655 anArray[12] = aConnect[10];
2659 anArray[0] = aConnect[0];
2660 anArray[1] = aConnect[3];
2661 anArray[2] = aConnect[2];
2662 anArray[3] = aConnect[1];
2663 anArray[4] = aConnect[4];
2666 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2667 anArray[iNode] = aConnect[iNode];
2669 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2670 if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
2671 EXCEPTION(std::runtime_error,"LoadCellsOnEntity - "<<
2672 " aNbPoints("<<aNbPoints<<") "<<
2673 "<= anArray["<<iElem<<"]"<<
2675 "("<<anArray[iNode]<<") < 0");
2681 // END NON_STRUCTURED
2683 theMeshOnEntity->myIsDone = true;
2688 }catch(std::exception& exc){
2691 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2699 //---------------------------------------------------------------
2702 ::LoadCellsOnFamily(const MED::PWrapper& theMed,
2703 const VISU::PMEDMesh theMesh,
2704 const VISU::PMEDMeshOnEntity theMeshOnEntity,
2705 const VISU::PMEDFamily theFamily)
2707 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnFamily");
2711 const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
2712 const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
2714 INITMSG(MYDEBUG,"LoadCellsOnFamily - aVEntity = "<<aVEntity<<"\n");
2716 if(theFamily->myIsDone)
2719 TInt anId = theFamily->myId;
2721 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2722 VISU::TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
2723 MED::EMaillage aType = aMeshInfo->GetType();
2725 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2726 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2727 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2728 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2729 if(aType == MED::eNON_STRUCTURE){
2730 MED::PElemInfo anElemInfo;
2732 case MED::ePOLYGONE: {
2733 anElemInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
2736 case MED::ePOLYEDRE: {
2737 anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
2741 anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
2745 if(TInt aNbElem = anElemInfo->GetNbElem()){
2746 VISU::TSubMeshID aSubMeshID;
2747 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2748 if(anElemInfo->GetFamNum(iElem) == anId)
2749 aSubMeshID.push_back(iElem);
2750 if(!aSubMeshID.empty()){
2751 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2752 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
2753 aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
2758 MED::PGrilleInfo anElemInfo = theMed->GetPGrilleInfo(aMeshInfo);
2760 TInt aNbElem = anElemInfo->GetNbCells();
2761 if(aNbElem>0 && (aMGeom == anElemInfo->GetGeom()) ){
2762 VISU::TSubMeshID aSubMeshID;
2763 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2764 if(anElemInfo->GetFamNum(iElem) == anId)
2765 aSubMeshID.push_back(iElem);
2766 if(!aSubMeshID.empty()){
2767 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2768 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
2769 aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
2776 theFamily->myIsDone = true;
2781 }catch(std::exception& exc){
2784 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2792 //---------------------------------------------------------------
2794 LoadProfile(const MED::PWrapper& theMed,
2795 VISU::PMEDMesh theMesh,
2796 MED::PTimeStampValueBase theTimeStampValue,
2797 VISU::TMEDValForTime& theValForTime,
2798 VISU::TMEDMeshOnEntity& theMeshOnEntity)
2800 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadProfile");
2801 INITMSG(MYDEBUG,"LoadProfile"<<endl);
2803 VISU::PMEDProfile aProfile = theValForTime.myProfile;
2804 if(aProfile->myIsDone)
2807 const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
2808 const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
2809 MED::TGeom2Profile::const_iterator anIter = aGeom2Profile.begin();
2810 for(; anIter != aGeom2Profile.end(); anIter++){
2811 MED::PProfileInfo aProfileInfo = anIter->second;
2812 MED::EGeometrieElement aMGeom = anIter->first;
2813 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2815 VISU::TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aEGeom);
2816 if(anIter2 != aGeom2SubProfile.end()){
2817 VISU::PMEDSubProfile aSubProfile = anIter2->second;
2819 MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
2820 if(!anElemNum.empty()){
2821 VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
2822 TInt aSize = anElemNum.size();
2823 aSubMeshID.resize(aSize);
2824 for(TInt anId = 0; anId < aSize; anId++)
2825 aSubMeshID[anId] = anElemNum[anId] - 1;
2829 "- aEGeom = "<<aEGeom<<
2830 "; aNbCells = "<<aSubProfile->mySubMeshID.size()<<
2835 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2837 VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
2838 MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
2840 const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
2841 VISU::TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
2842 for(; anIter != aGeom2SubProfile.end(); anIter++){
2843 const VISU::PMEDSubProfile& aSubProfile = anIter->second;
2844 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
2845 MED::PElemInfo anElemInfo;
2846 anElemInfo = theMed->GetPElemInfo(aMeshInfo,aMEntity,aMGeom);
2847 aSubProfile->myIsElemNum = anElemInfo->IsElemNum();
2848 aSubProfile->myElemNum = anElemInfo->myElemNum;
2852 aProfile->myIsDone = true;
2856 //---------------------------------------------------------------
2858 LoadGaussMesh(const MED::PWrapper& theMed,
2859 VISU::PMEDMesh theMesh,
2860 MED::PTimeStampValueBase theTimeStampValue,
2861 VISU::TMEDValForTime& theValForTime,
2862 VISU::TMEDMeshOnEntity& theMeshOnEntity)
2864 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadGaussMesh");
2865 INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
2867 // this part of code must be reimplemented in connection with GRILLE structures
2868 if(theMesh->myMeshInfo->GetType() == MED::eSTRUCTURE)
2869 EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
2871 VISU::PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
2872 if(!aGaussMesh || aGaussMesh->myIsDone)
2875 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2876 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
2878 VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
2879 MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
2881 const VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
2882 const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
2883 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
2885 VISU::TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin();
2886 for(; aSubMeshIter != aGeom2GaussSubMesh.end(); aSubMeshIter++){
2887 VISU::PMEDGaussSubMesh aGaussSubMesh = aSubMeshIter->second;
2888 VISU::EGeometry aEGeom = aSubMeshIter->first;
2890 if(aGaussSubMesh->myIsDone)
2893 VISU::PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
2894 const VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
2895 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
2897 MED::PPolygoneInfo aPolygoneInfo;
2898 MED::PPolyedreInfo aPolyedreInfo;
2899 MED::PCellInfo aCellInfo;
2900 MED::PElemInfo anElemInfo;
2903 case MED::ePOLYGONE:
2904 aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,
2907 anElemInfo = aPolygoneInfo;
2909 case MED::ePOLYEDRE:
2910 aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,
2913 anElemInfo = aPolyedreInfo;
2916 aCellInfo = theMed->GetPCellInfo(aMeshInfo,
2919 anElemInfo = aCellInfo;
2921 aGaussSubMesh->myIsElemNum = anElemInfo->IsElemNum();
2922 aGaussSubMesh->myElemNum = anElemInfo->myElemNum;
2925 bool anIsGaussCoord3D = false;
2926 MED::PGaussCoord aGaussCoordPtr(new MED::TGaussCoord());
2927 MED::TGaussCoord& aGaussCoord = *aGaussCoordPtr;
2929 MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
2930 if(aGaussIter != aGeom2Gauss.end()){
2931 VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss;
2932 MED::PGaussInfo aGaussInfo = aGauss->myGaussInfo;
2934 aName = aGaussInfo->GetName();
2935 if(!aSubMeshID.empty()){
2936 const std::string& aProfileName = aSubProfile->myName;
2937 MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed,
2940 const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
2941 anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo,
2948 anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo,
2954 if(!aSubMeshID.empty()){
2955 const std::string& aProfileName = aSubProfile->myName;
2956 MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed,
2959 const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
2961 case MED::ePOLYGONE:
2962 anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo,
2967 case MED::ePOLYEDRE:
2968 anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo,
2974 anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo,
2982 case MED::ePOLYGONE:
2983 anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo,
2987 case MED::ePOLYEDRE:
2988 anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo,
2993 anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo,
2999 if(anIsGaussCoord3D){
3000 VISU::TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
3001 VISU::TMEDGaussCoordHolder* aCoordHolder = new VISU::TMEDGaussCoordHolder();
3002 aCoordHolder->Init(aGaussCoordPtr);
3003 aCoords.Init(VISU::PCoordHolder(aCoordHolder));
3005 aGaussSubMesh->myIsDone = true;
3007 TInt aNbGauss = aGaussCoord.GetNbGauss();
3008 TInt aNbElem = aGaussCoord.GetNbElem();
3009 TInt aNbCells = aNbElem*aNbGauss;
3012 "- aEGeom = "<<aEGeom<<
3013 "; aName = '"<<aName<<"'"<<
3014 "; aStatus = "<<aGaussSubMesh->myStatus<<
3015 "; aNbElem = "<<aNbElem<<
3016 "; aNbGauss = "<<aNbGauss<<
3017 "; aNbCells = "<<aNbCells<<
3020 EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
3023 aGaussMesh->myIsDone = true;
3027 //---------------------------------------------------------------
3028 template<class TimeStampValueType>
3030 FillValForTime(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
3031 const VISU::TGeom2SubProfile& theGeom2SubProfile,
3032 VISU::PMEDValForTime theValForTime,
3033 VISU::PMEDField theField)
3035 theField->myDataSize = 0;
3036 TInt aNbComp = theField->myNbComp;
3038 VISU::TGeom2SubProfile::const_iterator anIter = theGeom2SubProfile.begin();
3039 for(; anIter != theGeom2SubProfile.end(); anIter++){
3040 VISU::EGeometry aEGeom = anIter->first;
3041 VISU::PMEDSubProfile aSubProfile(anIter->second);
3043 TInt aNbElem = aSubProfile->myNbCells;
3044 theField->myDataSize += aNbElem * aNbComp;
3046 if(aSubProfile->myStatus != VISU::eRemoveAll){
3047 TInt aNbGauss = theValForTime->GetNbGauss(aEGeom);
3050 "- aEGeom = "<<aEGeom<<
3051 "; aNbElem = "<<aNbElem<<
3052 "; aNbGauss = "<<aNbGauss<<
3055 VISU::PMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
3056 typedef typename TimeStampValueType::TElement TElement;
3057 typedef VISU::TTMEDMeshValue<TElement> TVMeshValue;
3058 TVMeshValue* aMeshValue = new TVMeshValue();
3060 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
3061 typedef typename TimeStampValueType::PTMeshValue PTMeshValue;
3062 PTMeshValue aMeshValuePtr = theTimeStampValue->GetMeshValuePtr(aMGeom);
3063 aMeshValue->Init(aNbElem, aNbGauss, aNbComp, aMeshValuePtr);
3064 aVMeshValue.reset(aMeshValue);
3069 //---------------------------------------------------------------
3071 LoadValForTime(const MED::PWrapper& theMed,
3072 VISU::PMEDMesh theMesh,
3073 VISU::PMEDMeshOnEntity theMeshOnEntity,
3074 VISU::PMEDField theField,
3075 VISU::PMEDValForTime theValForTime,
3079 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTime");
3080 INITMSG(MYDEBUG,"LoadValForTime - theIsGauss = "<<theIsGauss<<endl);
3082 //Check on loading already done
3087 const std::string& aMeshName = theMeshOnEntity->myMeshName;
3088 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
3089 MED::PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,
3092 MED::TGeom2Size aGeom2Size;
3093 MED::EEntiteMaillage aMEntity;
3094 theMed->GetNbTimeStamps(aFieldInfo,
3095 theMesh->myEntityInfo,
3099 MED::PTimeStampInfo aTimeStampInfo =
3100 theMed->GetPTimeStampInfo(aFieldInfo,
3103 theValForTime->myId);
3105 MED::TKey2Gauss aKey2Gauss = GetKey2Gauss(theMed);
3106 MED::TMKey2Profile aMKey2Profile = GetMKey2Profile(theMed);
3108 MED::PTimeStampValueBase aTimeStampValue =
3109 theMed->GetPTimeStampValue(aTimeStampInfo,
3128 InitGaussMesh(aTimeStampValue,
3133 LoadGaussMesh(theMed,
3140 VISU::PMEDProfile aProfile = theValForTime->myProfile;
3141 VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
3144 "- aMeshName = '"<<aMeshName<<"'"<<
3145 "; aFieldName = '"<<aFieldInfo->GetName()<<"'"<<
3146 "; aMEntity = "<<aMEntity<<
3147 "; aNbComp = "<<theField->myNbComp<<
3150 if(aFieldInfo->GetType() == MED::eFLOAT64)
3151 FillValForTime<MED::TFloatTimeStampValue>(CastToFloatTimeStampValue(aTimeStampValue),
3156 FillValForTime<MED::TIntTimeStampValue>(CastToIntTimeStampValue(aTimeStampValue),
3166 //---------------------------------------------------------------
3169 ::LoadValForTimeOnMesh(const MED::PWrapper& theMed,
3170 VISU::PMEDMesh theMesh,
3171 VISU::PMEDMeshOnEntity theMeshOnEntity,
3172 VISU::PMEDField theField,
3173 VISU::PMEDValForTime theValForTime)
3175 VISU::PUnstructuredGridIDMapperImpl anUnstructuredGridIDMapper = theValForTime->myUnstructuredGridIDMapper;
3176 return LoadValForTime(theMed,
3182 anUnstructuredGridIDMapper->myIsVTKDone);
3186 //---------------------------------------------------------------
3189 ::LoadValForTimeOnGaussPts(const MED::PWrapper& theMed,
3190 VISU::PMEDMesh theMesh,
3191 VISU::PMEDMeshOnEntity theMeshOnEntity,
3192 VISU::PMEDField theField,
3193 VISU::PMEDValForTime theValForTime)
3195 VISU::PGaussPtsIDFilter aGaussPtsIDFilter = theValForTime->myGaussPtsIDFilter;
3196 return LoadValForTime(theMed,
3202 aGaussPtsIDFilter->myIsVTKDone);