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>
54 static int MYDEBUG = 0;
55 static int MYVALUEDEBUG = 0;
56 static int MY_FAMILY_DEBUG = 0;
57 static int MY_GROUP_DEBUG = 0;
60 static int MYDEBUG = 0;
61 static int MYVALUEDEBUG = 0;
62 static int MY_FAMILY_DEBUG = 0;
63 static int MY_GROUP_DEBUG = 0;
66 #define _LOAD_FAMILIES_
67 #define _EDF_NODE_IDS_
73 //---------------------------------------------------------------
75 MEDGeom2NbNodes(MED::EGeometrieElement theMEDGeomType)
77 return theMEDGeomType % 100;
81 //---------------------------------------------------------------
83 MEDGeom2VISU(MED::EGeometrieElement theGeom)
86 case MED::ePOINT1: return VISU::ePOINT1;
87 case MED::eSEG2: return VISU::eSEG2;
88 case MED::eTRIA3: return VISU::eTRIA3;
89 case MED::eQUAD4: return VISU::eQUAD4;
90 case MED::eTETRA4: return VISU::eTETRA4;
91 case MED::eHEXA8: return VISU::eHEXA8;
92 case MED::ePENTA6: return VISU::ePENTA6;
93 case MED::ePYRA5: return VISU::ePYRA5;
95 case MED::eSEG3: return VISU::eSEG3;
96 case MED::eTRIA6: return VISU::eTRIA6;
97 case MED::eQUAD8: return VISU::eQUAD8;
98 case MED::eTETRA10: return VISU::eTETRA10;
99 case MED::eHEXA20: return VISU::eHEXA20;
100 case MED::ePENTA15: return VISU::ePENTA15;
101 case MED::ePYRA13: return VISU::ePYRA13;
103 case MED::ePOLYGONE: return VISU::ePOLYGONE;
104 case MED::ePOLYEDRE: return VISU::ePOLYEDRE;
110 //---------------------------------------------------------------
111 MED::EGeometrieElement
112 VISUGeom2MED(int theGeom)
115 case VISU::ePOINT1: return MED::ePOINT1;
116 case VISU::eSEG2: return MED::eSEG2;
117 case VISU::eTRIA3: return MED::eTRIA3;
118 case VISU::eQUAD4: return MED::eQUAD4;
119 case VISU::eTETRA4: return MED::eTETRA4;
120 case VISU::eHEXA8: return MED::eHEXA8;
121 case VISU::ePENTA6: return MED::ePENTA6;
122 case VISU::ePYRA5: return MED::ePYRA5;
124 case VISU::eSEG3: return MED::eSEG3;
125 case VISU::eTRIA6: return MED::eTRIA6;
126 case VISU::eQUAD8: return MED::eQUAD8;
127 case VISU::eTETRA10: return MED::eTETRA10;
128 case VISU::eHEXA20: return MED::eHEXA20;
129 case VISU::ePENTA15: return MED::ePENTA15;
130 case VISU::ePYRA13: return MED::ePYRA13;
132 case VISU::ePOLYGONE: return MED::ePOLYGONE;
133 case VISU::ePOLYEDRE: return MED::ePOLYEDRE;
135 return MED::EGeometrieElement(-1);
139 //---------------------------------------------------------------
141 MEDEntityToVTK( MED::EEntiteMaillage theMEDEntity )
143 VISU::TEntity anEntity = VISU::TEntity( -1 );
145 switch(theMEDEntity){
147 anEntity = VISU::NODE_ENTITY;
150 anEntity = VISU::EDGE_ENTITY;
153 anEntity = VISU::FACE_ENTITY;
156 anEntity = VISU::CELL_ENTITY;
158 case MED::eNOEUD_ELEMENT :
159 anEntity = VISU::CELL_ENTITY;
167 //---------------------------------------------------------------
169 VTKEntityToMED(VISU::TEntity theVTKEntity)
171 switch(theVTKEntity){
172 case VISU::NODE_ENTITY: return MED::eNOEUD;
173 case VISU::EDGE_ENTITY: return MED::eARETE;
174 case VISU::FACE_ENTITY: return MED::eFACE;
175 case VISU::CELL_ENTITY: return MED::eMAILLE;
177 return MED::EEntiteMaillage(-1);
181 //---------------------------------------------------------------
183 CrSubProfile(const MED::PWrapper& theMEDWrapper,
184 const MED::PMeshInfo& theMeshInfo,
185 MED::EEntiteMaillage theMEntity,
186 MED::EGeometrieElement theMGeom,
187 const MED::TGeom2Size& theGeom2Size,
188 const MED::TGeom2Profile& theGeom2Profile)
190 VISU::EGeometry aEGeom = MEDGeom2VISU(theMGeom);
191 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
193 VISU::PMEDSubProfile aSubProfile(new VISU::TMEDSubProfile());
194 aSubProfile->myGeom = aEGeom;
195 aSubProfile->myMGeom = theMGeom;
196 aSubProfile->myStatus = VISU::eAddAll;
198 MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(theMGeom);
199 if(aTimeStampIter == theGeom2Size.end())
200 aSubProfile->myStatus = VISU::eRemoveAll;
202 MED::TGeom2Profile::const_iterator aProfileIter = theGeom2Profile.find(theMGeom);
203 if(aProfileIter != theGeom2Profile.end()){
204 MED::PProfileInfo aProfileInfo = aProfileIter->second;
206 aSubProfile->myName = aProfileInfo->GetName();
207 aSubProfile->myStatus = VISU::eAddPart;
209 const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
210 TInt aNbElem = anElemNum.size();
211 aSubProfile->myNbCells = aNbElem;
213 case MED::ePOLYGONE: {
214 MED::PPolygoneInfo aPolygoneInfo =
215 theMEDWrapper->GetPPolygoneInfo(theMeshInfo,theMEntity,theMGeom);
216 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
217 TInt aNbConn = aPolygoneInfo->GetNbConn( anElemNum[ anElemId ] - 1 );
218 aSubProfile->myCellsSize += aNbConn;
222 case MED::ePOLYEDRE: {
223 MED::PPolyedreInfo aPolyedreInfo =
224 theMEDWrapper->GetPPolyedreInfo(theMeshInfo,theMEntity,theMGeom);
225 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
226 MED::TCConnSliceArr aConnSliceArr =
227 aPolyedreInfo->GetConnSliceArr( anElemNum[ anElemId ] - 1 );
228 TInt aNbFaces = aConnSliceArr.size();
230 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
231 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
232 TInt aNbConn = aConnSlice.size();
233 aCellSize += aNbConn;
235 aSubProfile->myCellsSize += aCellSize;
240 aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes;
243 TInt aNbElem = aTimeStampIter->second;
244 aSubProfile->myNbCells = aNbElem;
246 case MED::ePOLYGONE: {
247 MED::PPolygoneInfo aPolygoneInfo =
248 theMEDWrapper->GetPPolygoneInfo(theMeshInfo,theMEntity,theMGeom);
249 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
250 TInt aNbConn = aPolygoneInfo->GetNbConn(anElemId);
251 aSubProfile->myCellsSize += aNbConn;
255 case MED::ePOLYEDRE: {
256 MED::PPolyedreInfo aPolyedreInfo =
257 theMEDWrapper->GetPPolyedreInfo(theMeshInfo,theMEntity,theMGeom);
258 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
259 MED::TCConnSliceArr aConnSliceArr =
260 aPolyedreInfo->GetConnSliceArr(anElemId);
261 TInt aNbFaces = aConnSliceArr.size();
263 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
264 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
265 TInt aNbConn = aConnSlice.size();
266 aCellSize += aNbConn;
268 aSubProfile->myCellsSize += aCellSize;
273 aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes;
278 "- aMGeom = "<<theMGeom<<
279 "; aEGeom = "<<aEGeom<<
280 "; aName = '"<<aSubProfile->myName<<"'"<<
281 "; aStatus = "<<aSubProfile->myStatus<<
282 "; aNbCells = "<<aSubProfile->myNbCells<<
283 "; aCellsSize = "<<aSubProfile->myCellsSize<<
290 //---------------------------------------------------------------
292 GetProfileKey(const MED::PWrapper& theMEDWrapper,
293 const MED::PMeshInfo& theMeshInfo,
294 const MED::PTimeStampValueBase& theTimeStampValue,
295 const VISU::TMEDMeshOnEntity& theMeshOnEntity,
296 MED::EEntiteMaillage theMEntity,
297 const MED::TGeom2Size& theGeom2Size)
299 INITMSG(MYDEBUG,"GetProfileKey"<<endl);
301 VISU::TProfileKey aProfileKey;
302 const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
304 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
305 MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin();
306 for(; anIter != aGeom2Size.end(); anIter++){
307 MED::EGeometrieElement aMGeom = anIter->first;
308 VISU::PSubProfile aSubProfile = CrSubProfile(theMEDWrapper,
314 aProfileKey.insert(aSubProfile);
321 //---------------------------------------------------------------
323 InitProfile(const MED::PWrapper& theMEDWrapper,
324 const MED::PMeshInfo& theMeshInfo,
325 MED::PTimeStampValueBase& theTimeStampValue,
326 VISU::TMEDMeshOnEntity& theMeshOnEntity,
327 MED::EEntiteMaillage theMEntity,
328 const MED::TGeom2Size& theGeom2Size,
329 VISU::TMEDValForTime& theValForTime)
331 VISU::TTimerLog aTimerLog(MYDEBUG,"InitProfile");
332 INITMSG(MYDEBUG,"InitProfile"<<endl);
334 VISU::TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap;
336 VISU::TProfileKey aProfileKey = GetProfileKey(theMEDWrapper,
343 VISU::TProfileMap::const_iterator anIter = aProfileMap.find(aProfileKey);
344 if(anIter != aProfileMap.end()){
345 theValForTime.myProfile = anIter->second;
346 INITMSG(MYDEBUG,"aProfileMap.find(aProfileKey)"<<endl);
348 VISU::PMEDProfile aProfile(new VISU::TMEDProfile());
349 VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
351 VISU::TProfileKey::const_iterator anIter = aProfileKey.begin();
352 for(; anIter != aProfileKey.end(); anIter++){
353 VISU::PMEDSubProfile aSubProfile(*anIter);
355 if(aProfile->myIsAll && aSubProfile->myStatus != VISU::eAddAll)
356 aProfile->myIsAll = false;
358 VISU::EGeometry aEGeom = aSubProfile->myGeom;
359 aGeom2SubProfile[aEGeom] = aSubProfile;
362 aProfileMap[aProfileKey] = aProfile;
363 theValForTime.myProfile = aProfile;
368 //---------------------------------------------------------------
370 GetGaussKey(const MED::PTimeStampValueBase& theTimeStampValue,
371 const VISU::TMEDMeshOnEntity& theMeshOnEntity,
372 const MED::TGeom2Size& theGeom2Size,
373 VISU::TMEDValForTime& theValForTime)
375 VISU::TTimerLog aTimerLog(MYDEBUG,"GetGaussKey");
376 INITMSG(MYDEBUG,"GetGaussKey"<<endl);
378 VISU::TGaussKey aGaussKey;
379 VISU::PMEDProfile aProfile = theValForTime.myProfile;
380 VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
382 const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
383 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
385 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
386 MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin();
387 for(; anIter != aGeom2Size.end(); anIter++){
388 MED::EGeometrieElement aMGeom = anIter->first;
389 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
391 VISU::TGeom2SubProfile::iterator anIter2 = aGeom2SubProfile.find(aEGeom);
392 if(anIter2 == aGeom2SubProfile.end()){
393 INITMSG(MYDEBUG,"anIter2 == aGeom2SubProfile.end!!"<<endl);
396 VISU::PMEDSubProfile aSubProfile = anIter2->second;
398 MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(aMGeom);
399 if(aTimeStampIter != theGeom2Size.end()){
400 TInt aNbCells = aTimeStampIter->second;
401 if(aSubProfile->myStatus == VISU::eAddPart)
402 aNbCells = aSubProfile->myNbCells;
404 VISU::PMEDGaussSubMesh aGaussSubMesh(new VISU::TMEDGaussSubMesh());
405 aGaussSubMesh->mySubProfile = aSubProfile;
406 aGaussSubMesh->myStatus = aSubProfile->myStatus;
408 VISU::PMEDGauss aGauss(new VISU::TMEDGauss());
409 aGaussSubMesh->myGauss = aGauss;
410 aGauss->myGeom = aEGeom;
411 aGauss->myNbPoints = 1;
413 MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
414 if(aGaussIter != aGeom2Gauss.end()){
415 MED::PGaussInfo aGaussInfo = aGaussIter->second;
416 aGauss->myGaussInfo = aGaussInfo;
417 aGauss->myName = aGaussInfo->GetName();
418 aGauss->myNbPoints = aGaussInfo->GetNbGauss();
419 } else if ( aTimeStampInfo.GetNbGauss(aMGeom) > 1 )
420 EXCEPTION( std::runtime_error, "aGaussIter == aGeom2Gauss.end()"
421 " && aTimeStampInfo.GetNbGauss(aMGeom) > 1 !!!" );
423 aGaussSubMesh->myNbCells = aNbCells*aGauss->myNbPoints;
424 aGaussSubMesh->myCellsSize = aGaussSubMesh->myNbCells*2;
426 aGaussKey.insert(aGaussSubMesh);
429 "- aEGeom = "<<aGauss->myGeom<<
430 "; aName = '"<<aGauss->myName<<"'"<<
431 "; aNbGauss = "<<aGauss->myNbPoints<<
432 "; aStatus = "<<aGaussSubMesh->myStatus<<
433 "; aNbCells = "<<aGaussSubMesh->myNbCells<<
434 "; aCellsSize = "<<aGaussSubMesh->myCellsSize<<
445 //---------------------------------------------------------------
447 InitGaussMesh(MED::PTimeStampValueBase& theTimeStampValue,
448 VISU::TMEDMeshOnEntity& theMeshOnEntity,
449 const MED::TGeom2Size& theGeom2Size,
450 VISU::TMEDValForTime& theValForTime)
452 VISU::TTimerLog aTimerLog(MYDEBUG,"InitGaussMesh");
453 INITMSG(MYDEBUG,"InitGaussMesh"<<endl);
455 if(theMeshOnEntity.myEntity == VISU::NODE_ENTITY)
458 VISU::TGaussMeshMap& aGaussMeshMap = theMeshOnEntity.myGaussMeshMap;
460 VISU::TGaussKey aGaussKey = GetGaussKey(theTimeStampValue,
465 VISU::TGaussMeshMap::const_iterator anIter = aGaussMeshMap.find(aGaussKey);
466 if(anIter != aGaussMeshMap.end()){
467 theValForTime.myGaussMesh = anIter->second;
468 INITMSG(MYDEBUG,"aGaussMeshMap.find(aGaussKey)"<<endl);
470 VISU::PMEDGaussMesh aGaussMesh(new VISU::TMEDGaussMesh());
471 VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
473 VISU::TGaussKey::const_iterator anIter = aGaussKey.begin();
474 for(; anIter != aGaussKey.end(); anIter++){
475 VISU::PMEDGaussSubMesh aGaussSubMesh(*anIter);
476 VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss;
477 VISU::EGeometry aEGeom = aGauss->myGeom;
478 aGeom2GaussSubMesh[aEGeom] = aGaussSubMesh;
482 VISU::TGaussSubMeshArr& aGaussSubMeshArr = aGaussMesh->myGaussSubMeshArr;
483 aGaussSubMeshArr.resize(aGeom2GaussSubMesh.size());
484 VISU::TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
485 for(TInt anID = 0; anIter != aGeom2GaussSubMesh.end(); anIter++, anID++){
486 const VISU::PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
487 aGaussSubMeshArr[anID] = aGaussSubMesh;
490 INITMSG(MYDEBUG,"aGaussMeshMap[aGaussKey] = aGaussMesh"<<std::endl);
491 aGaussMeshMap[aGaussKey] = aGaussMesh;
492 theValForTime.myGaussMesh = aGaussMesh;
496 //---------------------------------------------------------------
498 BuildMeshOnEntityMap(VISU::PMEDMesh theMesh,
499 const MED::TEntityInfo& theEntityInfo,
500 const MED::PNodeInfo& theNodeInfo,
501 const MED::PWrapper& theMEDWrapper)
503 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMeshOnEntityMap");
504 INITMSG(MYDEBUG,"BuildMeshOnEntityMap"<<endl);
506 MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
507 const std::string& aMeshName = theMesh->myName;
508 VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
509 MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
510 for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
511 const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
512 const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
514 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
515 VISU::PMEDMeshOnEntity aMeshOnEntity =
516 aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
517 aMeshOnEntity->myEntity = aVEntity;
518 aMeshOnEntity->myMeshName = aMeshName;
519 aMeshOnEntity->myGeom2Size = aGeom2Size;
520 VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
521 VISU::TGeom2ElemID2FamilyID& aGeom2ElemID2FamilyID = aMeshOnEntity->myGeom2ElemID2FamilyID;
524 "- aMEntity = "<<aMEntity<<
525 "; aVEntity = "<<aVEntity<<
528 if(aMEntity == MED::eNOEUD){
529 aMeshOnEntity->myNbCells = theMesh->myNbPoints;
530 aMeshOnEntity->myCellsSize = 2*theMesh->myNbPoints;
532 VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[MED::ePOINT1];
534 for(TInt iElem = 0; iElem < theMesh->myNbPoints; iElem++){
535 TInt aFamId = theNodeInfo->GetFamNum(iElem);
537 aFamilyID2CellsSize[aFamId] += 2;
538 anElemID2FamilyID[iElem] = aFamId;
542 "- myNbCells = "<<aMeshOnEntity->myNbCells<<
543 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
547 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
548 aMeshOnEntity->myNbCells = 0;
549 aMeshOnEntity->myCellsSize = 0;
550 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
551 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
553 VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom];
555 case MED::ePOLYGONE: {
556 MED::PPolygoneInfo aPolygoneInfo = theMEDWrapper->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
557 TInt aNbElem = aPolygoneInfo->GetNbElem();
560 "- aMGeom = "<<aMGeom<<
561 "; aNbElem = "<<aNbElem<<
564 aMeshOnEntity->myNbCells += aNbElem;
565 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
566 TInt aNbConn = aPolygoneInfo->GetNbConn(anElemId);
567 aMeshOnEntity->myCellsSize += aNbConn;
568 TInt aFamId = aPolygoneInfo->GetFamNum(anElemId);
570 aFamilyID2CellsSize[aFamId] += aNbConn + 1;
571 anElemID2FamilyID[anElemId] = aFamId;
575 case MED::ePOLYEDRE: {
576 MED::PPolyedreInfo aPolyedreInfo = theMEDWrapper->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
577 TInt aNbElem = aPolyedreInfo->GetNbElem();
580 "- aMGeom = "<<aMGeom<<
581 "; aNbElem = "<<aNbElem<<
584 aMeshOnEntity->myNbCells += aNbElem;
585 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
586 MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(anElemId);
587 TInt aNbFaces = aConnSliceArr.size();
589 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
590 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
591 TInt aNbConn = aConnSlice.size();
592 aCellSize += aNbConn;
594 aMeshOnEntity->myCellsSize += aCellSize;
595 TInt aFamId = aPolyedreInfo->GetFamNum(anElemId);
597 aFamilyID2CellsSize[aFamId] += aCellSize + 1;
598 anElemID2FamilyID[anElemId] = aFamId;
603 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
604 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
605 MED::PCellInfo aCellInfo = theMEDWrapper->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
606 TInt aNbElem = aCellInfo->GetNbElem();
607 aMeshOnEntity->myNbCells += aNbElem;
608 aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
611 "- aMGeom = "<<aMGeom<<
612 "; aNbElem = "<<aNbElem<<
613 "; myNbCells = "<<aMeshOnEntity->myNbCells<<
614 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
617 for(TInt iElem = 0; iElem < aNbElem; iElem++){
618 TInt aFamId = aCellInfo->GetFamNum(iElem);
620 aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
621 anElemID2FamilyID[iElem] = aFamId;
623 }} // end switch(...)
629 //---------------------------------------------------------------
631 BuildMeshGrilleOnEntityMap(VISU::PMEDMesh theMesh,
632 const MED::TEntityInfo& theEntityInfo,
633 const MED::PGrilleInfo& theGrilleInfo,
634 const MED::PWrapper& theMEDWrapper)
636 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMeshGrilleOnEntityMap");
637 INITMSG(MYDEBUG,"BuildMeshGrilleOnEntityMap"<<endl);
639 MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
640 const std::string& aMeshName = theMesh->myName;
641 VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
642 MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
644 VISU::TStructuredId& aGrilleStructure = theMesh->myGrilleStructure;
645 if ( theGrilleInfo->GetGrilleType() != MED::eGRILLE_STANDARD )
646 for ( int aDimId = 0; aDimId < theMesh->myDim; aDimId++ )
647 aGrilleStructure[aDimId] = theGrilleInfo->GetNbIndexes(aDimId);
649 MED::TIntVector aVector = theGrilleInfo->GetGrilleStructure();
650 for ( int aDimId = 0; aDimId < aVector.size(); aDimId++ )
651 aGrilleStructure[aDimId] = aVector[aDimId];
654 int kMax = aGrilleStructure[2];
655 int jMax = aGrilleStructure[1];
656 int iMax = aGrilleStructure[0];
659 VISU::TObj2StructuredId& aObj2StructuredId = theMesh->myObj2StructuredId;
660 switch ( theMesh->myDim ) {
662 for ( int i = 1; i <= iMax; i++ )
663 aObj2StructuredId[i-1][0] = i;
666 for ( int j = 1; j <= jMax; j++ )
667 for ( int i = 1; i <= iMax; i++ ) {
668 aObj2StructuredId[iii][0] = i;
669 aObj2StructuredId[iii][1] = j;
674 for ( int k = 1; k <= kMax; k++ )
675 for ( int j = 1; j <= jMax; j++ )
676 for ( int i = 1; i <= iMax; i++ ) {
677 aObj2StructuredId[iii][0] = i;
678 aObj2StructuredId[iii][1] = j;
679 aObj2StructuredId[iii][2] = k;
684 for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
685 const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
686 const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
688 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
689 VISU::PMEDMeshOnEntity aMeshOnEntity =
690 aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
691 aMeshOnEntity->myEntity = aVEntity;
692 aMeshOnEntity->myMeshName = aMeshName;
693 aMeshOnEntity->myGeom2Size = aGeom2Size;
694 VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
695 VISU::TGeom2ElemID2FamilyID& aGeom2ElemID2FamilyID = aMeshOnEntity->myGeom2ElemID2FamilyID;
698 "- aMEntity = "<<aMEntity<<
699 "; aVEntity = "<<aVEntity<<
702 if(aMEntity == MED::eNOEUD){
703 aMeshOnEntity->myNbCells = theGrilleInfo->GetNbNodes();
704 aMeshOnEntity->myCellsSize = 2*theGrilleInfo->GetNbNodes();
706 VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[MED::ePOINT1];
708 if((theGrilleInfo->myFamNumNode).size() > 0)
709 for(TInt iElem = 0; iElem < theGrilleInfo->GetNbNodes(); iElem++){
710 TInt aFamId = theGrilleInfo->GetFamNumNode(iElem);
712 aFamilyID2CellsSize[aFamId] += 2;
713 anElemID2FamilyID[iElem] = aFamId;
717 "- myNbCells = "<<aMeshOnEntity->myNbCells<<
718 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
722 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
723 aMeshOnEntity->myNbCells = 0;
724 aMeshOnEntity->myCellsSize = 0;
725 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
726 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
727 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
728 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
729 TInt aNbElem = aGeom2SizeIter->second;//theGrilleInfo->GetNbCells();
730 aMeshOnEntity->myNbCells += aNbElem;
731 aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
733 VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom];
736 "- aMGeom = "<<aMGeom<<
737 "; aNbElem = "<<aNbElem<<
738 "; myNbCells = "<<aMeshOnEntity->myNbCells<<
739 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
742 if((theGrilleInfo->myFamNum).size() > 0)
743 for(TInt iElem = 0; iElem < aNbElem; iElem++){
744 TInt aFamId = theGrilleInfo->GetFamNum(iElem);
746 aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
747 anElemID2FamilyID[iElem] = aFamId;
755 //---------------------------------------------------------------
757 BuildFieldMap(VISU::PMEDMesh theMesh,
758 const MED::TEntityInfo& theEntityInfo,
759 MED::PWrapper theMEDWrapper)
761 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFieldMap");
762 TInt aNbFields = theMEDWrapper->GetNbFields();
763 MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
764 const std::string& aMeshName = theMesh->myName;
765 INITMSG(MYDEBUG,"BuildFieldMap: aNbFields = "<<aNbFields<<"\n");
766 for(TInt iField = 1; iField <= aNbFields; iField++){
767 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPFieldInfo");
769 MED::TErr anError = 0;
770 MED::PFieldInfo aFieldInfo = theMEDWrapper->GetPFieldInfo(aMeshInfo, iField, &anError);
774 TInt aNbComp = aFieldInfo->GetNbComp();
775 std::string aFieldName = aFieldInfo->GetName();
777 MED::TGeom2Size aGeom2Size;
778 MED::EEntiteMaillage aMEntity;
779 TInt aNbTimeStamps = theMEDWrapper->GetNbTimeStamps(aFieldInfo,
783 if(aNbTimeStamps < 1)
786 VISU::TEntity aVEntity = MEDEntityToVTK( aMEntity );
787 vtkIdType aDataType = VTK_DOUBLE;
788 if ( aFieldInfo->GetType() != MED::eFLOAT64 ) {
789 #if defined(HAVE_F77INT64)
790 aDataType = VTK_LONG;
795 VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
796 VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
797 VISU::PMEDField aField = aFieldMap[aFieldName](new VISU::TMEDField());
798 aField->myId = iField;
799 aField->Init(aNbComp, aDataType);
800 aField->myEntity = aVEntity;
801 aField->myName = aFieldName;
802 aField->myMeshName = aMeshName;
803 aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
804 aField->myIsELNO = ( aMEntity == MED::eNOEUD_ELEMENT );
806 INITMSG(MYDEBUG,"myName = '"<<aField->myName<<"'"<<
807 "; myId = "<<aField->myId<<
808 "; myEntity = "<<aField->myEntity<<
809 "; myDataSize = "<<aField->myDataSize<<
810 "; myNbComp = "<<aField->myNbComp<<"\n");
812 for(TInt iComp = 0; iComp < aNbComp; iComp++){
813 aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
814 aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
817 for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
818 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPTimeStampInfo");
820 MED::TErr anError = 0;
821 MED::PTimeStampInfo aTimeStampInfo = theMEDWrapper->GetPTimeStampInfo(aFieldInfo,
829 TFloat aDt = aTimeStampInfo->GetDt();
830 std::string anUnitDt = aTimeStampInfo->GetUnitDt();
832 VISU::TValField& aValField = aField->myValField;
833 VISU::PMEDValForTime aValForTime = aValField[iTimeStamp](new VISU::TMEDValForTime());
834 aValForTime->myId = iTimeStamp;
835 aValForTime->myFieldName = aField->myName;
836 aValForTime->myEntity = aField->myEntity;
837 aValForTime->myMeshName = aField->myMeshName;
838 aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
839 INITMSG(MYDEBUG,"aDt = '"<<aDt<<", "<<anUnitDt<<"'\n");
841 VISU::TGeom2NbGauss& aVGeom2NbGauss = aValForTime->myGeom2NbGauss;
842 const MED::TGeom2NbGauss& aMGeom2NbGauss = aTimeStampInfo->myGeom2NbGauss;
843 MED::TGeom2NbGauss::const_iterator anIter = aMGeom2NbGauss.begin();
844 for(; anIter != aMGeom2NbGauss.end(); anIter++){
845 const MED::EGeometrieElement& aMGeom = anIter->first;
846 VISU::EGeometry aEGeom = MEDGeom2VISU( aMGeom );
847 TInt aNbGauss = anIter->second;
848 aVGeom2NbGauss[ aEGeom ] = aNbGauss;
850 // ELNO data should satisfy the following condition ( implicitly )
851 vtkIdType aNbNodes = MEDGeom2NbNodes( aMGeom );
852 aField->myIsELNO &= ( aNbGauss == aNbNodes );
859 //---------------------------------------------------------------
861 BuildFamilyMap(VISU::PMEDMesh theMesh,
862 const MED::TEntityInfo& theEntityInfo,
863 const MED::TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo,
864 const MED::TFamilyInfoSet& theFamilyInfoSet,
865 MED::PWrapper theMEDWrapper)
867 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFamilyMap");
868 INITMSG(MYDEBUG,"BuildFamilyMap\n");
870 MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
871 MED::TEntity2FamilySet aEntity2FamilySet = MED::GetEntity2FamilySet(theMEDWrapper,theEntity2TGeom2ElemInfo,theFamilyInfoSet);
872 MED::TEntity2FamilySet::const_iterator aEntity2FamilySetIter = aEntity2FamilySet.begin();
873 for(; aEntity2FamilySetIter != aEntity2FamilySet.end(); aEntity2FamilySetIter++){
874 const MED::EEntiteMaillage& aMEntity = aEntity2FamilySetIter->first;
875 const MED::TFamilyTSizeSet& aFamilyTSizeSet = aEntity2FamilySetIter->second;
877 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
878 VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
879 const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
880 VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
881 VISU::TFamilyIDMap& aFamilyIDMap = aMeshOnEntity->myFamilyIDMap;
883 if(aFamilyTSizeSet.empty())
886 INITMSG(MY_FAMILY_DEBUG,
887 "- aMEntity = "<<aMEntity<<
888 "; aVEntity = "<<aVEntity<<
891 MED::TFamilyTSizeSet::const_iterator aFamilyTSizeSetIter = aFamilyTSizeSet.begin();
892 for(; aFamilyTSizeSetIter != aFamilyTSizeSet.end(); aFamilyTSizeSetIter++){
893 const MED::TFamilyTSize& aFamilyTSize = *aFamilyTSizeSetIter;
894 const MED::PFamilyInfo& aFamilyInfo = boost::get<0>(aFamilyTSize);
895 TInt aSize = boost::get<1>(aFamilyTSize);
896 TInt anId = aFamilyInfo->GetId();
900 std::string aFamilyName = aFamilyInfo->GetName();
902 VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily());
903 aFamily->myId = anId;
904 aFamily->myEntity = aVEntity;
905 aFamily->myName = aFamilyName;
906 aFamily->myNbCells = aSize;
908 aFamily->myCellsSize = 0;
909 VISU::TFamilyID2CellsSize::const_iterator anIter = aFamilyID2CellsSize.find(anId);
910 if(anIter != aFamilyID2CellsSize.end())
911 aFamily->myCellsSize = anIter->second;
913 const TInt aNbGroup = aFamilyInfo->GetNbGroup();
914 VISU::TNames& aGroupNames = aFamily->myGroupNames;
915 aGroupNames.resize(aNbGroup);
916 for(TInt i = 0; i < aNbGroup; i++){
917 std::string aGroupName = aFamilyInfo->GetGroupName(i);
918 aGroupNames[i] = aGroupName;
921 aFamilyIDMap[anId] = aFamily;
923 INITMSG(MY_FAMILY_DEBUG,
924 "- aFamilyName = '"<<aFamilyName<<"'"<<
925 "; myId = "<<aFamily->myId<<"; "<<
926 "; aNbAttr = "<<aFamilyInfo->GetNbAttr()<<
927 "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
928 "; aVEntity = "<<aVEntity<<
929 "; myNbCells = "<<aFamily->myNbCells<<
930 "; myCellsSize = "<<aFamily->myCellsSize<<
933 for(TInt i = 0; i < aNbGroup; i++){
934 std::string aGroupName = aFamilyInfo->GetGroupName(i);
935 INITMSG(MY_FAMILY_DEBUG,"- aGroupName = '"<<aGroupName<<"'\n");
945 * Build grille family map
948 BuildGrilleFamilyMap(VISU::PMEDMesh theMesh,
949 const MED::TEntityInfo& theEntityInfo,
950 const MED::TFamilyInfoSet& theFamilyInfoSet,
951 MED::PWrapper theMEDWrapper)
953 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGrilleFamilyMap");
954 INITMSG(MYDEBUG,"BuildGrilleFamilyMap\n");
956 VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
958 MED::TEntityInfo::const_iterator aEntityIter = theEntityInfo.begin();
960 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
961 MED::PGrilleInfo aGrilleInfo = theMEDWrapper->GetPGrilleInfo(aMeshInfo);
963 const MED::TFamilyID2NbCells& aFam2NbCells = MED::GetFamilyID2NbCells(aGrilleInfo);
965 MED::TFamilyInfoSet::const_iterator aFamInter = theFamilyInfoSet.begin();
966 for(; aFamInter != theFamilyInfoSet.end(); aFamInter++){
967 const MED::PFamilyInfo& aFamilyInfo = *aFamInter;
968 TInt anId = aFamilyInfo->GetId();
973 std::string aFamilyName = aFamilyInfo->GetName();
974 const MED::EEntiteMaillage& aMEntity = MED::GetEntityByFamilyId(aGrilleInfo,
976 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
978 VISU::PMEDMeshOnEntity aMeshOnEntity;
979 VISU::TMeshOnEntityMap::iterator aMeshOnEntityIter = aMeshOnEntityMap.find(aVEntity);
980 if(aMeshOnEntityIter != aMeshOnEntityMap.end())
981 aMeshOnEntity = aMeshOnEntityIter->second;
983 VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
984 VISU::TFamilyIDMap& aFamilyIDMap = aMeshOnEntity->myFamilyIDMap;
986 VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily());
987 aFamily->myId = anId;
988 aFamily->myEntity = aVEntity;
989 aFamily->myName = aFamilyName;
990 aFamily->myNbCells = 0;
991 aFamily->myCellsSize = 0;
993 const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
994 VISU::TFamilyID2CellsSize::const_iterator aFamilyid2CellsSizeIter = aFamilyID2CellsSize.find(anId);
995 if(aFamilyid2CellsSizeIter != (aMeshOnEntity->myFamilyID2CellsSize).end())
996 aFamily->myCellsSize = aFamilyid2CellsSizeIter->second;
997 MED::TFamilyID2NbCells::const_iterator aFam2NbCellsIter = aFam2NbCells.find(anId);
998 if(aFam2NbCellsIter != aFam2NbCells.end())
999 aFamily->myNbCells = aFam2NbCellsIter->second;
1001 const TInt aNbGroup = aFamilyInfo->GetNbGroup();
1002 VISU::TNames& aGroupNames = aFamily->myGroupNames;
1003 aGroupNames.resize(aNbGroup);
1004 for(TInt i = 0; i < aNbGroup; i++){
1005 std::string aGroupName = aFamilyInfo->GetGroupName(i);
1006 aGroupNames[i] = aGroupName;
1009 aFamilyIDMap[anId] = aFamily;
1011 INITMSG(MY_FAMILY_DEBUG,
1012 "- aFamilyName =|"<<aFamily->myName<<"|"
1013 << "; myId = "<<aFamily->myId
1014 << "; aNbAttr = "<<aFamilyInfo->GetNbAttr()
1015 << "; aNbGroup = "<<aFamilyInfo->GetNbGroup()
1016 << "; aVEntity = "<<aVEntity
1017 << "; myNbCells = "<<aFamily->myNbCells
1018 << "; myCellsSize = "<<aFamily->myCellsSize
1025 //---------------------------------------------------------------
1027 BuildGroupMap(VISU::PMEDMesh theMesh,
1028 const MED::TFamilyInfoSet& theFamilyInfoSet)
1030 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGroupMap");
1031 INITMSG(MYDEBUG,"BuildGroupMap\n");
1033 VISU::TGroupMap& aGroupMap = theMesh->myGroupMap;
1034 MED::TGroupInfo aGroupInfo = MED::GetGroupInfo(theFamilyInfoSet);
1035 MED::TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
1036 for(; aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
1037 const std::string& aGroupName = aGroupInfoIter->first;
1038 INITMSG(MY_GROUP_DEBUG,"aGroupName = '"<<aGroupName<<"'\n");
1040 VISU::PMEDGroup aGroup(new VISU::TMEDGroup());
1041 VISU::TFamilySet& aFamilySet = aGroup->myFamilySet;
1043 const MED::TFamilyInfoSet& aFamilyInfoSet = aGroupInfoIter->second;
1044 MED::TFamilyInfoSet::const_iterator aFamilyIter = aFamilyInfoSet.begin();
1045 for(; aFamilyIter != aFamilyInfoSet.end(); aFamilyIter++){
1046 const MED::PFamilyInfo& aFamilyInfo = *aFamilyIter;
1047 std::string aFamilyName = aFamilyInfo->GetName();
1049 VISU::TEntity aVEntity = VISU::TEntity(-1);
1050 VISU::PMEDFamily aFamily;
1053 const VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
1054 VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
1055 for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
1056 const VISU::PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
1057 const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
1058 VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
1059 for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
1060 const std::string& aName = aFamilyMapIter->first;
1061 if(aName == aFamilyName){
1062 aFamily = aFamilyMapIter->second;
1063 aVEntity = aFamily->myEntity;
1069 if(aFamily && aVEntity >= 0){
1070 aFamilySet.insert(aFamily);
1071 INITMSG(MY_GROUP_DEBUG,
1072 "- aFamilyName = '"<<aFamilyName<<"'"<<
1073 "; aVEntity = "<<aVEntity<<
1077 if(!aFamilySet.empty())
1078 aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
1083 //---------------------------------------------------------------
1087 TSetIsDone(bool& theIsDone):
1099 //---------------------------------------------------------------
1104 //---------------------------------------------------------------
1106 TMEDNamedPointCoords
1107 ::Init(const MED::PNodeInfo& theNodeInfo,
1108 MED::EVersion theVersion)
1110 TMEDCoordHolder* aCoordHolder = new TMEDCoordHolder();
1111 TInt aNbElem = theNodeInfo->GetNbElem();
1112 TInt aDim = theNodeInfo->GetMeshInfo()->GetDim();
1113 aCoordHolder->Init(aNbElem, aDim, theNodeInfo->myCoord);
1114 TNamedPointCoords::Init(PCoordHolder(aCoordHolder));
1115 myVersion = theVersion;
1117 for(TInt iDim = 0; iDim < aDim; iDim++)
1118 myPointsDim[iDim] = theNodeInfo->GetCoordName(iDim);
1120 myIsElemNum = theNodeInfo->IsElemNum();
1121 if(theNodeInfo->IsElemNum())
1122 myElemNum = theNodeInfo->myElemNum;
1124 myIsElemNames = theNodeInfo->IsElemNames();
1125 if(theNodeInfo->IsElemNames())
1126 myElemNames = theNodeInfo->myElemNames;
1130 TMEDNamedPointCoords
1131 ::Init(const MED::PGrilleInfo& theGrilleInfo)
1133 TMEDCoordHolder* aCoordHolder = new TMEDCoordHolder();
1134 TInt aNbElem = theGrilleInfo->GetNbNodes();
1135 TInt aDim = theGrilleInfo->GetMeshInfo()->GetDim();
1136 MED::PNodeCoord aCoord(new MED::TNodeCoord(aNbElem * aDim));
1137 aCoordHolder->Init(aNbElem, aDim, aCoord);
1138 TNamedPointCoords::Init(PCoordHolder(aCoordHolder));
1140 for(TInt iDim = 0; iDim < aDim; iDim++)
1141 myPointsDim[iDim] = theGrilleInfo->GetCoordName(iDim);
1143 for(TInt iElem = 0; iElem < aNbElem; iElem++){
1144 VISU::TCoordSlice aVCoordSlice = GetCoordSlice(iElem);
1145 MED::TNodeCoord aMCoord = theGrilleInfo->GetCoord(iElem);
1146 for(TInt iDim = 0; iDim < aDim; iDim++){
1147 aVCoordSlice[iDim] = aMCoord[iDim];
1153 TMEDNamedPointCoords
1154 ::GetObjID(vtkIdType theID) const
1157 return (*myElemNum)[theID];
1158 return TNamedPointCoords::GetObjID(theID);
1163 TMEDNamedPointCoords
1164 ::GetVTKID(vtkIdType theID) const
1167 // To prepare corresponding mapper engine
1168 if(myObj2VTKID.empty()){
1169 vtkIdType anEnd = myElemNum->size();
1170 for(vtkIdType anID = 0; anID < anEnd; anID++)
1171 myObj2VTKID[(*myElemNum)[anID]] = anID;
1173 TObj2VTKID::const_iterator anIter = myObj2VTKID.find(theID);
1174 if(anIter != myObj2VTKID.end())
1175 return anIter->second;
1178 return TNamedPointCoords::GetVTKID(theID);
1182 GetPNOMLength(MED::EVersion theVersion)
1184 if(theVersion == MED::eV2_1)
1185 return MED::GetPNOMLength<MED::eV2_1>();
1186 return MED::GetPNOMLength<MED::eV2_2>();
1190 TMEDNamedPointCoords
1191 ::GetNodeName(vtkIdType theObjID) const
1194 return GetString(theObjID, GetPNOMLength(myVersion), *myElemNames);
1195 return TNamedPointCoords::GetNodeName(theObjID);
1199 TMEDNamedPointCoords
1202 size_t aSize = TNamedPointCoords::GetMemorySize();
1205 aSize += myObj2VTKID.size() * sizeof(vtkIdType) * 2;
1206 aSize += myElemNum->size() * sizeof(MED::TInt);
1210 aSize += myElemNames->size() * sizeof(char);
1215 //---------------------------------------------------------------
1218 ::GetElemObjID(vtkIdType theID) const
1220 if ( !mySubMeshID.empty() )
1221 theID = mySubMeshID[theID];
1224 return (*myElemNum)[theID];
1230 //---------------------------------------------------------------
1233 ::GetElemVTKID(vtkIdType theID) const
1236 for ( size_t anId = 0; anId < (*myElemNum).size(); anId++ )
1237 if ( (*myElemNum)[ anId ] == theID ) {
1242 return TSubProfileImpl::GetElemVTKID( theID );
1246 //----------------------------------------------------------------
1251 size_t aSize = TSubProfileImpl::GetMemorySize();
1253 aSize += myElemNum->size() * sizeof(MED::TInt);
1258 //---------------------------------------------------------------
1261 ::LessThan(const PGaussImpl& theGauss,
1262 bool& theResult) const
1264 TGaussImpl::LessThan(theGauss,theResult);
1266 if(PMEDGauss aGauss = theGauss){
1267 const MED::TGaussInfo& aLeft = myGaussInfo;
1268 const MED::TGaussInfo& aReight = aGauss->myGaussInfo;
1269 theResult = MED::TGaussInfo::TLess()(aLeft,aReight);
1275 //---------------------------------------------------------------
1278 ::GetObjID(vtkIdType theID) const
1280 vtkIdType aNbPoints = myGauss->myNbPoints;
1281 TCellID aCellID = theID / aNbPoints;
1282 TLocalPntID aLocalPntID = theID % aNbPoints;
1285 aCellID = GetElemObjID(aCellID);
1287 aCellID += myStartID;
1289 return TGaussPointID(aCellID, aLocalPntID);
1293 //---------------------------------------------------------------
1296 ::GetVTKID( const TGaussPointID& theID ) const
1298 vtkIdType aResult = -1;
1300 TCellID aCellID = theID.first;
1301 TLocalPntID aLocalPntID = theID.second;
1303 vtkIdType aNbPoints = myGauss->myNbPoints;
1304 if ( aLocalPntID >= aNbPoints )
1307 if ( myIsElemNum ) {
1308 aCellID = GetElemVTKID( aCellID );
1310 aCellID -= myStartID;
1312 return aCellID * aNbPoints + aLocalPntID + myStartID;
1316 //---------------------------------------------------------------
1321 size_t aSize = TGaussSubMeshImpl::GetMemorySize();
1323 aSize += myElemNum->size() * sizeof(MED::TInt);
1328 //---------------------------------------------------------------
1331 ::Init(const MED::PElemInfo& theElemInfo,
1332 MED::EVersion theVersion)
1334 myVersion = theVersion;
1335 myIsElemNum = theElemInfo->IsElemNum();
1337 myElemNum = theElemInfo->myElemNum;
1339 myIsElemNames = theElemInfo->IsElemNames();
1340 if(theElemInfo->IsElemNames())
1341 myElemNames = theElemInfo->myElemNames;
1347 ::Init(const MED::PGrilleInfo& theGrilleInfo)
1352 ::GetElemObjID(vtkIdType theID) const
1355 return (*myElemNum)[theID];
1357 return TSubMeshImpl::GetElemObjID(theID);
1362 ::GetElemName(vtkIdType theObjID) const
1365 return GetString(theObjID, GetPNOMLength(myVersion), *myElemNames);
1366 return TSubMeshImpl::GetElemName(theObjID);
1373 size_t aSize = TSubMeshImpl::GetMemorySize();
1376 aSize += myElemNum->size() * sizeof(MED::TInt);
1379 aSize += myElemNames->size() * sizeof(char);
1385 //---------------------------------------------------------------
1389 //---------------------------------------------------------------
1392 CreateConvertor(const std::string& theFileName)
1394 if(MED::PWrapper aMed = MED::CrWrapper(theFileName,true))
1395 return new VISU_MedConvertor(theFileName, aMed);
1400 ::VISU_MedConvertor(const std::string& theFileName, MED::PWrapper theMed):
1401 myIsEntitiesDone(false),
1402 myIsFieldsDone(false),
1403 myIsGroupsDone(false),
1404 myIsMinMaxDone(false),
1407 myName = theFileName;
1411 //---------------------------------------------------------------
1416 if(myIsEntitiesDone)
1419 TSetIsDone aSetIsDone(myIsEntitiesDone);
1420 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildEntities");
1422 TInt aNbMeshes = myMed->GetNbMeshes();
1423 VISU::TMeshMap& aMeshMap = myMeshMap;
1425 INITMSG(MYDEBUG,"BuildEntities aNbMeshes = "<<aNbMeshes<<"\n");
1427 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
1431 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
1433 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
1434 std::string aMeshName = aMeshInfo->GetName();
1435 TInt aDim = aMeshInfo->GetDim();
1436 MED::EMaillage aType = aMeshInfo->GetType();
1438 // creating TMesh structure and TMeshOnEntityMap
1439 VISU::PMEDMesh aMesh = aMeshMap[aMeshName](new VISU::TMEDMesh());
1441 aMesh->myDim = aDim;
1442 aMesh->myName = aMeshName;
1443 aMesh->myMeshInfo = aMeshInfo;
1444 aMesh->myNamedPointCoords(new VISU::TMEDNamedPointCoords());
1446 INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
1447 "; aDim = "<<aDim<<"\n");
1449 if(aType == MED::eNON_STRUCTURE){
1451 if(MED::PNodeInfo aNodeInfo = myMed->GetPNodeInfo(aMeshInfo)){
1452 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
1454 aMesh->myNbPoints = aNodeInfo->GetNbElem();
1455 aMesh->myEntityInfo = anEntityInfo;
1461 INITMSG(MYDEBUG,"myNbPoints = "<<aMesh->myNbPoints<<
1462 "; anEntityInfo.size() = "<<anEntityInfo.size()<<
1465 BuildMeshOnEntityMap(aMesh,
1471 }catch(std::exception& exc){
1472 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1474 MSG(MYDEBUG,"Unknown exception !!!");
1478 } // NON STRUCTURED MESH
1480 MED::PGrilleInfo aGrilleInfo = myMed->GetPGrilleInfo(aMeshInfo);
1482 MED::TEntityInfo anEntityInfo;
1483 anEntityInfo[MED::eNOEUD][MED::ePOINT1] = aGrilleInfo->GetNbNodes();
1484 anEntityInfo[aGrilleInfo->GetEntity()][aGrilleInfo->GetGeom()] = aGrilleInfo->GetNbCells();
1486 aMesh->myNbPoints = aGrilleInfo->GetNbNodes();
1487 aMesh->myEntityInfo = anEntityInfo;
1489 aMesh->myIsPolarType = (MED::eGRILLE_POLAIRE == aGrilleInfo->GetGrilleType());
1490 aMesh->myIsStructured = true;
1494 BEGMSG(MYDEBUG,"anEntityInfo.size() = "<<anEntityInfo.size()<<"\n");
1496 BuildMeshGrilleOnEntityMap(aMesh,
1502 }catch(std::exception& exc){
1503 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1505 MSG(MYDEBUG,"Unknown exception !!!");
1512 }catch(std::exception& exc){
1513 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1515 MSG(MYDEBUG,"Unknown exception !!!");
1524 //---------------------------------------------------------------
1532 VISU_Convertor_impl::BuildFields();
1534 TSetIsDone aSetIsDone(myIsFieldsDone);
1535 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFields");
1537 TInt aNbMeshes = myMed->GetNbMeshes();
1538 VISU::TMeshMap& aMeshMap = myMeshMap;
1540 INITMSG(MYDEBUG,"BuildFields - aNbMeshes = "<<aNbMeshes<<"\n");
1542 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
1546 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
1548 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
1549 std::string aMeshName = aMeshInfo->GetName();
1551 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
1552 if(anIter == aMeshMap.end())
1554 VISU::PMEDMesh aMesh = anIter->second;
1556 INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
1560 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
1562 BuildFieldMap(aMesh,
1566 }catch(std::exception& exc){
1567 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1569 MSG(MYDEBUG,"Unknown exception !!!");
1574 }catch(std::exception& exc){
1575 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1577 MSG(MYDEBUG,"Unknown exception !!!");
1586 //---------------------------------------------------------------
1587 template<class TimeStampValueType>
1589 BuildTimeStampMinMax(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
1590 const VISU::PMEDMeshOnEntity theMeshOnEntity,
1591 const MED::TGeom2Gauss& theGeom2Gauss,
1592 VISU::TMinMaxArr& theMinMaxArr,
1593 VISU::TMinMaxArr& theAverageMinMaxArr,
1594 VISU::TGroup2MinMaxArr& theGroup2MinMaxArr,
1595 VISU::TGroup2MinMaxArr& theGroup2AverageMinMaxArr,
1599 const VISU::TFamilyIDMap& aFamilyIDMap = theMeshOnEntity->myFamilyIDMap;
1600 VISU::TGeom2ElemID2FamilyID aGeom2ElemID2FamilyID = theMeshOnEntity->myGeom2ElemID2FamilyID;
1602 const typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValue->myGeom2Value;
1603 typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
1604 for(; anIter != aGeom2Value.end(); anIter++){
1605 const typename TimeStampValueType::TTMeshValue& aMMeshValue = anIter->second;
1606 MED::EGeometrieElement aMGeom = anIter->first;
1608 TInt aNbElem = aMMeshValue.myNbElem;
1609 TInt aNbGauss = aMMeshValue.myNbGauss;
1611 MED::TGeom2Gauss::const_iterator aGaussIter = theGeom2Gauss.find(aMGeom);
1612 if(aGaussIter == theGeom2Gauss.end())
1616 "- aMGeom = "<<aMGeom<<
1617 "; aNbElem = "<<aNbElem<<
1618 "; aNbGauss = "<<aNbGauss<<
1621 VISU::TElemID2FamilyID anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom];
1623 bool isAverageByGaussPoints = (aNbGauss > 1);
1624 // To calculate min/max per components
1625 for(TInt iElem = 0; iElem < aNbElem; iElem++){
1626 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
1627 for(TInt iComp = 0; iComp < theNbComp; iComp++){
1628 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
1629 VISU::TMinMax& aMinMax = theMinMaxArr[iComp+1];
1630 vtkFloatingPointType& aMin = aMinMax.first;
1631 vtkFloatingPointType& aMax = aMinMax.second;
1632 VISU::TMinMax& anAverageMinMax = theAverageMinMaxArr[iComp+1];
1633 vtkFloatingPointType& anAverageMin = anAverageMinMax.first;
1634 vtkFloatingPointType& anAverageMax = anAverageMinMax.second;
1635 vtkFloatingPointType anAverageValue = 0.0;
1637 VISU::TGroup2MinMax& aGroup2MinMax = theGroup2MinMaxArr[iComp+1];
1638 VISU::TGroup2MinMax& aGroup2AverageMinMax = theGroup2AverageMinMaxArr[iComp+1];
1639 std::map<VISU::TName,vtkFloatingPointType> aGroup2AverageValue;
1641 // get names of groups, to which the element belongs
1642 VISU::TNames aGroupNames;
1643 VISU::TElemID2FamilyID::const_iterator anIter = anElemID2FamilyID.find(iElem);
1644 if(anIter != anElemID2FamilyID.end()){
1645 int aFamilyId = anIter->second;
1647 VISU::TFamilyIDMap::const_iterator aFamilyIter = aFamilyIDMap.find(aFamilyId);
1648 if(aFamilyIter != aFamilyIDMap.end()){
1649 VISU::PMEDFamily aFamily = aFamilyIter->second;
1650 aGroupNames = aFamily->myGroupNames;
1651 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1652 for(; aGroupIter != aGroupNames.end(); aGroupIter++)
1653 aGroup2AverageValue[*aGroupIter] = 0.0;
1658 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1659 const vtkFloatingPointType& aVal = aMValueSlice[iGauss];
1660 aMin = std::min(aMin,aVal);
1661 aMax = std::max(aMax,aVal);
1662 if(isAverageByGaussPoints){
1663 anAverageValue += aVal;
1666 anAverageMin = aMin;
1667 anAverageMax = aMax;
1670 // additional calculation for each group, to which the element belongs
1671 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1672 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1673 VISU::TName aGroupName = *aGroupIter;
1674 bool isGroupFound = aGroup2MinMax.find(aGroupName) != aGroup2MinMax.end();
1675 VISU::TMinMax& aGroupMinMax = aGroup2MinMax[aGroupName];
1676 vtkFloatingPointType& aGroupMin = aGroupMinMax.first;
1677 vtkFloatingPointType& aGroupMax = aGroupMinMax.second;
1678 aGroupMin = isGroupFound ? std::min(aGroupMin,aVal) : aVal;
1679 aGroupMax = isGroupFound ? std::max(aGroupMax,aVal) : aVal;
1681 if(isAverageByGaussPoints){
1682 aGroup2AverageValue[aGroupName] = aGroup2AverageValue[aGroupName] + aVal;
1685 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1686 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1687 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1688 aGroupAverageMin = aGroupMin;
1689 aGroupAverageMax = aGroupMax;
1693 if(isAverageByGaussPoints){
1694 anAverageValue /= aNbGauss;
1695 anAverageMin = std::min(anAverageMin,anAverageValue);
1696 anAverageMax = std::max(anAverageMax,anAverageValue);
1698 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1699 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1700 VISU::TName aGroupName = *aGroupIter;
1701 vtkFloatingPointType aGroupAverageValue = aGroup2AverageValue[aGroupName] / aNbGauss;
1702 bool isGroupFound = aGroup2AverageMinMax.find(aGroupName) != aGroup2AverageMinMax.end();
1703 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1704 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1705 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1706 aGroupAverageMin = isGroupFound ? std::min(aGroupAverageMin,aGroupAverageValue) : aGroupAverageValue;
1707 aGroupAverageMax = isGroupFound ? std::max(aGroupAverageMax,aGroupAverageValue) : aGroupAverageValue;
1713 // To calculate min/max per vector modulus
1714 VISU::TMinMax& aMinMax = theMinMaxArr[0];
1715 vtkFloatingPointType& aMin = aMinMax.first;
1716 vtkFloatingPointType& aMax = aMinMax.second;
1717 VISU::TMinMax& anAverageMinMax = theAverageMinMaxArr[0];
1718 vtkFloatingPointType& anAverageMin = anAverageMinMax.first;
1719 vtkFloatingPointType& anAverageMax = anAverageMinMax.second;
1721 VISU::TGroup2MinMax& aGroup2MinMax = theGroup2MinMaxArr[0];
1722 VISU::TGroup2MinMax& aGroup2AverageMinMax = theGroup2AverageMinMaxArr[0];
1724 for(TInt iElem = 0; iElem < aNbElem; iElem++){
1725 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
1727 // get names of groups, to which the element belongs
1728 VISU::TNames aGroupNames;
1729 VISU::TElemID2FamilyID::const_iterator anIter = anElemID2FamilyID.find(iElem);
1730 if(anIter != anElemID2FamilyID.end()){
1731 int aFamilyId = anIter->second;
1733 VISU::TFamilyIDMap::const_iterator aFamilyIter = aFamilyIDMap.find(aFamilyId);
1734 if(aFamilyIter != aFamilyIDMap.end()){
1735 VISU::PMEDFamily aFamily = aFamilyIter->second;
1736 aGroupNames = aFamily->myGroupNames;
1741 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1742 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
1743 vtkFloatingPointType aValue = 0.0;
1744 for(TInt iComp = 0; iComp < theNbComp2; iComp++){
1745 vtkFloatingPointType aVal = aMValueSlice[iComp];
1746 aValue += aVal*aVal;
1748 aValue = sqrt(aValue);
1749 aMin = std::min(aMin,aValue);
1750 aMax = std::max(aMax,aValue);
1752 // additional calculation for each group, to which the element belongs
1753 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1754 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1755 VISU::TName aGroupName = *aGroupIter;
1756 bool isGroupFound = aGroup2MinMax.find(aGroupName) != aGroup2MinMax.end();
1757 VISU::TMinMax& aGroupMinMax = aGroup2MinMax[aGroupName];
1758 vtkFloatingPointType& aGroupMin = aGroupMinMax.first;
1759 vtkFloatingPointType& aGroupMax = aGroupMinMax.second;
1760 aGroupMin = isGroupFound ? std::min(aGroupMin,aValue) : aValue;
1761 aGroupMax = isGroupFound ? std::max(aGroupMax,aValue) : aValue;
1764 if(isAverageByGaussPoints){
1765 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMCompValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
1766 vtkFloatingPointType aValue = 0.0;
1767 for(TInt iComp = 0; iComp < theNbComp2; iComp++){
1768 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMCompValueSlice = aMCompValueSliceArr[iComp];
1769 vtkFloatingPointType anAverageValue = 0.0;
1770 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1771 const vtkFloatingPointType& aVal = aMCompValueSlice[iGauss];
1772 anAverageValue += aVal;
1774 anAverageValue /= aNbGauss;
1775 aValue += anAverageValue*anAverageValue;
1777 aValue = sqrt(aValue);
1778 anAverageMin = std::min(anAverageMin,aValue);
1779 anAverageMax = std::max(anAverageMax,aValue);
1781 // additional calculation for each group, to which the element belongs
1782 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1783 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1784 VISU::TName aGroupName = *aGroupIter;
1785 bool isGroupFound = aGroup2AverageMinMax.find(aGroupName) != aGroup2AverageMinMax.end();
1786 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1787 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1788 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1789 aGroupAverageMin = isGroupFound ? std::min(aGroupAverageMin,aValue) : aValue;
1790 aGroupAverageMax = isGroupFound ? std::max(aGroupAverageMax,aValue) : aValue;
1794 anAverageMin = aMin;
1795 anAverageMax = aMax;
1797 // additional calculation for each group, to which the element belongs
1798 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1799 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1800 VISU::TName aGroupName = *aGroupIter;
1801 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1802 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1803 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1804 aGroupAverageMin = aGroup2MinMax[aGroupName].first;
1805 aGroupAverageMax = aGroup2MinMax[aGroupName].second;
1813 //---------------------------------------------------------------
1821 VISU_Convertor_impl::BuildMinMax();
1823 TSetIsDone aSetIsDone(myIsMinMaxDone);
1824 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax");
1826 MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(myMed);
1827 MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(myMed);
1829 TInt aNbMeshes = myMed->GetNbMeshes();
1830 VISU::TMeshMap& aMeshMap = myMeshMap;
1832 INITMSG(MYDEBUG,"BuildMinMax - aNbMeshes = "<<aNbMeshes<<"\n");
1834 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
1838 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPMeshInfo");
1840 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
1841 std::string aMeshName = aMeshInfo->GetName();
1843 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
1844 if(anIter == aMeshMap.end())
1846 VISU::PMEDMesh aMesh = anIter->second;
1851 TInt aNbFields = myMed->GetNbFields();
1854 "- aMeshName = '"<<aMeshName<<"'"<<
1855 "; aNbFields = "<<aNbFields<<"\n");
1857 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
1859 for(TInt iField = 1; iField <= aNbFields; iField++){
1860 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()");
1862 MED::TErr anError = 0;
1863 MED::PFieldInfo aFieldInfo = myMed->GetPFieldInfo(aMeshInfo, iField, &anError);
1867 std::string aFieldName = aFieldInfo->GetName();
1868 INITMSG(MYDEBUG,"- aFieldName = '"<<aFieldName<<"'\n");
1870 MED::TGeom2Size aGeom2Size;
1871 MED::EEntiteMaillage aMEntity;
1872 TInt aNbTimeStamps = myMed->GetNbTimeStamps(aFieldInfo,
1876 if(aNbTimeStamps < 1)
1879 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
1880 VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
1881 VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
1882 VISU::PMEDField aField = aFieldMap[aFieldName];
1884 TInt aNbComp = aField->myNbComp;
1885 int aNbComp2 = aNbComp;
1886 if(aNbComp == 2 || aNbComp == 4)
1888 else if(aNbComp > 4)
1891 VISU::TMinMaxArr& aMinMaxArr = aField->myMinMaxArr;
1892 VISU::TMinMaxArr& anAverageMinMaxArr = aField->myAverageMinMaxArr;
1893 VISU::TGroup2MinMaxArr& aGroup2MinMaxArr = aField->myGroup2MinMaxArr;
1894 VISU::TGroup2MinMaxArr& aGroup2AverageMinMaxArr = aField->myGroup2AverageMinMaxArr;
1895 TSetIsDone aSetIsDone(aField->myIsMinMaxInitilized);
1896 for(TInt iTimeStamp = aNbTimeStamps; iTimeStamp >= 1; iTimeStamp--){
1897 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()");
1898 INITMSG(MYDEBUG,"- iTimeStamp = "<<iTimeStamp<<endl);
1906 MED::PTimeStampInfo aTimeStampInfo =
1907 myMed->GetPTimeStampInfo(aFieldInfo,
1912 MED::PTimeStampValueBase aTimeStampValue =
1913 myMed->GetPTimeStampValue(aTimeStampInfo,
1917 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
1919 if(aFieldInfo->GetType() == MED::eFLOAT64)
1920 BuildTimeStampMinMax<MED::TFloatTimeStampValue>(CastToFloatTimeStampValue(aTimeStampValue),
1926 aGroup2AverageMinMaxArr,
1930 BuildTimeStampMinMax<MED::TIntTimeStampValue>(CastToIntTimeStampValue(aTimeStampValue),
1936 aGroup2AverageMinMaxArr,
1941 }catch(Standard_Failure){
1942 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1943 MSG(MYDEBUG,"Follow signal was occured in:\n"<<aFail->GetMessageString());
1944 }catch(std::exception& exc){
1945 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1947 MSG(MYDEBUG,"Unknown exception !!!");
1951 for(TInt iComp = 0; iComp <= aNbComp; iComp++){
1952 VISU::TMinMax aMinMax = aField->GetMinMax(iComp, VISU::TNames());
1953 INITMSG(MYDEBUG,"- "<<iComp<<": "<<aMinMax.first<<"; "<<aMinMax.second<<endl);
1957 }catch(std::exception& exc){
1958 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1960 MSG(MYDEBUG,"Unknown exception !!!");
1965 }catch(std::exception& exc){
1966 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1968 MSG(MYDEBUG,"Unknown exception !!!");
1977 //---------------------------------------------------------------
1985 TSetIsDone aSetIsDone(myIsGroupsDone);
1986 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGroups");
1988 TInt aNbMeshes = myMed->GetNbMeshes();
1989 VISU::TMeshMap& aMeshMap = myMeshMap;
1991 INITMSG(MYDEBUG,"BuildGroups - aNbMeshes = "<<aNbMeshes<<"\n");
1993 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
1997 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
1999 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
2000 std::string aMeshName = aMeshInfo->GetName();
2002 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
2003 if(anIter == aMeshMap.end())
2005 VISU::PMEDMesh aMesh = anIter->second;
2007 INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
2009 MED::EMaillage aType = aMeshInfo->GetType();
2011 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
2013 MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo =
2014 MED::GetEntity2TGeom2ElemInfo(myMed, aMeshInfo, anEntityInfo);
2019 MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(myMed, aMeshInfo);
2021 if(aType == MED::eNON_STRUCTURE)
2022 BuildFamilyMap(aMesh,
2024 anEntity2TGeom2ElemInfo,
2028 BuildGrilleFamilyMap(aMesh,
2033 BuildGroupMap(aMesh,
2036 }catch(std::exception& exc){
2037 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2039 MSG(MYDEBUG,"Unknown exception !!!");
2044 }catch(std::exception& exc){
2045 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2047 MSG(MYDEBUG,"Unknown exception !!!");
2056 //---------------------------------------------------------------
2059 ::LoadMeshOnEntity(VISU::PMeshImpl theMesh,
2060 VISU::PMeshOnEntityImpl theMeshOnEntity)
2062 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnEntity");
2063 INITMSG(MYDEBUG,"LoadMeshOnEntity"<<endl);
2065 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2067 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2068 if(anEntity == VISU::NODE_ENTITY){
2069 isPointsUpdated += LoadPoints(myMed, theMesh);
2071 isPointsUpdated += LoadPoints(myMed, theMesh);
2072 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed, theMesh, theMeshOnEntity);
2075 return (isPointsUpdated || isCellsOnEntityUpdated);
2079 //---------------------------------------------------------------
2082 ::LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
2083 VISU::PMeshOnEntityImpl theMeshOnEntity,
2084 VISU::PFamilyImpl theFamily)
2086 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity");
2087 INITMSG(MYDEBUG,"LoadFamilyOnEntity"<<endl);
2089 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2091 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2092 if(anEntity == VISU::NODE_ENTITY){
2093 isPointsUpdated += LoadPointsOnFamily(myMed, theMesh, theFamily);
2095 isPointsUpdated += LoadPoints(myMed, theMesh);
2096 isCellsOnEntityUpdated += LoadCellsOnFamily(myMed, theMesh, theMeshOnEntity, theFamily);
2099 return (isPointsUpdated || isCellsOnEntityUpdated);
2103 //---------------------------------------------------------------
2106 ::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
2107 const VISU::TFamilySet& theFamilySet)
2109 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup");
2110 INITMSG(MYDEBUG,"LoadMeshOnGroup"<<endl);
2112 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2113 VISU::TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
2114 for(; aFamilyIter != theFamilySet.end(); aFamilyIter++){
2115 VISU::PMEDFamily aFamily = *aFamilyIter;
2116 const VISU::TEntity& anEntity = aFamily->myEntity;
2117 const VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
2118 isPointsUpdated += LoadPoints(myMed, theMesh);
2119 if(anEntity == VISU::NODE_ENTITY){
2120 isPointsUpdated += LoadPointsOnFamily(myMed, theMesh, aFamily);
2122 isCellsOnEntityUpdated += LoadCellsOnFamily(myMed,theMesh,aMeshOnEntity,aFamily);
2126 return (isPointsUpdated || isCellsOnEntityUpdated);
2130 //---------------------------------------------------------------
2133 ::LoadValForTimeOnMesh(VISU::PMeshImpl theMesh,
2134 VISU::PMeshOnEntityImpl theMeshOnEntity,
2135 VISU::PFieldImpl theField,
2136 VISU::PValForTimeImpl theValForTime)
2138 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh");
2139 INITMSG(MYDEBUG,"LoadValForTimeOnMesh"<<endl);
2141 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2142 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2143 isPointsUpdated += LoadPoints(myMed,theMesh);
2144 if(anEntity != VISU::NODE_ENTITY)
2145 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity);
2146 int isFieldUpdated = LoadValForTimeOnMesh(myMed,theMesh,theMeshOnEntity,theField,theValForTime);
2148 return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
2152 //---------------------------------------------------------------
2155 ::LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh,
2156 VISU::PMeshOnEntityImpl theMeshOnEntity,
2157 VISU::PFieldImpl theField,
2158 VISU::PValForTimeImpl theValForTime)
2160 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts");
2161 INITMSG(MYDEBUG,"LoadValForTimeOnGaussPts"<<endl);
2163 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2164 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2165 if(anEntity != VISU::NODE_ENTITY)
2166 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity);
2167 int isFieldUpdated = LoadValForTimeOnGaussPts(myMed,theMesh,theMeshOnEntity,theField,theValForTime);
2169 return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
2173 //---------------------------------------------------------------
2176 ::LoadPoints(const MED::PWrapper& theMed,
2177 VISU::PMEDMesh theMesh)
2179 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPoints");
2181 //Check on existing family
2182 VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
2183 aMeshOnEntity->myMeshName = theMesh->myName;
2184 aMeshOnEntity->myEntity = VISU::NODE_ENTITY;
2186 INITMSG(MYDEBUG,"LoadPoints - theMesh->myIsDone = "<<theMesh->myIsDone<<"'\n");
2188 //Check on loading already done
2189 if(theMesh->myIsDone)
2192 MED::EMaillage aType = theMesh->myMeshInfo->GetType();
2194 if(aType == MED::eNON_STRUCTURE){
2196 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
2197 TInt aNbElem = aNodeInfo->GetNbElem();
2199 VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
2200 aNamedPointCoords->Init(aNodeInfo, theMed->GetVersion());
2202 VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
2203 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
2205 aSubMesh->Init(MED::PElemInfo(aNodeInfo), theMed->GetVersion());
2206 aSubMesh->myNbCells = theMesh->myNbPoints;
2207 aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
2209 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2210 aCell2Connect.resize(aNbElem);
2211 for (int iElem = 0; iElem < aNbElem; iElem++)
2212 aCell2Connect[iElem] = VISU::TConnect(1,iElem);
2213 } // END NON_STRUCTURED
2214 else { // STRUCTURED
2216 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(theMesh->myMeshInfo);
2217 TInt aNbElem = aGrilleInfo->GetNbNodes();
2219 VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
2220 aNamedPointCoords->Init(aGrilleInfo);
2222 VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
2223 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
2225 aSubMesh->Init(aGrilleInfo);
2226 aSubMesh->myNbCells = theMesh->myNbPoints;
2227 aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
2229 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2230 aCell2Connect.resize(aNbElem);
2231 for(int iElem = 0; iElem < aNbElem; iElem++)
2232 aCell2Connect[iElem] = VISU::TConnect(1,iElem);
2236 theMesh->myIsDone = true;
2240 }catch(std::exception& exc){
2243 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2250 //---------------------------------------------------------------
2253 ::LoadPointsOnFamily(const MED::PWrapper& theMed,
2254 const VISU::PMEDMesh theMesh,
2255 const VISU::PMEDFamily theFamily)
2257 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPointsOnFamily");
2259 if(theFamily->myIsDone)
2262 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2263 MED::EMaillage aType = aMeshInfo->GetType();
2266 if(aType == MED::eNON_STRUCTURE){
2267 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
2268 TInt aNbElem = aNodeInfo->GetNbElem();
2271 TInt anId = theFamily->myId;
2272 VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
2273 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2274 if(aNodeInfo->GetFamNum(iElem) == anId)
2275 aSubMeshID.push_back(iElem);
2279 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo);
2280 TInt aNbElem = aGrilleInfo->GetNbNodes();
2283 TInt anId = theFamily->myId;
2284 VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
2285 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2286 if(aGrilleInfo->GetFamNumNode(iElem) == anId)
2287 aSubMeshID.push_back(iElem);
2291 theFamily->myIsDone = true;
2295 }catch(std::exception& exc){
2298 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2305 //---------------------------------------------------------------
2308 ::LoadCellsOnEntity(const MED::PWrapper& theMed,
2309 const VISU::PMEDMesh theMesh,
2310 const VISU::PMEDMeshOnEntity theMeshOnEntity)
2312 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnEntity");
2316 const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
2317 const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
2319 INITMSG(MYDEBUG,"LoadCellsOnEntity - aVEntity = "<<aVEntity<<"\n");
2321 if(theMeshOnEntity->myIsDone)
2324 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2326 MED::EMaillage aType = aMeshInfo->GetType();
2328 if(aType == MED::eSTRUCTURE){
2330 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo);
2331 TInt aNbPoints = aGrilleInfo->GetNbNodes();
2333 std::map<TInt,TInt> aNodeIdMap;
2334 EBooleen anIsNodeNum = MED::eFAUX;
2336 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2337 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2338 VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
2340 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2341 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2342 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2343 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"; aEGeom = "<<aEGeom<<"\n");
2345 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
2346 INITMSG(MYDEBUG,"aVNbNodes = "<<aVNbNodes<<"\n");
2348 TInt aNbElem = aGeom2SizeIter->second;//aGrilleInfo->GetNbCells();
2351 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2353 aSubMesh->Init(aGrilleInfo);
2354 aSubMesh->myNbCells = aNbElem;
2355 aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
2357 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2358 aCell2Connect.resize(aNbElem);
2360 TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
2361 VISU::TVector<TInt> aConnect(aMNbNodes);
2363 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2364 MED::TIntVector aConn = aGrilleInfo->GetConn(iElem);
2365 VISU::TConnect& anArray = aCell2Connect[iElem];
2366 anArray.resize(aVNbNodes);
2369 for(TInt iConn = 0; iConn < aMNbNodes; iConn++){
2370 aConnect[iConn] = aNodeIdMap[aConn[iConn] - 1];
2373 for(int iConn = 0; iConn < aMNbNodes; ++iConn){
2374 aConnect[iConn] = aConn[iConn];
2380 anArray[0] = aConnect[0];
2381 anArray[1] = aConnect[2];
2382 anArray[2] = aConnect[3];
2383 anArray[3] = aConnect[1];
2386 anArray[0] = aConnect[0];
2387 anArray[1] = aConnect[2];
2388 anArray[2] = aConnect[3];
2389 anArray[3] = aConnect[1];
2390 anArray[4] = aConnect[4];
2391 anArray[5] = aConnect[6];
2392 anArray[6] = aConnect[7];
2393 anArray[7] = aConnect[5];
2396 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2397 anArray[iNode] = aConnect[iNode];
2400 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2401 if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
2402 EXCEPTION(std::runtime_error,"LoadCellsOnEntity - "<<
2403 " aNbPoints("<<aNbPoints<<") "<<
2404 "<= anArray["<<iElem<<"]"<<
2406 "("<<anArray[iNode]<<") < 0");
2412 theMeshOnEntity->myIsDone = true;
2418 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
2419 TInt aNbPoints = aNodeInfo->GetNbElem();
2421 std::map<TInt,TInt> aNodeIdMap;
2422 #ifdef _EDF_NODE_IDS_
2423 EBooleen anIsNodeNum = MED::eFAUX;
2425 EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
2427 for(TInt i = 0; i < aNbPoints; i++){
2428 aNodeIdMap[aNodeInfo->GetElemNum(i)-1] = i;
2433 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2434 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2435 VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
2437 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2438 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2439 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2440 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"; aEGeom = "<<aEGeom<<"\n");
2442 case MED::ePOLYGONE: {
2443 MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
2444 TInt aNbElem = aPolygoneInfo->GetNbElem();
2446 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2448 aSubMesh->Init(MED::PElemInfo(aPolygoneInfo),theMed->GetVersion());
2449 aSubMesh->myNbCells = aNbElem;
2451 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2452 aCell2Connect.resize(aNbElem);
2454 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2455 MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem);
2456 TInt aNbConn = aPolygoneInfo->GetNbConn(iElem);
2457 aSubMesh->myCellsSize += aNbConn;
2458 VISU::TConnect& anArray = aCell2Connect[iElem];
2459 anArray.resize(aNbConn);
2460 for(TInt iConn = 0; iConn < aNbConn; iConn++)
2461 anArray[iConn] = aConnSlice[iConn] - 1;
2466 case MED::ePOLYEDRE: {
2467 MED::PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
2468 TInt aNbElem = aPolyedreInfo->GetNbElem();
2471 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2473 aSubMesh->Init(MED::PElemInfo(aPolyedreInfo),theMed->GetVersion());
2474 aSubMesh->myNbCells = aNbElem;
2476 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2477 aCell2Connect.resize(aNbElem);
2479 for(TInt iElem = 0; iElem < aNbElem; iElem++){
2480 MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem);
2481 VISU::TConnect& anArray = aCell2Connect[iElem];
2482 typedef std::set<TInt> TConnectSet;
2483 TConnectSet aConnectSet;
2484 TInt aNbFaces = aConnSliceArr.size();
2485 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
2486 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
2487 TInt aNbConn = aConnSlice.size();
2488 aSubMesh->myCellsSize += aNbConn;
2489 for(TInt iConn = 0; iConn < aNbConn; iConn++){
2490 aConnectSet.insert(aConnSlice[iConn]);
2494 int aNbConn = aConnectSet.size();
2495 anArray.resize(aNbConn);
2496 TConnectSet::iterator anIter = aConnectSet.begin();
2497 for(int i = 0; anIter != aConnectSet.end(); anIter++, i++){
2498 TInt anId = *anIter;
2499 anArray[i] = anId - 1;
2507 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
2508 INITMSG(MYDEBUG,"aVNbNodes = "<<aVNbNodes<<"\n");
2510 MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
2511 TInt aNbElem = aCellInfo->GetNbElem();
2514 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2516 aSubMesh->Init(MED::PElemInfo(aCellInfo), theMed->GetVersion());
2517 aSubMesh->myNbCells = aNbElem;
2518 aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
2520 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2521 aCell2Connect.resize(aNbElem);
2523 TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
2524 VISU::TVector<TInt> aConnect(aMNbNodes);
2526 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2527 MED::TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
2528 VISU::TConnect& anArray = aCell2Connect[iElem];
2529 anArray.resize(aVNbNodes);
2532 for(TInt iConn = 0; iConn < aMNbNodes; iConn++){
2533 aConnect[iConn] = aNodeIdMap[aConnSlice[iConn] - 1];
2536 for(int iConn = 0; iConn < aMNbNodes; iConn++){
2537 aConnect[iConn] = aConnSlice[iConn] - 1;
2542 #if !(defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2544 anArray[0] = aConnect[0];
2545 anArray[2] = aConnect[1];
2547 anArray[1] = aConnect[2];
2550 #if !(defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2552 anArray[0] = aConnect[0];
2553 anArray[2] = aConnect[1];
2554 anArray[4] = aConnect[2];
2556 anArray[1] = aConnect[3];
2557 anArray[3] = aConnect[4];
2558 anArray[5] = aConnect[5];
2561 #if !(defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2563 anArray[0] = aConnect[0];
2564 anArray[2] = aConnect[1];
2565 anArray[4] = aConnect[2];
2566 anArray[6] = aConnect[3];
2568 anArray[1] = aConnect[4];
2569 anArray[3] = aConnect[5];
2570 anArray[5] = aConnect[6];
2571 anArray[7] = aConnect[7];
2574 #if (defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2576 anArray[0] = aConnect[0];
2577 anArray[1] = aConnect[2];
2578 anArray[2] = aConnect[1];
2579 anArray[3] = aConnect[3];
2581 anArray[4] = aConnect[6];
2582 anArray[5] = aConnect[5];
2583 anArray[6] = aConnect[4];
2585 anArray[7] = aConnect[7];
2586 anArray[8] = aConnect[9];
2587 anArray[9] = aConnect[8];
2591 anArray[0] = aConnect[0];
2592 anArray[1] = aConnect[2];
2593 anArray[2] = aConnect[1];
2594 anArray[3] = aConnect[3];
2596 #if (defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2598 anArray[0] = aConnect[0];
2599 anArray[1] = aConnect[3];
2600 anArray[2] = aConnect[2];
2601 anArray[3] = aConnect[1];
2602 anArray[4] = aConnect[4];
2604 anArray[5] = aConnect[8];
2605 anArray[6] = aConnect[7];
2606 anArray[7] = aConnect[6];
2607 anArray[8] = aConnect[5];
2609 anArray[9] = aConnect[9];
2610 anArray[10] = aConnect[12];
2611 anArray[11] = aConnect[11];
2612 anArray[12] = aConnect[10];
2616 anArray[0] = aConnect[0];
2617 anArray[1] = aConnect[3];
2618 anArray[2] = aConnect[2];
2619 anArray[3] = aConnect[1];
2620 anArray[4] = aConnect[4];
2623 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2624 anArray[iNode] = aConnect[iNode];
2626 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2627 if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
2628 EXCEPTION(std::runtime_error,"LoadCellsOnEntity - "<<
2629 " aNbPoints("<<aNbPoints<<") "<<
2630 "<= anArray["<<iElem<<"]"<<
2632 "("<<anArray[iNode]<<") < 0");
2638 // END NON_STRUCTURED
2640 theMeshOnEntity->myIsDone = true;
2645 }catch(std::exception& exc){
2648 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2656 //---------------------------------------------------------------
2659 ::LoadCellsOnFamily(const MED::PWrapper& theMed,
2660 const VISU::PMEDMesh theMesh,
2661 const VISU::PMEDMeshOnEntity theMeshOnEntity,
2662 const VISU::PMEDFamily theFamily)
2664 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnFamily");
2668 const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
2669 const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
2671 INITMSG(MYDEBUG,"LoadCellsOnFamily - aVEntity = "<<aVEntity<<"\n");
2673 if(theFamily->myIsDone)
2676 TInt anId = theFamily->myId;
2678 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2679 VISU::TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
2680 MED::EMaillage aType = aMeshInfo->GetType();
2682 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2683 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2684 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2685 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2686 if(aType == MED::eNON_STRUCTURE){
2687 MED::PElemInfo anElemInfo;
2689 case MED::ePOLYGONE: {
2690 anElemInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
2693 case MED::ePOLYEDRE: {
2694 anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
2698 anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
2702 if(TInt aNbElem = anElemInfo->GetNbElem()){
2703 VISU::TSubMeshID aSubMeshID;
2704 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2705 if(anElemInfo->GetFamNum(iElem) == anId)
2706 aSubMeshID.push_back(iElem);
2707 if(!aSubMeshID.empty()){
2708 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2709 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
2710 aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
2715 MED::PGrilleInfo anElemInfo = theMed->GetPGrilleInfo(aMeshInfo);
2717 TInt aNbElem = anElemInfo->GetNbCells();
2718 if(aNbElem>0 && (aMGeom == anElemInfo->GetGeom()) ){
2719 VISU::TSubMeshID aSubMeshID;
2720 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2721 if(anElemInfo->GetFamNum(iElem) == anId)
2722 aSubMeshID.push_back(iElem);
2723 if(!aSubMeshID.empty()){
2724 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2725 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
2726 aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
2733 theFamily->myIsDone = true;
2738 }catch(std::exception& exc){
2741 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2749 //---------------------------------------------------------------
2751 LoadProfile(const MED::PWrapper& theMed,
2752 VISU::PMEDMesh theMesh,
2753 MED::PTimeStampValueBase theTimeStampValue,
2754 VISU::TMEDValForTime& theValForTime,
2755 VISU::TMEDMeshOnEntity& theMeshOnEntity)
2757 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadProfile");
2758 INITMSG(MYDEBUG,"LoadProfile"<<endl);
2760 VISU::PMEDProfile aProfile = theValForTime.myProfile;
2761 if(aProfile->myIsDone)
2764 const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
2765 const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
2766 MED::TGeom2Profile::const_iterator anIter = aGeom2Profile.begin();
2767 for(; anIter != aGeom2Profile.end(); anIter++){
2768 MED::PProfileInfo aProfileInfo = anIter->second;
2769 MED::EGeometrieElement aMGeom = anIter->first;
2770 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2772 VISU::TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aEGeom);
2773 if(anIter2 != aGeom2SubProfile.end()){
2774 VISU::PMEDSubProfile aSubProfile = anIter2->second;
2776 MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
2777 if(!anElemNum.empty()){
2778 VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
2779 TInt aSize = anElemNum.size();
2780 aSubMeshID.resize(aSize);
2781 for(TInt anId = 0; anId < aSize; anId++)
2782 aSubMeshID[anId] = anElemNum[anId] - 1;
2786 "- aEGeom = "<<aEGeom<<
2787 "; aNbCells = "<<aSubProfile->mySubMeshID.size()<<
2792 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2794 VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
2795 MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
2797 const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
2798 VISU::TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
2799 for(; anIter != aGeom2SubProfile.end(); anIter++){
2800 const VISU::PMEDSubProfile& aSubProfile = anIter->second;
2801 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
2802 MED::PElemInfo anElemInfo;
2803 anElemInfo = theMed->GetPElemInfo(aMeshInfo,aMEntity,aMGeom);
2804 aSubProfile->myIsElemNum = anElemInfo->IsElemNum();
2805 aSubProfile->myElemNum = anElemInfo->myElemNum;
2809 aProfile->myIsDone = true;
2813 //---------------------------------------------------------------
2815 LoadGaussMesh(const MED::PWrapper& theMed,
2816 VISU::PMEDMesh theMesh,
2817 MED::PTimeStampValueBase theTimeStampValue,
2818 VISU::TMEDValForTime& theValForTime,
2819 VISU::TMEDMeshOnEntity& theMeshOnEntity)
2821 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadGaussMesh");
2822 INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
2824 // this part of code must be reimplemented in connection with GRILLE structures
2825 if(theMesh->myMeshInfo->GetType() == MED::eSTRUCTURE)
2826 EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
2828 VISU::PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
2829 if(!aGaussMesh || aGaussMesh->myIsDone)
2832 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2833 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
2835 VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
2836 MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
2838 const VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
2839 const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
2840 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
2842 VISU::TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin();
2843 for(; aSubMeshIter != aGeom2GaussSubMesh.end(); aSubMeshIter++){
2844 VISU::PMEDGaussSubMesh aGaussSubMesh = aSubMeshIter->second;
2845 VISU::EGeometry aEGeom = aSubMeshIter->first;
2847 if(aGaussSubMesh->myIsDone)
2850 VISU::PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
2851 const VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
2852 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
2854 MED::PPolygoneInfo aPolygoneInfo;
2855 MED::PPolyedreInfo aPolyedreInfo;
2856 MED::PCellInfo aCellInfo;
2857 MED::PElemInfo anElemInfo;
2860 case MED::ePOLYGONE:
2861 aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,
2864 anElemInfo = aPolygoneInfo;
2866 case MED::ePOLYEDRE:
2867 aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,
2870 anElemInfo = aPolyedreInfo;
2873 aCellInfo = theMed->GetPCellInfo(aMeshInfo,
2876 anElemInfo = aCellInfo;
2878 aGaussSubMesh->myIsElemNum = anElemInfo->IsElemNum();
2879 aGaussSubMesh->myElemNum = anElemInfo->myElemNum;
2882 bool anIsGaussCoord3D = false;
2883 MED::PGaussCoord aGaussCoordPtr(new MED::TGaussCoord());
2884 MED::TGaussCoord& aGaussCoord = *aGaussCoordPtr;
2886 MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
2887 if(aGaussIter != aGeom2Gauss.end()){
2888 VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss;
2889 MED::PGaussInfo aGaussInfo = aGauss->myGaussInfo;
2891 aName = aGaussInfo->GetName();
2892 if(!aSubMeshID.empty()){
2893 const std::string& aProfileName = aSubProfile->myName;
2894 MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed,
2897 const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
2898 anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo,
2905 anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo,
2911 if(!aSubMeshID.empty()){
2912 const std::string& aProfileName = aSubProfile->myName;
2913 MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed,
2916 const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
2918 case MED::ePOLYGONE:
2919 anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo,
2924 case MED::ePOLYEDRE:
2925 anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo,
2931 anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo,
2939 case MED::ePOLYGONE:
2940 anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo,
2944 case MED::ePOLYEDRE:
2945 anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo,
2950 anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo,
2956 if(anIsGaussCoord3D){
2957 VISU::TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
2958 VISU::TMEDGaussCoordHolder* aCoordHolder = new VISU::TMEDGaussCoordHolder();
2959 aCoordHolder->Init(aGaussCoordPtr);
2960 aCoords.Init(VISU::PCoordHolder(aCoordHolder));
2962 aGaussSubMesh->myIsDone = true;
2964 TInt aNbGauss = aGaussCoord.GetNbGauss();
2965 TInt aNbElem = aGaussCoord.GetNbElem();
2966 TInt aNbCells = aNbElem*aNbGauss;
2969 "- aEGeom = "<<aEGeom<<
2970 "; aName = '"<<aName<<"'"<<
2971 "; aStatus = "<<aGaussSubMesh->myStatus<<
2972 "; aNbElem = "<<aNbElem<<
2973 "; aNbGauss = "<<aNbGauss<<
2974 "; aNbCells = "<<aNbCells<<
2977 EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
2980 aGaussMesh->myIsDone = true;
2984 //---------------------------------------------------------------
2985 template<class TimeStampValueType>
2987 FillValForTime(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
2988 const VISU::TGeom2SubProfile& theGeom2SubProfile,
2989 VISU::PMEDValForTime theValForTime,
2990 VISU::PMEDField theField)
2992 theField->myDataSize = 0;
2993 TInt aNbComp = theField->myNbComp;
2995 VISU::TGeom2SubProfile::const_iterator anIter = theGeom2SubProfile.begin();
2996 for(; anIter != theGeom2SubProfile.end(); anIter++){
2997 VISU::EGeometry aEGeom = anIter->first;
2998 VISU::PMEDSubProfile aSubProfile(anIter->second);
3000 TInt aNbElem = aSubProfile->myNbCells;
3001 theField->myDataSize += aNbElem * aNbComp;
3003 if(aSubProfile->myStatus != VISU::eRemoveAll){
3004 TInt aNbGauss = theValForTime->GetNbGauss(aEGeom);
3007 "- aEGeom = "<<aEGeom<<
3008 "; aNbElem = "<<aNbElem<<
3009 "; aNbGauss = "<<aNbGauss<<
3012 VISU::PMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
3013 typedef typename TimeStampValueType::TElement TElement;
3014 typedef VISU::TTMEDMeshValue<TElement> TVMeshValue;
3015 TVMeshValue* aMeshValue = new TVMeshValue();
3017 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
3018 typedef typename TimeStampValueType::PTMeshValue PTMeshValue;
3019 PTMeshValue aMeshValuePtr = theTimeStampValue->GetMeshValuePtr(aMGeom);
3020 aMeshValue->Init(aNbElem, aNbGauss, aNbComp, aMeshValuePtr);
3021 aVMeshValue.reset(aMeshValue);
3026 //---------------------------------------------------------------
3028 LoadValForTime(const MED::PWrapper& theMed,
3029 VISU::PMEDMesh theMesh,
3030 VISU::PMEDMeshOnEntity theMeshOnEntity,
3031 VISU::PMEDField theField,
3032 VISU::PMEDValForTime theValForTime,
3036 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTime");
3037 INITMSG(MYDEBUG,"LoadValForTime - theIsGauss = "<<theIsGauss<<endl);
3039 //Check on loading already done
3044 const std::string& aMeshName = theMeshOnEntity->myMeshName;
3045 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
3046 MED::PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,
3049 MED::TGeom2Size aGeom2Size;
3050 MED::EEntiteMaillage aMEntity;
3051 theMed->GetNbTimeStamps(aFieldInfo,
3052 theMesh->myEntityInfo,
3056 MED::PTimeStampInfo aTimeStampInfo =
3057 theMed->GetPTimeStampInfo(aFieldInfo,
3060 theValForTime->myId);
3062 MED::TKey2Gauss aKey2Gauss = GetKey2Gauss(theMed);
3063 MED::TMKey2Profile aMKey2Profile = GetMKey2Profile(theMed);
3065 MED::PTimeStampValueBase aTimeStampValue =
3066 theMed->GetPTimeStampValue(aTimeStampInfo,
3085 InitGaussMesh(aTimeStampValue,
3090 LoadGaussMesh(theMed,
3097 VISU::PMEDProfile aProfile = theValForTime->myProfile;
3098 VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
3101 "- aMeshName = '"<<aMeshName<<"'"<<
3102 "; aFieldName = '"<<aFieldInfo->GetName()<<"'"<<
3103 "; aMEntity = "<<aMEntity<<
3104 "; aNbComp = "<<theField->myNbComp<<
3107 if(aFieldInfo->GetType() == MED::eFLOAT64)
3108 FillValForTime<MED::TFloatTimeStampValue>(CastToFloatTimeStampValue(aTimeStampValue),
3113 FillValForTime<MED::TIntTimeStampValue>(CastToIntTimeStampValue(aTimeStampValue),
3123 //---------------------------------------------------------------
3126 ::LoadValForTimeOnMesh(const MED::PWrapper& theMed,
3127 VISU::PMEDMesh theMesh,
3128 VISU::PMEDMeshOnEntity theMeshOnEntity,
3129 VISU::PMEDField theField,
3130 VISU::PMEDValForTime theValForTime)
3132 VISU::PUnstructuredGridIDMapperImpl anUnstructuredGridIDMapper = theValForTime->myUnstructuredGridIDMapper;
3133 return LoadValForTime(theMed,
3139 anUnstructuredGridIDMapper->myIsVTKDone);
3143 //---------------------------------------------------------------
3146 ::LoadValForTimeOnGaussPts(const MED::PWrapper& theMed,
3147 VISU::PMEDMesh theMesh,
3148 VISU::PMEDMeshOnEntity theMeshOnEntity,
3149 VISU::PMEDField theField,
3150 VISU::PMEDValForTime theValForTime)
3152 VISU::PGaussPtsIDFilter aGaussPtsIDFilter = theValForTime->myGaussPtsIDFilter;
3153 return LoadValForTime(theMed,
3159 aGaussPtsIDFilter->myIsVTKDone);