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::TMinMaxArr& theMinMaxArr,
1598 VISU::TMinMaxArr& theAverageMinMaxArr,
1599 VISU::TGroup2MinMaxArr& theGroup2MinMaxArr,
1600 VISU::TGroup2MinMaxArr& theGroup2AverageMinMaxArr,
1604 const VISU::TFamilyIDMap& aFamilyIDMap = theMeshOnEntity->myFamilyIDMap;
1605 VISU::TGeom2ElemID2FamilyID aGeom2ElemID2FamilyID = theMeshOnEntity->myGeom2ElemID2FamilyID;
1607 const typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValue->myGeom2Value;
1608 typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
1609 for(; anIter != aGeom2Value.end(); anIter++){
1610 const typename TimeStampValueType::TTMeshValue& aMMeshValue = anIter->second;
1611 MED::EGeometrieElement aMGeom = anIter->first;
1613 TInt aNbElem = aMMeshValue.myNbElem;
1614 TInt aNbGauss = aMMeshValue.myNbGauss;
1616 MED::TGeom2Gauss::const_iterator aGaussIter = theGeom2Gauss.find(aMGeom);
1617 if(aGaussIter == theGeom2Gauss.end())
1621 "- aMGeom = "<<aMGeom<<
1622 "; aNbElem = "<<aNbElem<<
1623 "; aNbGauss = "<<aNbGauss<<
1626 VISU::TElemID2FamilyID anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom];
1628 bool isAverageByGaussPoints = (aNbGauss > 1);
1629 // To calculate min/max per components
1630 for(TInt iElem = 0; iElem < aNbElem; iElem++){
1631 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
1632 for(TInt iComp = 0; iComp < theNbComp; iComp++){
1633 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
1634 VISU::TMinMax& aMinMax = theMinMaxArr[iComp+1];
1635 vtkFloatingPointType& aMin = aMinMax.first;
1636 vtkFloatingPointType& aMax = aMinMax.second;
1637 VISU::TMinMax& anAverageMinMax = theAverageMinMaxArr[iComp+1];
1638 vtkFloatingPointType& anAverageMin = anAverageMinMax.first;
1639 vtkFloatingPointType& anAverageMax = anAverageMinMax.second;
1640 vtkFloatingPointType anAverageValue = 0.0;
1642 VISU::TGroup2MinMax& aGroup2MinMax = theGroup2MinMaxArr[iComp+1];
1643 VISU::TGroup2MinMax& aGroup2AverageMinMax = theGroup2AverageMinMaxArr[iComp+1];
1644 std::map<VISU::TName,vtkFloatingPointType> aGroup2AverageValue;
1646 // get names of groups, to which the element belongs
1647 VISU::TNames aGroupNames;
1648 VISU::TElemID2FamilyID::const_iterator anIter = anElemID2FamilyID.find(iElem);
1649 if(anIter != anElemID2FamilyID.end()){
1650 int aFamilyId = anIter->second;
1652 VISU::TFamilyIDMap::const_iterator aFamilyIter = aFamilyIDMap.find(aFamilyId);
1653 if(aFamilyIter != aFamilyIDMap.end()){
1654 VISU::PMEDFamily aFamily = aFamilyIter->second;
1655 aGroupNames = aFamily->myGroupNames;
1656 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1657 for(; aGroupIter != aGroupNames.end(); aGroupIter++)
1658 aGroup2AverageValue[*aGroupIter] = 0.0;
1663 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1664 const vtkFloatingPointType& aVal = aMValueSlice[iGauss];
1665 aMin = isnan(aVal) ? aVal : std::min(aMin,aVal);
1666 aMax = isnan(aVal) ? aVal : std::max(aMax,aVal);
1667 if(isAverageByGaussPoints){
1668 anAverageValue += aVal;
1671 anAverageMin = aMin;
1672 anAverageMax = aMax;
1675 // additional calculation for each group, to which the element belongs
1676 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1677 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1678 VISU::TName aGroupName = *aGroupIter;
1679 bool isGroupFound = aGroup2MinMax.find(aGroupName) != aGroup2MinMax.end();
1680 VISU::TMinMax& aGroupMinMax = aGroup2MinMax[aGroupName];
1681 vtkFloatingPointType& aGroupMin = aGroupMinMax.first;
1682 vtkFloatingPointType& aGroupMax = aGroupMinMax.second;
1683 aGroupMin = isGroupFound ? std::min(aGroupMin,aVal) : aVal;
1684 aGroupMax = isGroupFound ? std::max(aGroupMax,aVal) : aVal;
1686 if(isAverageByGaussPoints){
1687 aGroup2AverageValue[aGroupName] = aGroup2AverageValue[aGroupName] + aVal;
1690 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1691 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1692 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1693 aGroupAverageMin = aGroupMin;
1694 aGroupAverageMax = aGroupMax;
1698 if(isAverageByGaussPoints){
1699 anAverageValue /= aNbGauss;
1700 anAverageMin = std::min(anAverageMin,anAverageValue);
1701 anAverageMax = std::max(anAverageMax,anAverageValue);
1703 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1704 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1705 VISU::TName aGroupName = *aGroupIter;
1706 vtkFloatingPointType aGroupAverageValue = aGroup2AverageValue[aGroupName] / aNbGauss;
1707 bool isGroupFound = aGroup2AverageMinMax.find(aGroupName) != aGroup2AverageMinMax.end();
1708 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1709 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1710 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1711 aGroupAverageMin = isGroupFound ? std::min(aGroupAverageMin,aGroupAverageValue) : aGroupAverageValue;
1712 aGroupAverageMax = isGroupFound ? std::max(aGroupAverageMax,aGroupAverageValue) : aGroupAverageValue;
1718 // To calculate min/max per vector modulus
1719 VISU::TMinMax& aMinMax = theMinMaxArr[0];
1720 vtkFloatingPointType& aMin = aMinMax.first;
1721 vtkFloatingPointType& aMax = aMinMax.second;
1722 VISU::TMinMax& anAverageMinMax = theAverageMinMaxArr[0];
1723 vtkFloatingPointType& anAverageMin = anAverageMinMax.first;
1724 vtkFloatingPointType& anAverageMax = anAverageMinMax.second;
1726 VISU::TGroup2MinMax& aGroup2MinMax = theGroup2MinMaxArr[0];
1727 VISU::TGroup2MinMax& aGroup2AverageMinMax = theGroup2AverageMinMaxArr[0];
1729 for(TInt iElem = 0; iElem < aNbElem; iElem++){
1730 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
1732 // get names of groups, to which the element belongs
1733 VISU::TNames aGroupNames;
1734 VISU::TElemID2FamilyID::const_iterator anIter = anElemID2FamilyID.find(iElem);
1735 if(anIter != anElemID2FamilyID.end()){
1736 int aFamilyId = anIter->second;
1738 VISU::TFamilyIDMap::const_iterator aFamilyIter = aFamilyIDMap.find(aFamilyId);
1739 if(aFamilyIter != aFamilyIDMap.end()){
1740 VISU::PMEDFamily aFamily = aFamilyIter->second;
1741 aGroupNames = aFamily->myGroupNames;
1746 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1747 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
1748 vtkFloatingPointType aValue = 0.0;
1749 for(TInt iComp = 0; iComp < theNbComp2; iComp++){
1750 vtkFloatingPointType aVal = aMValueSlice[iComp];
1751 aValue += aVal*aVal;
1753 aValue = sqrt(aValue);
1754 aMin = isnan(aValue) ? aValue : std::min(aMin,aValue);
1755 aMax = isnan(aValue) ? aValue : std::max(aMax,aValue);
1757 // additional calculation for each group, to which the element belongs
1758 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1759 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1760 VISU::TName aGroupName = *aGroupIter;
1761 bool isGroupFound = aGroup2MinMax.find(aGroupName) != aGroup2MinMax.end();
1762 VISU::TMinMax& aGroupMinMax = aGroup2MinMax[aGroupName];
1763 vtkFloatingPointType& aGroupMin = aGroupMinMax.first;
1764 vtkFloatingPointType& aGroupMax = aGroupMinMax.second;
1765 aGroupMin = isGroupFound ? std::min(aGroupMin,aValue) : aValue;
1766 aGroupMax = isGroupFound ? std::max(aGroupMax,aValue) : aValue;
1769 if(isAverageByGaussPoints){
1770 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMCompValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
1771 vtkFloatingPointType aValue = 0.0;
1772 for(TInt iComp = 0; iComp < theNbComp2; iComp++){
1773 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMCompValueSlice = aMCompValueSliceArr[iComp];
1774 vtkFloatingPointType anAverageValue = 0.0;
1775 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1776 const vtkFloatingPointType& aVal = aMCompValueSlice[iGauss];
1777 anAverageValue += aVal;
1779 anAverageValue /= aNbGauss;
1780 aValue += anAverageValue*anAverageValue;
1782 aValue = sqrt(aValue);
1783 anAverageMin = std::min(anAverageMin,aValue);
1784 anAverageMax = std::max(anAverageMax,aValue);
1786 // additional calculation for each group, to which the element belongs
1787 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1788 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1789 VISU::TName aGroupName = *aGroupIter;
1790 bool isGroupFound = aGroup2AverageMinMax.find(aGroupName) != aGroup2AverageMinMax.end();
1791 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1792 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1793 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1794 aGroupAverageMin = isGroupFound ? std::min(aGroupAverageMin,aValue) : aValue;
1795 aGroupAverageMax = isGroupFound ? std::max(aGroupAverageMax,aValue) : aValue;
1799 anAverageMin = aMin;
1800 anAverageMax = aMax;
1802 // additional calculation for each group, to which the element belongs
1803 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1804 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1805 VISU::TName aGroupName = *aGroupIter;
1806 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1807 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1808 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1809 aGroupAverageMin = aGroup2MinMax[aGroupName].first;
1810 aGroupAverageMax = aGroup2MinMax[aGroupName].second;
1818 //---------------------------------------------------------------
1826 VISU_Convertor_impl::BuildMinMax();
1828 TSetIsDone aSetIsDone(myIsMinMaxDone);
1829 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax");
1831 MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(myMed);
1832 MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(myMed);
1834 TInt aNbMeshes = myMed->GetNbMeshes();
1835 VISU::TMeshMap& aMeshMap = myMeshMap;
1837 INITMSG(MYDEBUG,"BuildMinMax - aNbMeshes = "<<aNbMeshes<<"\n");
1839 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
1843 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPMeshInfo");
1845 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
1846 std::string aMeshName = aMeshInfo->GetName();
1848 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
1849 if(anIter == aMeshMap.end())
1851 VISU::PMEDMesh aMesh = anIter->second;
1856 TInt aNbFields = myMed->GetNbFields();
1859 "- aMeshName = '"<<aMeshName<<"'"<<
1860 "; aNbFields = "<<aNbFields<<"\n");
1862 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
1864 for(TInt iField = 1; iField <= aNbFields; iField++){
1865 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()");
1867 MED::TErr anError = 0;
1868 MED::PFieldInfo aFieldInfo = myMed->GetPFieldInfo(aMeshInfo, iField, &anError);
1872 std::string aFieldName = aFieldInfo->GetName();
1873 INITMSG(MYDEBUG,"- aFieldName = '"<<aFieldName<<"'\n");
1875 MED::TGeom2Size aGeom2Size;
1876 MED::EEntiteMaillage aMEntity;
1877 TInt aNbTimeStamps = myMed->GetNbTimeStamps(aFieldInfo,
1881 if(aNbTimeStamps < 1)
1884 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
1885 VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
1886 VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
1887 VISU::PMEDField aField = aFieldMap[aFieldName];
1889 TInt aNbComp = aField->myNbComp;
1890 int aNbComp2 = aNbComp;
1891 if(aNbComp == 2 || aNbComp == 4)
1893 else if(aNbComp > 4)
1896 VISU::TMinMaxArr& aMinMaxArr = aField->myMinMaxArr;
1897 VISU::TMinMaxArr& anAverageMinMaxArr = aField->myAverageMinMaxArr;
1898 VISU::TGroup2MinMaxArr& aGroup2MinMaxArr = aField->myGroup2MinMaxArr;
1899 VISU::TGroup2MinMaxArr& aGroup2AverageMinMaxArr = aField->myGroup2AverageMinMaxArr;
1900 TSetIsDone aSetIsDone(aField->myIsMinMaxInitilized);
1901 for(TInt iTimeStamp = aNbTimeStamps; iTimeStamp >= 1; iTimeStamp--){
1902 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()");
1903 INITMSG(MYDEBUG,"- iTimeStamp = "<<iTimeStamp<<endl);
1911 MED::PTimeStampInfo aTimeStampInfo =
1912 myMed->GetPTimeStampInfo(aFieldInfo,
1917 MED::PTimeStampValueBase aTimeStampValue =
1918 myMed->GetPTimeStampValue(aTimeStampInfo,
1922 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
1924 if(aFieldInfo->GetType() == MED::eFLOAT64)
1925 BuildTimeStampMinMax<MED::TFloatTimeStampValue>(CastToFloatTimeStampValue(aTimeStampValue),
1931 aGroup2AverageMinMaxArr,
1935 BuildTimeStampMinMax<MED::TIntTimeStampValue>(CastToIntTimeStampValue(aTimeStampValue),
1941 aGroup2AverageMinMaxArr,
1946 }catch(Standard_Failure){
1947 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1948 MSG(MYDEBUG,"Follow signal was occured in:\n"<<aFail->GetMessageString());
1949 }catch(std::exception& exc){
1950 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1952 MSG(MYDEBUG,"Unknown exception !!!");
1956 for(TInt iComp = 0; iComp <= aNbComp; iComp++){
1957 VISU::TMinMax aMinMax = aField->GetMinMax(iComp, VISU::TNames());
1958 INITMSG(MYDEBUG,"- "<<iComp<<": "<<aMinMax.first<<"; "<<aMinMax.second<<endl);
1962 }catch(std::exception& exc){
1963 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1965 MSG(MYDEBUG,"Unknown exception !!!");
1970 }catch(std::exception& exc){
1971 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1973 MSG(MYDEBUG,"Unknown exception !!!");
1982 //---------------------------------------------------------------
1990 TSetIsDone aSetIsDone(myIsGroupsDone);
1991 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGroups");
1993 TInt aNbMeshes = myMed->GetNbMeshes();
1994 VISU::TMeshMap& aMeshMap = myMeshMap;
1996 INITMSG(MYDEBUG,"BuildGroups - aNbMeshes = "<<aNbMeshes<<"\n");
1998 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
2002 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
2004 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
2005 std::string aMeshName = aMeshInfo->GetName();
2007 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
2008 if(anIter == aMeshMap.end())
2010 VISU::PMEDMesh aMesh = anIter->second;
2012 INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
2014 MED::EMaillage aType = aMeshInfo->GetType();
2016 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
2018 MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo =
2019 MED::GetEntity2TGeom2ElemInfo(myMed, aMeshInfo, anEntityInfo);
2024 MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(myMed, aMeshInfo);
2026 if(aType == MED::eNON_STRUCTURE)
2027 BuildFamilyMap(aMesh,
2029 anEntity2TGeom2ElemInfo,
2033 BuildGrilleFamilyMap(aMesh,
2038 BuildGroupMap(aMesh,
2041 }catch(std::exception& exc){
2042 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2044 MSG(MYDEBUG,"Unknown exception !!!");
2049 }catch(std::exception& exc){
2050 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2052 MSG(MYDEBUG,"Unknown exception !!!");
2061 //---------------------------------------------------------------
2064 ::LoadMeshOnEntity(VISU::PMeshImpl theMesh,
2065 VISU::PMeshOnEntityImpl theMeshOnEntity)
2067 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnEntity");
2068 INITMSG(MYDEBUG,"LoadMeshOnEntity"<<endl);
2070 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2072 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2073 if(anEntity == VISU::NODE_ENTITY){
2074 isPointsUpdated += LoadPoints(myMed, theMesh);
2076 isPointsUpdated += LoadPoints(myMed, theMesh);
2077 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed, theMesh, theMeshOnEntity);
2080 return (isPointsUpdated || isCellsOnEntityUpdated);
2084 //---------------------------------------------------------------
2087 ::LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
2088 VISU::PMeshOnEntityImpl theMeshOnEntity,
2089 VISU::PFamilyImpl theFamily)
2091 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity");
2092 INITMSG(MYDEBUG,"LoadFamilyOnEntity"<<endl);
2094 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2096 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2097 if(anEntity == VISU::NODE_ENTITY){
2098 isPointsUpdated += LoadPointsOnFamily(myMed, theMesh, theFamily);
2100 isPointsUpdated += LoadPoints(myMed, theMesh);
2101 isCellsOnEntityUpdated += LoadCellsOnFamily(myMed, theMesh, theMeshOnEntity, theFamily);
2104 return (isPointsUpdated || isCellsOnEntityUpdated);
2108 //---------------------------------------------------------------
2111 ::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
2112 const VISU::TFamilySet& theFamilySet)
2114 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup");
2115 INITMSG(MYDEBUG,"LoadMeshOnGroup"<<endl);
2117 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2118 VISU::TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
2119 for(; aFamilyIter != theFamilySet.end(); aFamilyIter++){
2120 VISU::PMEDFamily aFamily = *aFamilyIter;
2121 const VISU::TEntity& anEntity = aFamily->myEntity;
2122 const VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
2123 isPointsUpdated += LoadPoints(myMed, theMesh);
2124 if(anEntity == VISU::NODE_ENTITY){
2125 isPointsUpdated += LoadPointsOnFamily(myMed, theMesh, aFamily);
2127 isCellsOnEntityUpdated += LoadCellsOnFamily(myMed,theMesh,aMeshOnEntity,aFamily);
2131 return (isPointsUpdated || isCellsOnEntityUpdated);
2135 //---------------------------------------------------------------
2138 ::LoadValForTimeOnMesh(VISU::PMeshImpl theMesh,
2139 VISU::PMeshOnEntityImpl theMeshOnEntity,
2140 VISU::PFieldImpl theField,
2141 VISU::PValForTimeImpl theValForTime)
2143 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh");
2144 INITMSG(MYDEBUG,"LoadValForTimeOnMesh"<<endl);
2146 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2147 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2148 isPointsUpdated += LoadPoints(myMed,theMesh);
2149 if(anEntity != VISU::NODE_ENTITY)
2150 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity);
2151 int isFieldUpdated = LoadValForTimeOnMesh(myMed,theMesh,theMeshOnEntity,theField,theValForTime);
2153 return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
2157 //---------------------------------------------------------------
2160 ::LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh,
2161 VISU::PMeshOnEntityImpl theMeshOnEntity,
2162 VISU::PFieldImpl theField,
2163 VISU::PValForTimeImpl theValForTime)
2165 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts");
2166 INITMSG(MYDEBUG,"LoadValForTimeOnGaussPts"<<endl);
2168 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2169 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2170 if(anEntity != VISU::NODE_ENTITY)
2171 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity);
2172 int isFieldUpdated = LoadValForTimeOnGaussPts(myMed,theMesh,theMeshOnEntity,theField,theValForTime);
2174 return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
2178 //---------------------------------------------------------------
2181 ::LoadPoints(const MED::PWrapper& theMed,
2182 VISU::PMEDMesh theMesh)
2184 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPoints");
2186 //Check on existing family
2187 VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
2188 aMeshOnEntity->myMeshName = theMesh->myName;
2189 aMeshOnEntity->myEntity = VISU::NODE_ENTITY;
2191 INITMSG(MYDEBUG,"LoadPoints - theMesh->myIsDone = "<<theMesh->myIsDone<<"'\n");
2193 //Check on loading already done
2194 if(theMesh->myIsDone)
2197 MED::EMaillage aType = theMesh->myMeshInfo->GetType();
2199 if(aType == MED::eNON_STRUCTURE){
2201 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
2202 TInt aNbElem = aNodeInfo->GetNbElem();
2204 VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
2205 aNamedPointCoords->Init(aNodeInfo, theMed->GetVersion());
2207 VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
2208 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
2210 aSubMesh->Init(MED::PElemInfo(aNodeInfo), theMed->GetVersion());
2211 aSubMesh->myNbCells = theMesh->myNbPoints;
2212 aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
2214 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2215 aCell2Connect.resize(aNbElem);
2216 for (int iElem = 0; iElem < aNbElem; iElem++)
2217 aCell2Connect[iElem] = VISU::TConnect(1,iElem);
2218 } // END NON_STRUCTURED
2219 else { // STRUCTURED
2221 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(theMesh->myMeshInfo);
2222 TInt aNbElem = aGrilleInfo->GetNbNodes();
2224 VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
2225 aNamedPointCoords->Init(aGrilleInfo);
2227 VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
2228 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
2230 aSubMesh->Init(aGrilleInfo);
2231 aSubMesh->myNbCells = theMesh->myNbPoints;
2232 aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
2234 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2235 aCell2Connect.resize(aNbElem);
2236 for(int iElem = 0; iElem < aNbElem; iElem++)
2237 aCell2Connect[iElem] = VISU::TConnect(1,iElem);
2241 theMesh->myIsDone = true;
2245 }catch(std::exception& exc){
2248 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2255 //---------------------------------------------------------------
2258 ::LoadPointsOnFamily(const MED::PWrapper& theMed,
2259 const VISU::PMEDMesh theMesh,
2260 const VISU::PMEDFamily theFamily)
2262 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPointsOnFamily");
2264 if(theFamily->myIsDone)
2267 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2268 MED::EMaillage aType = aMeshInfo->GetType();
2271 if(aType == MED::eNON_STRUCTURE){
2272 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
2273 TInt aNbElem = aNodeInfo->GetNbElem();
2276 TInt anId = theFamily->myId;
2277 VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
2278 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2279 if(aNodeInfo->GetFamNum(iElem) == anId)
2280 aSubMeshID.push_back(iElem);
2284 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo);
2285 TInt aNbElem = aGrilleInfo->GetNbNodes();
2288 TInt anId = theFamily->myId;
2289 VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
2290 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2291 if(aGrilleInfo->GetFamNumNode(iElem) == anId)
2292 aSubMeshID.push_back(iElem);
2296 theFamily->myIsDone = true;
2300 }catch(std::exception& exc){
2303 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2310 //---------------------------------------------------------------
2313 ::LoadCellsOnEntity(const MED::PWrapper& theMed,
2314 const VISU::PMEDMesh theMesh,
2315 const VISU::PMEDMeshOnEntity theMeshOnEntity)
2317 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnEntity");
2321 const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
2322 const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
2324 INITMSG(MYDEBUG,"LoadCellsOnEntity - aVEntity = "<<aVEntity<<"\n");
2326 if(theMeshOnEntity->myIsDone)
2329 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2331 MED::EMaillage aType = aMeshInfo->GetType();
2333 if(aType == MED::eSTRUCTURE){
2335 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo);
2336 TInt aNbPoints = aGrilleInfo->GetNbNodes();
2338 std::map<TInt,TInt> aNodeIdMap;
2339 EBooleen anIsNodeNum = MED::eFAUX;
2341 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2342 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2343 VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
2345 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2346 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2347 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2348 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"; aEGeom = "<<aEGeom<<"\n");
2350 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
2351 INITMSG(MYDEBUG,"aVNbNodes = "<<aVNbNodes<<"\n");
2353 TInt aNbElem = aGeom2SizeIter->second;//aGrilleInfo->GetNbCells();
2356 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2358 aSubMesh->Init(aGrilleInfo);
2359 aSubMesh->myNbCells = aNbElem;
2360 aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
2362 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2363 aCell2Connect.resize(aNbElem);
2365 TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
2366 VISU::TVector<TInt> aConnect(aMNbNodes);
2368 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2369 MED::TIntVector aConn = aGrilleInfo->GetConn(iElem);
2370 VISU::TConnect& anArray = aCell2Connect[iElem];
2371 anArray.resize(aVNbNodes);
2374 for(TInt iConn = 0; iConn < aMNbNodes; iConn++){
2375 aConnect[iConn] = aNodeIdMap[aConn[iConn] - 1];
2378 for(int iConn = 0; iConn < aMNbNodes; ++iConn){
2379 aConnect[iConn] = aConn[iConn];
2385 anArray[0] = aConnect[0];
2386 anArray[1] = aConnect[2];
2387 anArray[2] = aConnect[3];
2388 anArray[3] = aConnect[1];
2391 anArray[0] = aConnect[0];
2392 anArray[1] = aConnect[2];
2393 anArray[2] = aConnect[3];
2394 anArray[3] = aConnect[1];
2395 anArray[4] = aConnect[4];
2396 anArray[5] = aConnect[6];
2397 anArray[6] = aConnect[7];
2398 anArray[7] = aConnect[5];
2401 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2402 anArray[iNode] = aConnect[iNode];
2405 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2406 if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
2407 EXCEPTION(std::runtime_error,"LoadCellsOnEntity - "<<
2408 " aNbPoints("<<aNbPoints<<") "<<
2409 "<= anArray["<<iElem<<"]"<<
2411 "("<<anArray[iNode]<<") < 0");
2417 theMeshOnEntity->myIsDone = true;
2423 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
2424 TInt aNbPoints = aNodeInfo->GetNbElem();
2426 std::map<TInt,TInt> aNodeIdMap;
2427 #ifdef _EDF_NODE_IDS_
2428 EBooleen anIsNodeNum = MED::eFAUX;
2430 EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
2432 for(TInt i = 0; i < aNbPoints; i++){
2433 aNodeIdMap[aNodeInfo->GetElemNum(i)-1] = i;
2438 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2439 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2440 VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
2442 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2443 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2444 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2445 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"; aEGeom = "<<aEGeom<<"\n");
2447 case MED::ePOLYGONE: {
2448 MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
2449 TInt aNbElem = aPolygoneInfo->GetNbElem();
2451 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2453 aSubMesh->Init(MED::PElemInfo(aPolygoneInfo),theMed->GetVersion());
2454 aSubMesh->myNbCells = aNbElem;
2456 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2457 aCell2Connect.resize(aNbElem);
2459 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2460 MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem);
2461 TInt aNbConn = aPolygoneInfo->GetNbConn(iElem);
2462 aSubMesh->myCellsSize += aNbConn;
2463 VISU::TConnect& anArray = aCell2Connect[iElem];
2464 anArray.resize(aNbConn);
2465 for(TInt iConn = 0; iConn < aNbConn; iConn++)
2466 anArray[iConn] = aConnSlice[iConn] - 1;
2471 case MED::ePOLYEDRE: {
2472 MED::PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
2473 TInt aNbElem = aPolyedreInfo->GetNbElem();
2476 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2478 aSubMesh->Init(MED::PElemInfo(aPolyedreInfo),theMed->GetVersion());
2479 aSubMesh->myNbCells = aNbElem;
2481 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2482 aCell2Connect.resize(aNbElem);
2484 for(TInt iElem = 0; iElem < aNbElem; iElem++){
2485 MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem);
2486 VISU::TConnect& anArray = aCell2Connect[iElem];
2487 typedef std::set<TInt> TConnectSet;
2488 TConnectSet aConnectSet;
2489 TInt aNbFaces = aConnSliceArr.size();
2490 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
2491 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
2492 TInt aNbConn = aConnSlice.size();
2493 aSubMesh->myCellsSize += aNbConn;
2494 for(TInt iConn = 0; iConn < aNbConn; iConn++){
2495 aConnectSet.insert(aConnSlice[iConn]);
2499 int aNbConn = aConnectSet.size();
2500 anArray.resize(aNbConn);
2501 TConnectSet::iterator anIter = aConnectSet.begin();
2502 for(int i = 0; anIter != aConnectSet.end(); anIter++, i++){
2503 TInt anId = *anIter;
2504 anArray[i] = anId - 1;
2512 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
2513 INITMSG(MYDEBUG,"aVNbNodes = "<<aVNbNodes<<"\n");
2515 MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
2516 TInt aNbElem = aCellInfo->GetNbElem();
2519 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2521 aSubMesh->Init(MED::PElemInfo(aCellInfo), theMed->GetVersion());
2522 aSubMesh->myNbCells = aNbElem;
2523 aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
2525 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2526 aCell2Connect.resize(aNbElem);
2528 TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
2529 VISU::TVector<TInt> aConnect(aMNbNodes);
2531 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2532 MED::TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
2533 VISU::TConnect& anArray = aCell2Connect[iElem];
2534 anArray.resize(aVNbNodes);
2537 for(TInt iConn = 0; iConn < aMNbNodes; iConn++){
2538 aConnect[iConn] = aNodeIdMap[aConnSlice[iConn] - 1];
2541 for(int iConn = 0; iConn < aMNbNodes; iConn++){
2542 aConnect[iConn] = aConnSlice[iConn] - 1;
2547 #if !(defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2549 anArray[0] = aConnect[0];
2550 anArray[2] = aConnect[1];
2552 anArray[1] = aConnect[2];
2555 #if !(defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2557 anArray[0] = aConnect[0];
2558 anArray[2] = aConnect[1];
2559 anArray[4] = aConnect[2];
2561 anArray[1] = aConnect[3];
2562 anArray[3] = aConnect[4];
2563 anArray[5] = aConnect[5];
2566 #if !(defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2568 anArray[0] = aConnect[0];
2569 anArray[2] = aConnect[1];
2570 anArray[4] = aConnect[2];
2571 anArray[6] = aConnect[3];
2573 anArray[1] = aConnect[4];
2574 anArray[3] = aConnect[5];
2575 anArray[5] = aConnect[6];
2576 anArray[7] = aConnect[7];
2579 #if (defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2581 anArray[0] = aConnect[0];
2582 anArray[1] = aConnect[2];
2583 anArray[2] = aConnect[1];
2584 anArray[3] = aConnect[3];
2586 anArray[4] = aConnect[6];
2587 anArray[5] = aConnect[5];
2588 anArray[6] = aConnect[4];
2590 anArray[7] = aConnect[7];
2591 anArray[8] = aConnect[9];
2592 anArray[9] = aConnect[8];
2596 anArray[0] = aConnect[0];
2597 anArray[1] = aConnect[2];
2598 anArray[2] = aConnect[1];
2599 anArray[3] = aConnect[3];
2601 #if (defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2603 anArray[0] = aConnect[0];
2604 anArray[1] = aConnect[3];
2605 anArray[2] = aConnect[2];
2606 anArray[3] = aConnect[1];
2607 anArray[4] = aConnect[4];
2609 anArray[5] = aConnect[8];
2610 anArray[6] = aConnect[7];
2611 anArray[7] = aConnect[6];
2612 anArray[8] = aConnect[5];
2614 anArray[9] = aConnect[9];
2615 anArray[10] = aConnect[12];
2616 anArray[11] = aConnect[11];
2617 anArray[12] = aConnect[10];
2621 anArray[0] = aConnect[0];
2622 anArray[1] = aConnect[3];
2623 anArray[2] = aConnect[2];
2624 anArray[3] = aConnect[1];
2625 anArray[4] = aConnect[4];
2628 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2629 anArray[iNode] = aConnect[iNode];
2631 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2632 if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
2633 EXCEPTION(std::runtime_error,"LoadCellsOnEntity - "<<
2634 " aNbPoints("<<aNbPoints<<") "<<
2635 "<= anArray["<<iElem<<"]"<<
2637 "("<<anArray[iNode]<<") < 0");
2643 // END NON_STRUCTURED
2645 theMeshOnEntity->myIsDone = true;
2650 }catch(std::exception& exc){
2653 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2661 //---------------------------------------------------------------
2664 ::LoadCellsOnFamily(const MED::PWrapper& theMed,
2665 const VISU::PMEDMesh theMesh,
2666 const VISU::PMEDMeshOnEntity theMeshOnEntity,
2667 const VISU::PMEDFamily theFamily)
2669 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnFamily");
2673 const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
2674 const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
2676 INITMSG(MYDEBUG,"LoadCellsOnFamily - aVEntity = "<<aVEntity<<"\n");
2678 if(theFamily->myIsDone)
2681 TInt anId = theFamily->myId;
2683 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2684 VISU::TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
2685 MED::EMaillage aType = aMeshInfo->GetType();
2687 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2688 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2689 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2690 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2691 if(aType == MED::eNON_STRUCTURE){
2692 MED::PElemInfo anElemInfo;
2694 case MED::ePOLYGONE: {
2695 anElemInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
2698 case MED::ePOLYEDRE: {
2699 anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
2703 anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
2707 if(TInt aNbElem = anElemInfo->GetNbElem()){
2708 VISU::TSubMeshID aSubMeshID;
2709 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2710 if(anElemInfo->GetFamNum(iElem) == anId)
2711 aSubMeshID.push_back(iElem);
2712 if(!aSubMeshID.empty()){
2713 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2714 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
2715 aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
2720 MED::PGrilleInfo anElemInfo = theMed->GetPGrilleInfo(aMeshInfo);
2722 TInt aNbElem = anElemInfo->GetNbCells();
2723 if(aNbElem>0 && (aMGeom == anElemInfo->GetGeom()) ){
2724 VISU::TSubMeshID aSubMeshID;
2725 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2726 if(anElemInfo->GetFamNum(iElem) == anId)
2727 aSubMeshID.push_back(iElem);
2728 if(!aSubMeshID.empty()){
2729 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2730 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
2731 aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
2738 theFamily->myIsDone = true;
2743 }catch(std::exception& exc){
2746 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2754 //---------------------------------------------------------------
2756 LoadProfile(const MED::PWrapper& theMed,
2757 VISU::PMEDMesh theMesh,
2758 MED::PTimeStampValueBase theTimeStampValue,
2759 VISU::TMEDValForTime& theValForTime,
2760 VISU::TMEDMeshOnEntity& theMeshOnEntity)
2762 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadProfile");
2763 INITMSG(MYDEBUG,"LoadProfile"<<endl);
2765 VISU::PMEDProfile aProfile = theValForTime.myProfile;
2766 if(aProfile->myIsDone)
2769 const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
2770 const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
2771 MED::TGeom2Profile::const_iterator anIter = aGeom2Profile.begin();
2772 for(; anIter != aGeom2Profile.end(); anIter++){
2773 MED::PProfileInfo aProfileInfo = anIter->second;
2774 MED::EGeometrieElement aMGeom = anIter->first;
2775 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2777 VISU::TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aEGeom);
2778 if(anIter2 != aGeom2SubProfile.end()){
2779 VISU::PMEDSubProfile aSubProfile = anIter2->second;
2781 MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
2782 if(!anElemNum.empty()){
2783 VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
2784 TInt aSize = anElemNum.size();
2785 aSubMeshID.resize(aSize);
2786 for(TInt anId = 0; anId < aSize; anId++)
2787 aSubMeshID[anId] = anElemNum[anId] - 1;
2791 "- aEGeom = "<<aEGeom<<
2792 "; aNbCells = "<<aSubProfile->mySubMeshID.size()<<
2797 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2799 VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
2800 MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
2802 const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
2803 VISU::TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
2804 for(; anIter != aGeom2SubProfile.end(); anIter++){
2805 const VISU::PMEDSubProfile& aSubProfile = anIter->second;
2806 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
2807 MED::PElemInfo anElemInfo;
2808 anElemInfo = theMed->GetPElemInfo(aMeshInfo,aMEntity,aMGeom);
2809 aSubProfile->myIsElemNum = anElemInfo->IsElemNum();
2810 aSubProfile->myElemNum = anElemInfo->myElemNum;
2814 aProfile->myIsDone = true;
2818 //---------------------------------------------------------------
2820 LoadGaussMesh(const MED::PWrapper& theMed,
2821 VISU::PMEDMesh theMesh,
2822 MED::PTimeStampValueBase theTimeStampValue,
2823 VISU::TMEDValForTime& theValForTime,
2824 VISU::TMEDMeshOnEntity& theMeshOnEntity)
2826 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadGaussMesh");
2827 INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
2829 // this part of code must be reimplemented in connection with GRILLE structures
2830 if(theMesh->myMeshInfo->GetType() == MED::eSTRUCTURE)
2831 EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
2833 VISU::PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
2834 if(!aGaussMesh || aGaussMesh->myIsDone)
2837 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2838 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
2840 VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
2841 MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
2843 const VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
2844 const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
2845 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
2847 VISU::TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin();
2848 for(; aSubMeshIter != aGeom2GaussSubMesh.end(); aSubMeshIter++){
2849 VISU::PMEDGaussSubMesh aGaussSubMesh = aSubMeshIter->second;
2850 VISU::EGeometry aEGeom = aSubMeshIter->first;
2852 if(aGaussSubMesh->myIsDone)
2855 VISU::PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
2856 const VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
2857 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
2859 MED::PPolygoneInfo aPolygoneInfo;
2860 MED::PPolyedreInfo aPolyedreInfo;
2861 MED::PCellInfo aCellInfo;
2862 MED::PElemInfo anElemInfo;
2865 case MED::ePOLYGONE:
2866 aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,
2869 anElemInfo = aPolygoneInfo;
2871 case MED::ePOLYEDRE:
2872 aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,
2875 anElemInfo = aPolyedreInfo;
2878 aCellInfo = theMed->GetPCellInfo(aMeshInfo,
2881 anElemInfo = aCellInfo;
2883 aGaussSubMesh->myIsElemNum = anElemInfo->IsElemNum();
2884 aGaussSubMesh->myElemNum = anElemInfo->myElemNum;
2887 bool anIsGaussCoord3D = false;
2888 MED::PGaussCoord aGaussCoordPtr(new MED::TGaussCoord());
2889 MED::TGaussCoord& aGaussCoord = *aGaussCoordPtr;
2891 MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
2892 if(aGaussIter != aGeom2Gauss.end()){
2893 VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss;
2894 MED::PGaussInfo aGaussInfo = aGauss->myGaussInfo;
2896 aName = aGaussInfo->GetName();
2897 if(!aSubMeshID.empty()){
2898 const std::string& aProfileName = aSubProfile->myName;
2899 MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed,
2902 const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
2903 anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo,
2910 anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo,
2916 if(!aSubMeshID.empty()){
2917 const std::string& aProfileName = aSubProfile->myName;
2918 MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed,
2921 const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
2923 case MED::ePOLYGONE:
2924 anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo,
2929 case MED::ePOLYEDRE:
2930 anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo,
2936 anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo,
2944 case MED::ePOLYGONE:
2945 anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo,
2949 case MED::ePOLYEDRE:
2950 anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo,
2955 anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo,
2961 if(anIsGaussCoord3D){
2962 VISU::TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
2963 VISU::TMEDGaussCoordHolder* aCoordHolder = new VISU::TMEDGaussCoordHolder();
2964 aCoordHolder->Init(aGaussCoordPtr);
2965 aCoords.Init(VISU::PCoordHolder(aCoordHolder));
2967 aGaussSubMesh->myIsDone = true;
2969 TInt aNbGauss = aGaussCoord.GetNbGauss();
2970 TInt aNbElem = aGaussCoord.GetNbElem();
2971 TInt aNbCells = aNbElem*aNbGauss;
2974 "- aEGeom = "<<aEGeom<<
2975 "; aName = '"<<aName<<"'"<<
2976 "; aStatus = "<<aGaussSubMesh->myStatus<<
2977 "; aNbElem = "<<aNbElem<<
2978 "; aNbGauss = "<<aNbGauss<<
2979 "; aNbCells = "<<aNbCells<<
2982 EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
2985 aGaussMesh->myIsDone = true;
2989 //---------------------------------------------------------------
2990 template<class TimeStampValueType>
2992 FillValForTime(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
2993 const VISU::TGeom2SubProfile& theGeom2SubProfile,
2994 VISU::PMEDValForTime theValForTime,
2995 VISU::PMEDField theField)
2997 theField->myDataSize = 0;
2998 TInt aNbComp = theField->myNbComp;
3000 VISU::TGeom2SubProfile::const_iterator anIter = theGeom2SubProfile.begin();
3001 for(; anIter != theGeom2SubProfile.end(); anIter++){
3002 VISU::EGeometry aEGeom = anIter->first;
3003 VISU::PMEDSubProfile aSubProfile(anIter->second);
3005 TInt aNbElem = aSubProfile->myNbCells;
3006 theField->myDataSize += aNbElem * aNbComp;
3008 if(aSubProfile->myStatus != VISU::eRemoveAll){
3009 TInt aNbGauss = theValForTime->GetNbGauss(aEGeom);
3012 "- aEGeom = "<<aEGeom<<
3013 "; aNbElem = "<<aNbElem<<
3014 "; aNbGauss = "<<aNbGauss<<
3017 VISU::PMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
3018 typedef typename TimeStampValueType::TElement TElement;
3019 typedef VISU::TTMEDMeshValue<TElement> TVMeshValue;
3020 TVMeshValue* aMeshValue = new TVMeshValue();
3022 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
3023 typedef typename TimeStampValueType::PTMeshValue PTMeshValue;
3024 PTMeshValue aMeshValuePtr = theTimeStampValue->GetMeshValuePtr(aMGeom);
3025 aMeshValue->Init(aNbElem, aNbGauss, aNbComp, aMeshValuePtr);
3026 aVMeshValue.reset(aMeshValue);
3031 //---------------------------------------------------------------
3033 LoadValForTime(const MED::PWrapper& theMed,
3034 VISU::PMEDMesh theMesh,
3035 VISU::PMEDMeshOnEntity theMeshOnEntity,
3036 VISU::PMEDField theField,
3037 VISU::PMEDValForTime theValForTime,
3041 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTime");
3042 INITMSG(MYDEBUG,"LoadValForTime - theIsGauss = "<<theIsGauss<<endl);
3044 //Check on loading already done
3049 const std::string& aMeshName = theMeshOnEntity->myMeshName;
3050 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
3051 MED::PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,
3054 MED::TGeom2Size aGeom2Size;
3055 MED::EEntiteMaillage aMEntity;
3056 theMed->GetNbTimeStamps(aFieldInfo,
3057 theMesh->myEntityInfo,
3061 MED::PTimeStampInfo aTimeStampInfo =
3062 theMed->GetPTimeStampInfo(aFieldInfo,
3065 theValForTime->myId);
3067 MED::TKey2Gauss aKey2Gauss = GetKey2Gauss(theMed);
3068 MED::TMKey2Profile aMKey2Profile = GetMKey2Profile(theMed);
3070 MED::PTimeStampValueBase aTimeStampValue =
3071 theMed->GetPTimeStampValue(aTimeStampInfo,
3090 InitGaussMesh(aTimeStampValue,
3095 LoadGaussMesh(theMed,
3102 VISU::PMEDProfile aProfile = theValForTime->myProfile;
3103 VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
3106 "- aMeshName = '"<<aMeshName<<"'"<<
3107 "; aFieldName = '"<<aFieldInfo->GetName()<<"'"<<
3108 "; aMEntity = "<<aMEntity<<
3109 "; aNbComp = "<<theField->myNbComp<<
3112 if(aFieldInfo->GetType() == MED::eFLOAT64)
3113 FillValForTime<MED::TFloatTimeStampValue>(CastToFloatTimeStampValue(aTimeStampValue),
3118 FillValForTime<MED::TIntTimeStampValue>(CastToIntTimeStampValue(aTimeStampValue),
3128 //---------------------------------------------------------------
3131 ::LoadValForTimeOnMesh(const MED::PWrapper& theMed,
3132 VISU::PMEDMesh theMesh,
3133 VISU::PMEDMeshOnEntity theMeshOnEntity,
3134 VISU::PMEDField theField,
3135 VISU::PMEDValForTime theValForTime)
3137 VISU::PUnstructuredGridIDMapperImpl anUnstructuredGridIDMapper = theValForTime->myUnstructuredGridIDMapper;
3138 return LoadValForTime(theMed,
3144 anUnstructuredGridIDMapper->myIsVTKDone);
3148 //---------------------------------------------------------------
3151 ::LoadValForTimeOnGaussPts(const MED::PWrapper& theMed,
3152 VISU::PMEDMesh theMesh,
3153 VISU::PMEDMeshOnEntity theMeshOnEntity,
3154 VISU::PMEDField theField,
3155 VISU::PMEDValForTime theValForTime)
3157 VISU::PGaussPtsIDFilter aGaussPtsIDFilter = theValForTime->myGaussPtsIDFilter;
3158 return LoadValForTime(theMed,
3164 aGaussPtsIDFilter->myIsVTKDone);