1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // VISU OBJECT : interactive object for VISU entities implementation
24 // File : VISU_MedConvertor.cxx
25 // Author : Alexey PETROV
28 #include "VISU_MedConvertor.hxx"
29 #include "VISU_ConvertorUtils.hxx"
31 #include "MED_Factory.hxx"
32 #include "MED_Algorithm.hxx"
33 #include "MED_GaussUtils.hxx"
34 #include "MED_Utilities.hxx"
36 #include "SALOMEconfig.h"
38 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
42 #include <Standard_Failure.hxx>
45 #include <Standard_ErrorHandler.hxx>
48 #include <vtkCellType.h>
60 static int MYDEBUG = 0;
61 static int MYVALUEDEBUG = 0;
62 static int MY_FAMILY_DEBUG = 0;
63 static int MY_GROUP_DEBUG = 0;
66 static int MYDEBUG = 0;
67 static int MYVALUEDEBUG = 0;
68 static int MY_FAMILY_DEBUG = 0;
69 static int MY_GROUP_DEBUG = 0;
72 #define _LOAD_FAMILIES_
73 #define _EDF_NODE_IDS_
79 //---------------------------------------------------------------
81 MEDGeom2NbNodes(MED::EGeometrieElement theMEDGeomType)
83 return theMEDGeomType % 100;
87 //---------------------------------------------------------------
89 MEDGeom2VISU(MED::EGeometrieElement theGeom)
92 case MED::ePOINT1: return VISU::ePOINT1;
93 case MED::eSEG2: return VISU::eSEG2;
94 case MED::eTRIA3: return VISU::eTRIA3;
95 case MED::eQUAD4: return VISU::eQUAD4;
96 case MED::eTETRA4: return VISU::eTETRA4;
97 case MED::eHEXA8: return VISU::eHEXA8;
98 case MED::ePENTA6: return VISU::ePENTA6;
99 case MED::ePYRA5: return VISU::ePYRA5;
101 case MED::eSEG3: return VISU::eSEG3;
102 case MED::eTRIA6: return VISU::eTRIA6;
103 case MED::eQUAD8: return VISU::eQUAD8;
104 case MED::eQUAD9: return VISU::eQUAD9;
105 case MED::eOCTA12: return VISU::eOCTA12;
106 case MED::eTETRA10: return VISU::eTETRA10;
107 case MED::eHEXA20: return VISU::eHEXA20;
108 case MED::eHEXA27: return VISU::eHEXA27;
109 case MED::ePENTA15: return VISU::ePENTA15;
110 case MED::ePYRA13: return VISU::ePYRA13;
112 case MED::ePOLYGONE: return VISU::ePOLYGONE;
113 case MED::ePOLYEDRE: return VISU::ePOLYEDRE;
119 //---------------------------------------------------------------
120 MED::EGeometrieElement
121 VISUGeom2MED(int theGeom)
124 case VISU::ePOINT1: return MED::ePOINT1;
125 case VISU::eSEG2: return MED::eSEG2;
126 case VISU::eTRIA3: return MED::eTRIA3;
127 case VISU::eQUAD4: return MED::eQUAD4;
128 case VISU::eTETRA4: return MED::eTETRA4;
129 case VISU::eHEXA8: return MED::eHEXA8;
130 case VISU::ePENTA6: return MED::ePENTA6;
131 case VISU::ePYRA5: return MED::ePYRA5;
133 case VISU::eSEG3: return MED::eSEG3;
134 case VISU::eTRIA6: return MED::eTRIA6;
135 case VISU::eQUAD8: return MED::eQUAD8;
136 case VISU::eQUAD9: return MED::eQUAD9;
137 case VISU::eOCTA12: return MED::eOCTA12;
138 case VISU::eTETRA10: return MED::eTETRA10;
139 case VISU::eHEXA20: return MED::eHEXA20;
140 case VISU::eHEXA27: return MED::eHEXA27;
141 case VISU::ePENTA15: return MED::ePENTA15;
142 case VISU::ePYRA13: return MED::ePYRA13;
144 case VISU::ePOLYGONE: return MED::ePOLYGONE;
145 case VISU::ePOLYEDRE: return MED::ePOLYEDRE;
147 return MED::EGeometrieElement(-1);
151 //---------------------------------------------------------------
153 MEDEntityToVTK( MED::EEntiteMaillage theMEDEntity )
155 VISU::TEntity anEntity = VISU::TEntity( -1 );
157 switch(theMEDEntity){
159 anEntity = VISU::NODE_ENTITY;
162 anEntity = VISU::EDGE_ENTITY;
165 anEntity = VISU::FACE_ENTITY;
168 anEntity = VISU::CELL_ENTITY;
170 case MED::eNOEUD_ELEMENT :
171 anEntity = VISU::CELL_ENTITY;
179 //---------------------------------------------------------------
181 VTKEntityToMED(VISU::TEntity theVTKEntity)
183 switch(theVTKEntity){
184 case VISU::NODE_ENTITY: return MED::eNOEUD;
185 case VISU::EDGE_ENTITY: return MED::eARETE;
186 case VISU::FACE_ENTITY: return MED::eFACE;
187 case VISU::CELL_ENTITY: return MED::eMAILLE;
189 return MED::EEntiteMaillage(-1);
193 //---------------------------------------------------------------
195 CrSubProfile(const MED::PWrapper& theMEDWrapper,
196 const MED::PMeshInfo& theMeshInfo,
197 MED::EEntiteMaillage theMEntity,
198 MED::EGeometrieElement theMGeom,
199 const MED::TGeom2Size& theGeom2Size,
200 const MED::TGeom2Profile& theGeom2Profile)
202 VISU::EGeometry aEGeom = MEDGeom2VISU(theMGeom);
203 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
205 VISU::PMEDSubProfile aSubProfile(new VISU::TMEDSubProfile());
206 aSubProfile->myGeom = aEGeom;
207 aSubProfile->myMGeom = theMGeom;
208 aSubProfile->myStatus = VISU::eAddAll;
210 MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(theMGeom);
211 if(aTimeStampIter == theGeom2Size.end())
212 aSubProfile->myStatus = VISU::eRemoveAll;
214 MED::TGeom2Profile::const_iterator aProfileIter = theGeom2Profile.find(theMGeom);
215 if(aProfileIter != theGeom2Profile.end()){
216 MED::PProfileInfo aProfileInfo = aProfileIter->second;
218 aSubProfile->myName = aProfileInfo->GetName();
219 aSubProfile->myStatus = VISU::eAddPart;
221 const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
222 TInt aNbElem = anElemNum.size();
223 aSubProfile->myNbCells = aNbElem;
225 case MED::ePOLYGONE: {
226 MED::PPolygoneInfo aPolygoneInfo =
227 theMEDWrapper->GetPPolygoneInfo(theMeshInfo,theMEntity,theMGeom);
228 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
229 TInt aNbConn = aPolygoneInfo->GetNbConn( anElemNum[ anElemId ] - 1 );
230 aSubProfile->myCellsSize += aNbConn;
234 case MED::ePOLYEDRE: {
235 MED::PPolyedreInfo aPolyedreInfo =
236 theMEDWrapper->GetPPolyedreInfo(theMeshInfo,theMEntity,theMGeom);
237 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
238 MED::TCConnSliceArr aConnSliceArr =
239 aPolyedreInfo->GetConnSliceArr( anElemNum[ anElemId ] - 1 );
240 TInt aNbFaces = aConnSliceArr.size();
242 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
243 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
244 TInt aNbConn = aConnSlice.size();
245 aCellSize += aNbConn;
247 aSubProfile->myCellsSize += aCellSize;
252 aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes;
255 TInt aNbElem = aTimeStampIter->second;
256 aSubProfile->myNbCells = aNbElem;
258 case MED::ePOLYGONE: {
259 MED::PPolygoneInfo aPolygoneInfo =
260 theMEDWrapper->GetPPolygoneInfo(theMeshInfo,theMEntity,theMGeom);
261 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
262 TInt aNbConn = aPolygoneInfo->GetNbConn(anElemId);
263 aSubProfile->myCellsSize += aNbConn;
267 case MED::ePOLYEDRE: {
268 MED::PPolyedreInfo aPolyedreInfo =
269 theMEDWrapper->GetPPolyedreInfo(theMeshInfo,theMEntity,theMGeom);
270 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
271 MED::TCConnSliceArr aConnSliceArr =
272 aPolyedreInfo->GetConnSliceArr(anElemId);
273 TInt aNbFaces = aConnSliceArr.size();
275 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
276 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
277 TInt aNbConn = aConnSlice.size();
278 aCellSize += aNbConn;
280 aSubProfile->myCellsSize += aCellSize;
285 aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes;
290 "- aMGeom = "<<theMGeom<<
291 "; aEGeom = "<<aEGeom<<
292 "; aName = '"<<aSubProfile->myName<<"'"<<
293 "; aStatus = "<<aSubProfile->myStatus<<
294 "; aNbCells = "<<aSubProfile->myNbCells<<
295 "; aCellsSize = "<<aSubProfile->myCellsSize<<
302 //---------------------------------------------------------------
304 GetProfileKey(const MED::PWrapper& theMEDWrapper,
305 const MED::PMeshInfo& theMeshInfo,
306 const MED::PTimeStampValueBase& theTimeStampValue,
307 const VISU::TMEDMeshOnEntity& theMeshOnEntity,
308 MED::EEntiteMaillage theMEntity,
309 const MED::TGeom2Size& theGeom2Size)
311 INITMSG(MYDEBUG,"GetProfileKey"<<endl);
313 VISU::TProfileKey aProfileKey;
314 const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
316 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
317 MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin();
318 for(; anIter != aGeom2Size.end(); anIter++){
319 MED::EGeometrieElement aMGeom = anIter->first;
320 VISU::PSubProfile aSubProfile = CrSubProfile(theMEDWrapper,
326 aProfileKey.insert(aSubProfile);
333 //---------------------------------------------------------------
335 InitProfile(const MED::PWrapper& theMEDWrapper,
336 const MED::PMeshInfo& theMeshInfo,
337 MED::PTimeStampValueBase& theTimeStampValue,
338 VISU::TMEDMeshOnEntity& theMeshOnEntity,
339 MED::EEntiteMaillage theMEntity,
340 const MED::TGeom2Size& theGeom2Size,
341 VISU::TMEDValForTime& theValForTime)
343 VISU::TTimerLog aTimerLog(MYDEBUG,"InitProfile");
344 INITMSG(MYDEBUG,"InitProfile"<<endl);
346 VISU::TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap;
348 VISU::TProfileKey aProfileKey = GetProfileKey(theMEDWrapper,
355 VISU::TProfileMap::const_iterator anIter = aProfileMap.find(aProfileKey);
356 if(anIter != aProfileMap.end()){
357 theValForTime.myProfile = anIter->second;
358 INITMSG(MYDEBUG,"aProfileMap.find(aProfileKey)"<<endl);
360 VISU::PMEDProfile aProfile(new VISU::TMEDProfile());
361 VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
363 VISU::TProfileKey::const_iterator anIter = aProfileKey.begin();
364 for(; anIter != aProfileKey.end(); anIter++){
365 VISU::PMEDSubProfile aSubProfile(*anIter);
367 if(aProfile->myIsAll && aSubProfile->myStatus != VISU::eAddAll)
368 aProfile->myIsAll = false;
370 VISU::EGeometry aEGeom = aSubProfile->myGeom;
371 aGeom2SubProfile[aEGeom] = aSubProfile;
374 aProfileMap[aProfileKey] = aProfile;
375 theValForTime.myProfile = aProfile;
380 //---------------------------------------------------------------
382 GetGaussKey(const MED::PTimeStampValueBase& theTimeStampValue,
383 const VISU::TMEDMeshOnEntity& theMeshOnEntity,
384 const MED::TGeom2Size& theGeom2Size,
385 VISU::TMEDValForTime& theValForTime)
387 VISU::TTimerLog aTimerLog(MYDEBUG,"GetGaussKey");
388 INITMSG(MYDEBUG,"GetGaussKey"<<endl);
390 VISU::TGaussKey aGaussKey;
391 VISU::PMEDProfile aProfile = theValForTime.myProfile;
392 VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
394 const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
395 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
397 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
398 MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin();
399 for(; anIter != aGeom2Size.end(); anIter++){
400 MED::EGeometrieElement aMGeom = anIter->first;
401 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
403 VISU::TGeom2SubProfile::iterator anIter2 = aGeom2SubProfile.find(aEGeom);
404 if(anIter2 == aGeom2SubProfile.end()){
405 INITMSG(MYDEBUG,"anIter2 == aGeom2SubProfile.end!!"<<endl);
408 VISU::PMEDSubProfile aSubProfile = anIter2->second;
410 MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(aMGeom);
411 if(aTimeStampIter != theGeom2Size.end()){
412 TInt aNbCells = aTimeStampIter->second;
413 if(aSubProfile->myStatus == VISU::eAddPart)
414 aNbCells = aSubProfile->myNbCells;
416 VISU::PMEDGaussSubMesh aGaussSubMesh(new VISU::TMEDGaussSubMesh());
417 aGaussSubMesh->mySubProfile = aSubProfile;
418 aGaussSubMesh->myStatus = aSubProfile->myStatus;
420 VISU::PMEDGauss aGauss(new VISU::TMEDGauss());
421 aGaussSubMesh->myGauss = aGauss;
422 aGauss->myGeom = aEGeom;
423 aGauss->myNbPoints = 1;
425 MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
426 if(aGaussIter != aGeom2Gauss.end()){
427 MED::PGaussInfo aGaussInfo = aGaussIter->second;
428 aGauss->myGaussInfo = aGaussInfo;
429 aGauss->myName = aGaussInfo->GetName();
430 aGauss->myNbPoints = aGaussInfo->GetNbGauss();
431 } else if ( aTimeStampInfo.GetNbGauss(aMGeom) > 1 )
432 EXCEPTION( std::runtime_error, "aGaussIter == aGeom2Gauss.end()"
433 " && aTimeStampInfo.GetNbGauss(aMGeom) > 1 !!!" );
435 aGaussSubMesh->myNbCells = aNbCells*aGauss->myNbPoints;
436 aGaussSubMesh->myCellsSize = aGaussSubMesh->myNbCells*2;
438 aGaussKey.insert(aGaussSubMesh);
441 "- aEGeom = "<<aGauss->myGeom<<
442 "; aName = '"<<aGauss->myName<<"'"<<
443 "; aNbGauss = "<<aGauss->myNbPoints<<
444 "; aStatus = "<<aGaussSubMesh->myStatus<<
445 "; aNbCells = "<<aGaussSubMesh->myNbCells<<
446 "; aCellsSize = "<<aGaussSubMesh->myCellsSize<<
457 //---------------------------------------------------------------
459 InitGaussMesh(MED::PTimeStampValueBase& theTimeStampValue,
460 VISU::TMEDMeshOnEntity& theMeshOnEntity,
461 const MED::TGeom2Size& theGeom2Size,
462 VISU::TMEDValForTime& theValForTime)
464 VISU::TTimerLog aTimerLog(MYDEBUG,"InitGaussMesh");
465 INITMSG(MYDEBUG,"InitGaussMesh"<<endl);
467 if(theMeshOnEntity.myEntity == VISU::NODE_ENTITY)
470 VISU::TGaussMeshMap& aGaussMeshMap = theMeshOnEntity.myGaussMeshMap;
472 VISU::TGaussKey aGaussKey = GetGaussKey(theTimeStampValue,
477 VISU::TGaussMeshMap::const_iterator anIter = aGaussMeshMap.find(aGaussKey);
478 if(anIter != aGaussMeshMap.end()){
479 theValForTime.myGaussMesh = anIter->second;
480 INITMSG(MYDEBUG,"aGaussMeshMap.find(aGaussKey)"<<endl);
482 VISU::PMEDGaussMesh aGaussMesh(new VISU::TMEDGaussMesh());
483 VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
485 VISU::TGaussKey::const_iterator anIter = aGaussKey.begin();
486 for(; anIter != aGaussKey.end(); anIter++){
487 VISU::PMEDGaussSubMesh aGaussSubMesh(*anIter);
488 VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss;
489 VISU::EGeometry aEGeom = aGauss->myGeom;
490 aGeom2GaussSubMesh[aEGeom] = aGaussSubMesh;
494 VISU::TGaussSubMeshArr& aGaussSubMeshArr = aGaussMesh->myGaussSubMeshArr;
495 aGaussSubMeshArr.resize(aGeom2GaussSubMesh.size());
496 VISU::TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
497 for(TInt anID = 0; anIter != aGeom2GaussSubMesh.end(); anIter++, anID++){
498 const VISU::PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
499 aGaussSubMeshArr[anID] = aGaussSubMesh;
502 INITMSG(MYDEBUG,"aGaussMeshMap[aGaussKey] = aGaussMesh"<<std::endl);
503 aGaussMeshMap[aGaussKey] = aGaussMesh;
504 theValForTime.myGaussMesh = aGaussMesh;
508 //---------------------------------------------------------------
510 BuildMeshOnEntityMap(VISU::PMEDMesh theMesh,
511 const MED::TEntityInfo& theEntityInfo,
512 const MED::PNodeInfo& theNodeInfo,
513 const MED::PWrapper& theMEDWrapper)
515 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMeshOnEntityMap");
516 INITMSG(MYDEBUG,"BuildMeshOnEntityMap"<<endl);
518 MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
519 const std::string& aMeshName = theMesh->myName;
520 VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
521 MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
522 for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
523 const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
524 const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
526 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
527 VISU::PMEDMeshOnEntity aMeshOnEntity =
528 aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
529 aMeshOnEntity->myEntity = aVEntity;
530 aMeshOnEntity->myMeshName = aMeshName;
531 aMeshOnEntity->myGeom2Size = aGeom2Size;
532 VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
533 VISU::TGeom2ElemID2FamilyID& aGeom2ElemID2FamilyID = aMeshOnEntity->myGeom2ElemID2FamilyID;
536 "- aMEntity = "<<aMEntity<<
537 "; aVEntity = "<<aVEntity<<
540 if(aMEntity == MED::eNOEUD){
541 aMeshOnEntity->myNbCells = theMesh->myNbPoints;
542 aMeshOnEntity->myCellsSize = 2*theMesh->myNbPoints;
544 VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[MED::ePOINT1];
546 for(TInt iElem = 0; iElem < theMesh->myNbPoints; iElem++){
547 TInt aFamId = theNodeInfo->GetFamNum(iElem);
549 aFamilyID2CellsSize[aFamId] += 2;
550 anElemID2FamilyID[iElem] = aFamId;
554 "- myNbCells = "<<aMeshOnEntity->myNbCells<<
555 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
559 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
560 aMeshOnEntity->myNbCells = 0;
561 aMeshOnEntity->myCellsSize = 0;
562 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
563 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
565 VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom];
567 case MED::ePOLYGONE: {
568 MED::PPolygoneInfo aPolygoneInfo = theMEDWrapper->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
569 TInt aNbElem = aPolygoneInfo->GetNbElem();
572 "- aMGeom = "<<aMGeom<<
573 "; aNbElem = "<<aNbElem<<
576 aMeshOnEntity->myNbCells += aNbElem;
577 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
578 TInt aNbConn = aPolygoneInfo->GetNbConn(anElemId);
579 aMeshOnEntity->myCellsSize += aNbConn;
580 TInt aFamId = aPolygoneInfo->GetFamNum(anElemId);
582 aFamilyID2CellsSize[aFamId] += aNbConn + 1;
583 anElemID2FamilyID[anElemId] = aFamId;
587 case MED::ePOLYEDRE: {
588 MED::PPolyedreInfo aPolyedreInfo = theMEDWrapper->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
589 TInt aNbElem = aPolyedreInfo->GetNbElem();
592 "- aMGeom = "<<aMGeom<<
593 "; aNbElem = "<<aNbElem<<
596 aMeshOnEntity->myNbCells += aNbElem;
597 for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
598 MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(anElemId);
599 TInt aNbFaces = aConnSliceArr.size();
601 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
602 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
603 TInt aNbConn = aConnSlice.size();
604 aCellSize += aNbConn;
606 aMeshOnEntity->myCellsSize += aCellSize;
607 TInt aFamId = aPolyedreInfo->GetFamNum(anElemId);
609 aFamilyID2CellsSize[aFamId] += aCellSize + 1;
610 anElemID2FamilyID[anElemId] = aFamId;
615 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
616 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
617 MED::PCellInfo aCellInfo = theMEDWrapper->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
618 TInt aNbElem = aCellInfo->GetNbElem();
619 aMeshOnEntity->myNbCells += aNbElem;
620 aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
623 "- aMGeom = "<<aMGeom<<
624 "; aNbElem = "<<aNbElem<<
625 "; myNbCells = "<<aMeshOnEntity->myNbCells<<
626 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
629 for(TInt iElem = 0; iElem < aNbElem; iElem++){
630 TInt aFamId = aCellInfo->GetFamNum(iElem);
632 aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
633 anElemID2FamilyID[iElem] = aFamId;
635 }} // end switch(...)
641 //---------------------------------------------------------------
643 BuildMeshGrilleOnEntityMap(VISU::PMEDMesh theMesh,
644 const MED::TEntityInfo& theEntityInfo,
645 const MED::PGrilleInfo& theGrilleInfo,
646 const MED::PWrapper& theMEDWrapper)
648 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMeshGrilleOnEntityMap");
649 INITMSG(MYDEBUG,"BuildMeshGrilleOnEntityMap"<<endl);
651 MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
652 const std::string& aMeshName = theMesh->myName;
653 VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
654 MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
656 VISU::TStructuredId& aGrilleStructure = theMesh->myGrilleStructure;
657 if ( theGrilleInfo->GetGrilleType() != MED::eGRILLE_STANDARD )
658 for ( int aDimId = 0; aDimId < theMesh->myDim; aDimId++ )
659 aGrilleStructure[aDimId] = theGrilleInfo->GetNbIndexes(aDimId);
661 MED::TIntVector aVector = theGrilleInfo->GetGrilleStructure();
662 for ( int aDimId = 0; aDimId < aVector.size(); aDimId++ )
663 aGrilleStructure[aDimId] = aVector[aDimId];
666 int kMax = aGrilleStructure[2];
667 int jMax = aGrilleStructure[1];
668 int iMax = aGrilleStructure[0];
671 VISU::TObj2StructuredId& aObj2StructuredId = theMesh->myObj2StructuredId;
672 switch ( theMesh->myDim ) {
674 for ( int i = 1; i <= iMax; i++ )
675 aObj2StructuredId[i-1][0] = i;
678 for ( int j = 1; j <= jMax; j++ )
679 for ( int i = 1; i <= iMax; i++ ) {
680 aObj2StructuredId[iii][0] = i;
681 aObj2StructuredId[iii][1] = j;
686 for ( int k = 1; k <= kMax; k++ )
687 for ( int j = 1; j <= jMax; j++ )
688 for ( int i = 1; i <= iMax; i++ ) {
689 aObj2StructuredId[iii][0] = i;
690 aObj2StructuredId[iii][1] = j;
691 aObj2StructuredId[iii][2] = k;
696 for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
697 const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
698 const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
700 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
701 VISU::PMEDMeshOnEntity aMeshOnEntity =
702 aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
703 aMeshOnEntity->myEntity = aVEntity;
704 aMeshOnEntity->myMeshName = aMeshName;
705 aMeshOnEntity->myGeom2Size = aGeom2Size;
706 VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
707 VISU::TGeom2ElemID2FamilyID& aGeom2ElemID2FamilyID = aMeshOnEntity->myGeom2ElemID2FamilyID;
710 "- aMEntity = "<<aMEntity<<
711 "; aVEntity = "<<aVEntity<<
714 if(aMEntity == MED::eNOEUD){
715 aMeshOnEntity->myNbCells = theGrilleInfo->GetNbNodes();
716 aMeshOnEntity->myCellsSize = 2*theGrilleInfo->GetNbNodes();
718 VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[MED::ePOINT1];
720 if((theGrilleInfo->myFamNumNode).size() > 0)
721 for(TInt iElem = 0; iElem < theGrilleInfo->GetNbNodes(); iElem++){
722 TInt aFamId = theGrilleInfo->GetFamNumNode(iElem);
724 aFamilyID2CellsSize[aFamId] += 2;
725 anElemID2FamilyID[iElem] = aFamId;
729 "- myNbCells = "<<aMeshOnEntity->myNbCells<<
730 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
734 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
735 aMeshOnEntity->myNbCells = 0;
736 aMeshOnEntity->myCellsSize = 0;
737 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
738 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
739 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
740 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
741 TInt aNbElem = aGeom2SizeIter->second;//theGrilleInfo->GetNbCells();
742 aMeshOnEntity->myNbCells += aNbElem;
743 aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
745 VISU::TElemID2FamilyID& anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom];
748 "- aMGeom = "<<aMGeom<<
749 "; aNbElem = "<<aNbElem<<
750 "; myNbCells = "<<aMeshOnEntity->myNbCells<<
751 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
754 MED::TElemNum& famNums =
755 (aMEntity == MED::eMAILLE) ? theGrilleInfo->myFamNum : theGrilleInfo->myFamSubNum;
756 if (famNums.size() == aNbElem)
757 for(TInt iElem = 0; iElem < aNbElem; iElem++){
758 TInt aFamId = famNums[iElem];
760 aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
761 anElemID2FamilyID[iElem] = aFamId;
769 //---------------------------------------------------------------
771 BuildFieldMap(VISU::PMEDMesh theMesh,
772 const MED::TEntityInfo& theEntityInfo,
773 MED::PWrapper theMEDWrapper)
775 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFieldMap");
776 TInt aNbFields = theMEDWrapper->GetNbFields();
777 MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
778 const std::string& aMeshName = theMesh->myName;
779 INITMSG(MYDEBUG,"BuildFieldMap: aNbFields = "<<aNbFields<<"\n");
780 for(TInt iField = 1; iField <= aNbFields; iField++){
781 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPFieldInfo");
783 MED::TErr anError = 0;
784 MED::PFieldInfo aFieldInfo = theMEDWrapper->GetPFieldInfo(aMeshInfo, iField, &anError);
788 TInt aNbComp = aFieldInfo->GetNbComp();
789 std::string aFieldName = aFieldInfo->GetName();
791 MED::TGeom2Size aGeom2Size;
792 MED::EEntiteMaillage aMEntity;
793 TInt aNbTimeStamps = theMEDWrapper->GetNbTimeStamps(aFieldInfo,
797 if(aNbTimeStamps < 1)
800 VISU::TEntity aVEntity = MEDEntityToVTK( aMEntity );
801 vtkIdType aDataType = VTK_DOUBLE;
802 if ( aFieldInfo->GetType() != MED::eFLOAT64 ) {
803 #if defined(HAVE_F77INT64)
804 aDataType = VTK_LONG;
809 VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
810 VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
811 VISU::PMEDField aField = aFieldMap[aFieldName](new VISU::TMEDField());
812 aField->myId = iField;
813 aField->Init(aNbComp, aDataType);
814 aField->myEntity = aVEntity;
815 aField->myName = aFieldName;
816 aField->myMeshName = aMeshName;
817 aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
818 aField->myIsELNO = ( aMEntity == MED::eNOEUD_ELEMENT );
820 INITMSG(MYDEBUG,"myName = '"<<aField->myName<<"'"<<
821 "; myId = "<<aField->myId<<
822 "; myEntity = "<<aField->myEntity<<
823 "; myDataSize = "<<aField->myDataSize<<
824 "; myNbComp = "<<aField->myNbComp<<"\n");
826 for(TInt iComp = 0; iComp < aNbComp; iComp++){
827 aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
828 aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
831 for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
832 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPTimeStampInfo");
834 MED::TErr anError = 0;
835 MED::PTimeStampInfo aTimeStampInfo = theMEDWrapper->GetPTimeStampInfo(aFieldInfo,
843 TFloat aDt = aTimeStampInfo->GetDt();
844 std::string anUnitDt = aTimeStampInfo->GetUnitDt();
846 VISU::TValField& aValField = aField->myValField;
847 VISU::PMEDValForTime aValForTime = aValField[iTimeStamp](new VISU::TMEDValForTime());
848 aValForTime->myId = iTimeStamp;
849 aValForTime->myFieldName = aField->myName;
850 aValForTime->myEntity = aField->myEntity;
851 aValForTime->myMeshName = aField->myMeshName;
852 aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
853 INITMSG(MYDEBUG,"aDt = '"<<aDt<<", "<<anUnitDt<<"'\n");
855 VISU::TGeom2NbGauss& aVGeom2NbGauss = aValForTime->myGeom2NbGauss;
856 const MED::TGeom2NbGauss& aMGeom2NbGauss = aTimeStampInfo->myGeom2NbGauss;
857 MED::TGeom2NbGauss::const_iterator anIter = aMGeom2NbGauss.begin();
858 for(; anIter != aMGeom2NbGauss.end(); anIter++){
859 const MED::EGeometrieElement& aMGeom = anIter->first;
860 VISU::EGeometry aEGeom = MEDGeom2VISU( aMGeom );
861 TInt aNbGauss = anIter->second;
862 aVGeom2NbGauss[ aEGeom ] = aNbGauss;
864 // ELNO data should satisfy the following condition ( implicitly )
865 vtkIdType aNbNodes = MEDGeom2NbNodes( aMGeom );
866 aField->myIsELNO &= ( aNbGauss == aNbNodes );
873 //---------------------------------------------------------------
875 BuildFamilyMap(VISU::PMEDMesh theMesh,
876 const MED::TEntityInfo& theEntityInfo,
877 const MED::TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo,
878 const MED::TFamilyInfoSet& theFamilyInfoSet,
879 MED::PWrapper theMEDWrapper)
881 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFamilyMap");
882 INITMSG(MYDEBUG,"BuildFamilyMap\n");
884 MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
885 MED::TEntity2FamilySet aEntity2FamilySet = MED::GetEntity2FamilySet(theMEDWrapper,theEntity2TGeom2ElemInfo,theFamilyInfoSet);
886 MED::TEntity2FamilySet::const_iterator aEntity2FamilySetIter = aEntity2FamilySet.begin();
887 for(; aEntity2FamilySetIter != aEntity2FamilySet.end(); aEntity2FamilySetIter++){
888 const MED::EEntiteMaillage& aMEntity = aEntity2FamilySetIter->first;
889 const MED::TFamilyTSizeSet& aFamilyTSizeSet = aEntity2FamilySetIter->second;
891 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
892 VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
893 const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
894 VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
895 VISU::TFamilyIDMap& aFamilyIDMap = aMeshOnEntity->myFamilyIDMap;
897 if(aFamilyTSizeSet.empty())
900 INITMSG(MY_FAMILY_DEBUG,
901 "- aMEntity = "<<aMEntity<<
902 "; aVEntity = "<<aVEntity<<
905 MED::TFamilyTSizeSet::const_iterator aFamilyTSizeSetIter = aFamilyTSizeSet.begin();
906 for(; aFamilyTSizeSetIter != aFamilyTSizeSet.end(); aFamilyTSizeSetIter++){
907 const MED::TFamilyTSize& aFamilyTSize = *aFamilyTSizeSetIter;
908 const MED::PFamilyInfo& aFamilyInfo = boost::get<0>(aFamilyTSize);
909 TInt aSize = boost::get<1>(aFamilyTSize);
910 TInt anId = aFamilyInfo->GetId();
914 std::string aFamilyName = aFamilyInfo->GetName();
916 VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily());
917 aFamily->myId = anId;
918 aFamily->myEntity = aVEntity;
919 aFamily->myName = aFamilyName;
920 aFamily->myNbCells = aSize;
922 aFamily->myCellsSize = 0;
923 VISU::TFamilyID2CellsSize::const_iterator anIter = aFamilyID2CellsSize.find(anId);
924 if(anIter != aFamilyID2CellsSize.end())
925 aFamily->myCellsSize = anIter->second;
927 const TInt aNbGroup = aFamilyInfo->GetNbGroup();
928 VISU::TNames& aGroupNames = aFamily->myGroupNames;
929 aGroupNames.resize(aNbGroup);
930 for(TInt i = 0; i < aNbGroup; i++){
931 std::string aGroupName = aFamilyInfo->GetGroupName(i);
932 aGroupNames[i] = aGroupName;
935 aFamilyIDMap[anId] = aFamily;
937 INITMSG(MY_FAMILY_DEBUG,
938 "- aFamilyName = '"<<aFamilyName<<"'"<<
939 "; myId = "<<aFamily->myId<<"; "<<
940 "; aNbAttr = "<<aFamilyInfo->GetNbAttr()<<
941 "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
942 "; aVEntity = "<<aVEntity<<
943 "; myNbCells = "<<aFamily->myNbCells<<
944 "; myCellsSize = "<<aFamily->myCellsSize<<
947 for(TInt i = 0; i < aNbGroup; i++){
948 std::string aGroupName = aFamilyInfo->GetGroupName(i);
949 INITMSG(MY_FAMILY_DEBUG,"- aGroupName = '"<<aGroupName<<"'\n");
959 * Build grille family map
962 BuildGrilleFamilyMap(VISU::PMEDMesh theMesh,
963 const MED::TEntityInfo& theEntityInfo,
964 const MED::TFamilyInfoSet& theFamilyInfoSet,
965 MED::PWrapper theMEDWrapper)
967 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGrilleFamilyMap");
968 INITMSG(MYDEBUG,"BuildGrilleFamilyMap\n");
970 VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
972 MED::TEntityInfo::const_iterator aEntityIter = theEntityInfo.begin();
974 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
975 MED::PGrilleInfo aGrilleInfo = theMEDWrapper->GetPGrilleInfo(aMeshInfo);
977 const MED::TFamilyID2NbCells& aFam2NbCells = MED::GetFamilyID2NbCells(aGrilleInfo);
979 MED::TFamilyInfoSet::const_iterator aFamInter = theFamilyInfoSet.begin();
980 for(; aFamInter != theFamilyInfoSet.end(); aFamInter++){
981 const MED::PFamilyInfo& aFamilyInfo = *aFamInter;
982 TInt anId = aFamilyInfo->GetId();
987 std::string aFamilyName = aFamilyInfo->GetName();
988 const MED::EEntiteMaillage& aMEntity = MED::GetEntityByFamilyId(aGrilleInfo,
990 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
992 VISU::PMEDMeshOnEntity aMeshOnEntity;
993 VISU::TMeshOnEntityMap::iterator aMeshOnEntityIter = aMeshOnEntityMap.find(aVEntity);
994 if(aMeshOnEntityIter != aMeshOnEntityMap.end())
995 aMeshOnEntity = aMeshOnEntityIter->second;
997 VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
998 VISU::TFamilyIDMap& aFamilyIDMap = aMeshOnEntity->myFamilyIDMap;
1000 VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily());
1001 aFamily->myId = anId;
1002 aFamily->myEntity = aVEntity;
1003 aFamily->myName = aFamilyName;
1004 aFamily->myNbCells = 0;
1005 aFamily->myCellsSize = 0;
1007 const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
1008 VISU::TFamilyID2CellsSize::const_iterator aFamilyid2CellsSizeIter = aFamilyID2CellsSize.find(anId);
1009 if(aFamilyid2CellsSizeIter != (aMeshOnEntity->myFamilyID2CellsSize).end())
1010 aFamily->myCellsSize = aFamilyid2CellsSizeIter->second;
1011 MED::TFamilyID2NbCells::const_iterator aFam2NbCellsIter = aFam2NbCells.find(anId);
1012 if(aFam2NbCellsIter != aFam2NbCells.end())
1013 aFamily->myNbCells = aFam2NbCellsIter->second;
1015 const TInt aNbGroup = aFamilyInfo->GetNbGroup();
1016 VISU::TNames& aGroupNames = aFamily->myGroupNames;
1017 aGroupNames.resize(aNbGroup);
1018 for(TInt i = 0; i < aNbGroup; i++){
1019 std::string aGroupName = aFamilyInfo->GetGroupName(i);
1020 aGroupNames[i] = aGroupName;
1023 aFamilyIDMap[anId] = aFamily;
1025 INITMSG(MY_FAMILY_DEBUG,
1026 "- aFamilyName =|"<<aFamily->myName<<"|"
1027 << "; myId = "<<aFamily->myId
1028 << "; aNbAttr = "<<aFamilyInfo->GetNbAttr()
1029 << "; aNbGroup = "<<aFamilyInfo->GetNbGroup()
1030 << "; aVEntity = "<<aVEntity
1031 << "; myNbCells = "<<aFamily->myNbCells
1032 << "; myCellsSize = "<<aFamily->myCellsSize
1039 //---------------------------------------------------------------
1041 BuildGroupMap(VISU::PMEDMesh theMesh,
1042 const MED::TFamilyInfoSet& theFamilyInfoSet)
1044 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGroupMap");
1045 INITMSG(MYDEBUG,"BuildGroupMap\n");
1047 VISU::TGroupMap& aGroupMap = theMesh->myGroupMap;
1048 MED::TGroupInfo aGroupInfo = MED::GetGroupInfo(theFamilyInfoSet);
1049 MED::TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
1050 for(; aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
1051 const std::string& aGroupName = aGroupInfoIter->first;
1052 INITMSG(MY_GROUP_DEBUG,"aGroupName = '"<<aGroupName<<"'\n");
1054 VISU::PMEDGroup aGroup(new VISU::TMEDGroup());
1055 VISU::TFamilySet& aFamilySet = aGroup->myFamilySet;
1057 const MED::TFamilyInfoSet& aFamilyInfoSet = aGroupInfoIter->second;
1058 MED::TFamilyInfoSet::const_iterator aFamilyIter = aFamilyInfoSet.begin();
1059 for(; aFamilyIter != aFamilyInfoSet.end(); aFamilyIter++){
1060 const MED::PFamilyInfo& aFamilyInfo = *aFamilyIter;
1061 std::string aFamilyName = aFamilyInfo->GetName();
1063 VISU::TEntity aVEntity = VISU::TEntity(-1);
1064 VISU::PMEDFamily aFamily;
1067 const VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
1068 VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
1069 for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
1070 const VISU::PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
1071 const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
1072 VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
1073 for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
1074 const std::string& aName = aFamilyMapIter->first;
1075 if(aName == aFamilyName){
1076 aFamily = aFamilyMapIter->second;
1077 aVEntity = aFamily->myEntity;
1078 if(aFamily && aVEntity >= 0){
1079 aFamilySet.insert(VISU::TEnity2Family(aVEntity, aFamily));
1080 INITMSG(MY_GROUP_DEBUG,
1081 "- aFamilyName = '"<<aFamilyName<<"'"<<
1082 "; aVEntity = "<<aVEntity<<
1089 if(!aFamilySet.empty())
1090 aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
1095 //---------------------------------------------------------------
1099 TSetIsDone(bool& theIsDone):
1111 //---------------------------------------------------------------
1116 //---------------------------------------------------------------
1118 TMEDNamedPointCoords
1119 ::Init(const MED::PNodeInfo& theNodeInfo,
1120 MED::EVersion theVersion)
1122 TMEDCoordHolder* aCoordHolder = new TMEDCoordHolder();
1123 TInt aNbElem = theNodeInfo->GetNbElem();
1124 TInt aDim = theNodeInfo->GetMeshInfo()->GetSpaceDim();
1125 aCoordHolder->Init(aNbElem, aDim, theNodeInfo->myCoord);
1126 TNamedPointCoords::Init(PCoordHolder(aCoordHolder));
1127 myVersion = theVersion;
1129 for(TInt iDim = 0; iDim < aDim; iDim++)
1130 myPointsDim[iDim] = theNodeInfo->GetCoordName(iDim);
1132 myIsElemNum = theNodeInfo->IsElemNum();
1133 if(theNodeInfo->IsElemNum())
1134 myElemNum = theNodeInfo->myElemNum;
1136 myIsElemNames = theNodeInfo->IsElemNames();
1137 if(theNodeInfo->IsElemNames())
1138 myElemNames = theNodeInfo->myElemNames;
1142 TMEDNamedPointCoords
1143 ::Init(const MED::PGrilleInfo& theGrilleInfo)
1145 TMEDCoordHolder* aCoordHolder = new TMEDCoordHolder();
1146 TInt aNbElem = theGrilleInfo->GetNbNodes();
1147 TInt aDim = theGrilleInfo->GetMeshInfo()->GetSpaceDim();
1148 MED::PNodeCoord aCoord(new MED::TNodeCoord(aNbElem * aDim));
1149 aCoordHolder->Init(aNbElem, aDim, aCoord);
1150 TNamedPointCoords::Init(PCoordHolder(aCoordHolder));
1152 for(TInt iDim = 0; iDim < aDim; iDim++)
1153 myPointsDim[iDim] = theGrilleInfo->GetCoordName(iDim);
1155 for(TInt iElem = 0; iElem < aNbElem; iElem++){
1156 VISU::TCoordSlice aVCoordSlice = GetCoordSlice(iElem);
1157 MED::TNodeCoord aMCoord = theGrilleInfo->GetCoord(iElem);
1158 for(TInt iDim = 0; iDim < aDim; iDim++){
1159 aVCoordSlice[iDim] = aMCoord[iDim];
1165 TMEDNamedPointCoords
1166 ::GetObjID(vtkIdType theID) const
1169 return (*myElemNum)[theID];
1170 return TNamedPointCoords::GetObjID(theID);
1175 TMEDNamedPointCoords
1176 ::GetVTKID(vtkIdType theID) const
1179 // To prepare corresponding mapper engine
1180 if(myObj2VTKID.empty()){
1181 vtkIdType anEnd = myElemNum->size();
1182 for(vtkIdType anID = 0; anID < anEnd; anID++)
1183 myObj2VTKID[(*myElemNum)[anID]] = anID;
1185 TObj2VTKID::const_iterator anIter = myObj2VTKID.find(theID);
1186 if(anIter != myObj2VTKID.end())
1187 return anIter->second;
1190 return TNamedPointCoords::GetVTKID(theID);
1194 GetPNOMLength(MED::EVersion theVersion)
1196 if(theVersion == MED::eV2_1)
1197 return MED::GetPNOMLength<MED::eV2_1>();
1198 return MED::GetPNOMLength<MED::eV2_2>();
1202 TMEDNamedPointCoords
1203 ::GetNodeName(vtkIdType theObjID) const
1206 return GetString(theObjID, GetPNOMLength(myVersion), *myElemNames);
1207 return TNamedPointCoords::GetNodeName(theObjID);
1211 TMEDNamedPointCoords
1214 size_t aSize = TNamedPointCoords::GetMemorySize();
1217 aSize += myObj2VTKID.size() * sizeof(vtkIdType) * 2;
1218 aSize += myElemNum->size() * sizeof(MED::TInt);
1222 aSize += myElemNames->size() * sizeof(char);
1227 //---------------------------------------------------------------
1230 ::GetElemObjID(vtkIdType theID) const
1232 if ( !mySubMeshID.empty() )
1233 theID = mySubMeshID[theID];
1236 return (*myElemNum)[theID];
1242 //---------------------------------------------------------------
1245 ::GetElemVTKID(vtkIdType theID) const
1248 for ( size_t anId = 0; anId < (*myElemNum).size(); anId++ )
1249 if ( (*myElemNum)[ anId ] == theID ) {
1254 return TSubProfileImpl::GetElemVTKID( theID );
1258 //----------------------------------------------------------------
1263 size_t aSize = TSubProfileImpl::GetMemorySize();
1265 aSize += myElemNum->size() * sizeof(MED::TInt);
1270 //---------------------------------------------------------------
1273 ::LessThan(const PGaussImpl& theGauss,
1274 bool& theResult) const
1276 TGaussImpl::LessThan(theGauss,theResult);
1278 if(PMEDGauss aGauss = theGauss){
1279 const MED::TGaussInfo& aLeft = myGaussInfo;
1280 const MED::TGaussInfo& aReight = aGauss->myGaussInfo;
1281 theResult = MED::TGaussInfo::TLess()(aLeft,aReight);
1287 //---------------------------------------------------------------
1290 ::GetObjID(vtkIdType theID) const
1292 vtkIdType aNbPoints = myGauss->myNbPoints;
1293 TCellID aCellID = theID / aNbPoints;
1294 TLocalPntID aLocalPntID = theID % aNbPoints;
1297 aCellID = GetElemObjID(aCellID);
1299 aCellID += myStartID;
1301 return TGaussPointID(aCellID, aLocalPntID);
1305 //---------------------------------------------------------------
1308 ::GetVTKID( const TGaussPointID& theID ) const
1310 vtkIdType aResult = -1;
1312 TCellID aCellID = theID.first;
1313 TLocalPntID aLocalPntID = theID.second;
1315 vtkIdType aNbPoints = myGauss->myNbPoints;
1316 if ( aLocalPntID >= aNbPoints )
1319 if ( myIsElemNum ) {
1320 aCellID = GetElemVTKID( aCellID );
1322 aCellID -= myStartID;
1324 return aCellID * aNbPoints + aLocalPntID + myStartID;
1328 //---------------------------------------------------------------
1333 size_t aSize = TGaussSubMeshImpl::GetMemorySize();
1335 aSize += myElemNum->size() * sizeof(MED::TInt);
1340 //---------------------------------------------------------------
1343 ::Init(const MED::PElemInfo& theElemInfo,
1344 MED::EVersion theVersion)
1346 myVersion = theVersion;
1347 myIsElemNum = theElemInfo->IsElemNum();
1349 myElemNum = theElemInfo->myElemNum;
1351 myIsElemNames = theElemInfo->IsElemNames();
1352 if(theElemInfo->IsElemNames())
1353 myElemNames = theElemInfo->myElemNames;
1359 ::Init(const MED::PGrilleInfo& theGrilleInfo)
1364 ::GetElemObjID(vtkIdType theID) const
1367 return (*myElemNum)[theID];
1369 return TSubMeshImpl::GetElemObjID(theID);
1374 ::GetElemName(vtkIdType theObjID) const
1377 return GetString(theObjID, GetPNOMLength(myVersion), *myElemNames);
1378 return TSubMeshImpl::GetElemName(theObjID);
1385 size_t aSize = TSubMeshImpl::GetMemorySize();
1388 aSize += myElemNum->size() * sizeof(MED::TInt);
1391 aSize += myElemNames->size() * sizeof(char);
1397 //---------------------------------------------------------------
1401 //---------------------------------------------------------------
1404 CreateConvertor(const std::string& theFileName)
1406 if(MED::PWrapper aMed = MED::CrWrapper(theFileName,true))
1407 return new VISU_MedConvertor(theFileName, aMed);
1412 ::VISU_MedConvertor(const std::string& theFileName, MED::PWrapper theMed):
1413 myIsEntitiesDone(false),
1414 myIsFieldsDone(false),
1415 myIsGroupsDone(false),
1416 myIsMinMaxDone(false),
1419 myName = theFileName;
1423 //---------------------------------------------------------------
1428 if(myIsEntitiesDone)
1431 TSetIsDone aSetIsDone(myIsEntitiesDone);
1432 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildEntities");
1434 TInt aNbMeshes = myMed->GetNbMeshes();
1435 VISU::TMeshMap& aMeshMap = myMeshMap;
1437 INITMSG(MYDEBUG,"BuildEntities aNbMeshes = "<<aNbMeshes<<"\n");
1439 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
1443 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
1445 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
1446 std::string aMeshName = aMeshInfo->GetName();
1447 TInt aDim = aMeshInfo->GetDim();
1448 MED::EMaillage aType = aMeshInfo->GetType();
1450 // creating TMesh structure and TMeshOnEntityMap
1451 VISU::PMEDMesh aMesh = aMeshMap[aMeshName](new VISU::TMEDMesh());
1453 aMesh->myDim = aDim;
1454 aMesh->myName = aMeshName;
1455 aMesh->myMeshInfo = aMeshInfo;
1456 aMesh->myNamedPointCoords(new VISU::TMEDNamedPointCoords());
1458 INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
1459 "; aDim = "<<aDim<<"\n");
1461 if(aType == MED::eNON_STRUCTURE){
1463 if(MED::PNodeInfo aNodeInfo = myMed->GetPNodeInfo(aMeshInfo)){
1464 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
1466 aMesh->myNbPoints = aNodeInfo->GetNbElem();
1467 aMesh->myEntityInfo = anEntityInfo;
1473 INITMSG(MYDEBUG,"myNbPoints = "<<aMesh->myNbPoints<<
1474 "; anEntityInfo.size() = "<<anEntityInfo.size()<<
1477 BuildMeshOnEntityMap(aMesh,
1483 }catch(std::exception& exc){
1484 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1486 MSG(MYDEBUG,"Unknown exception !!!");
1490 } // NON STRUCTURED MESH
1492 MED::PGrilleInfo aGrilleInfo = myMed->GetPGrilleInfo(aMeshInfo);
1494 MED::TEntityInfo anEntityInfo;
1495 anEntityInfo[MED::eNOEUD][MED::ePOINT1] = aGrilleInfo->GetNbNodes();
1496 anEntityInfo[aGrilleInfo->GetEntity()][aGrilleInfo->GetGeom()] = aGrilleInfo->GetNbCells();
1497 anEntityInfo[aGrilleInfo->GetSubEntity()][aGrilleInfo->GetSubGeom()] = aGrilleInfo->GetNbSubCells();
1499 aMesh->myNbPoints = aGrilleInfo->GetNbNodes();
1500 aMesh->myEntityInfo = anEntityInfo;
1502 aMesh->myIsPolarType = (MED::eGRILLE_POLAIRE == aGrilleInfo->GetGrilleType());
1503 aMesh->myIsStructured = true;
1507 BEGMSG(MYDEBUG,"anEntityInfo.size() = "<<anEntityInfo.size()<<"\n");
1509 BuildMeshGrilleOnEntityMap(aMesh,
1515 }catch(std::exception& exc){
1516 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1518 MSG(MYDEBUG,"Unknown exception !!!");
1525 }catch(std::exception& exc){
1526 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1528 MSG(MYDEBUG,"Unknown exception !!!");
1537 //---------------------------------------------------------------
1545 VISU_Convertor_impl::BuildFields();
1547 TSetIsDone aSetIsDone(myIsFieldsDone);
1548 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFields");
1550 TInt aNbMeshes = myMed->GetNbMeshes();
1551 VISU::TMeshMap& aMeshMap = myMeshMap;
1553 INITMSG(MYDEBUG,"BuildFields - aNbMeshes = "<<aNbMeshes<<"\n");
1555 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
1559 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
1561 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
1562 std::string aMeshName = aMeshInfo->GetName();
1564 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
1565 if(anIter == aMeshMap.end())
1567 VISU::PMEDMesh aMesh = anIter->second;
1569 INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
1573 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
1575 BuildFieldMap(aMesh,
1579 }catch(std::exception& exc){
1580 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1582 MSG(MYDEBUG,"Unknown exception !!!");
1587 }catch(std::exception& exc){
1588 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
1590 MSG(MYDEBUG,"Unknown exception !!!");
1599 //---------------------------------------------------------------
1600 template<class TimeStampValueType>
1602 BuildTimeStampMinMax(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
1603 const VISU::PMEDMeshOnEntity theMeshOnEntity,
1604 const MED::TGeom2Gauss& theGeom2Gauss,
1605 VISU::TMetric2Comp2MinMax& theMetric2Comp2MinMax,
1606 VISU::TMetric2Comp2MinMax& theMetric2Comp2AverageMinMax,
1607 VISU::TMetric2Comp2Group2MinMax& theMetric2Comp2Group2MinMax,
1608 VISU::TMetric2Comp2Group2MinMax& theMetric2Comp2Group2AverageMinMax,
1612 const VISU::TFamilyIDMap& aFamilyIDMap = theMeshOnEntity->myFamilyIDMap;
1613 VISU::TGeom2ElemID2FamilyID aGeom2ElemID2FamilyID = theMeshOnEntity->myGeom2ElemID2FamilyID;
1615 VISU::TVector<double> aBaseAverageValues;
1616 aBaseAverageValues.resize(3);
1617 aBaseAverageValues[VISU::AVERAGE_METRIC] = 0.0;
1618 aBaseAverageValues[VISU::MINIMUM_METRIC] = VTK_LARGE_FLOAT;
1619 aBaseAverageValues[VISU::MAXIMUM_METRIC] = -VTK_LARGE_FLOAT;
1621 const typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValue->myGeom2Value;
1622 typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
1623 for(; anIter != aGeom2Value.end(); anIter++){
1624 const typename TimeStampValueType::TTMeshValue& aMMeshValue = anIter->second;
1625 MED::EGeometrieElement aMGeom = anIter->first;
1627 TInt aNbElem = aMMeshValue.myNbElem;
1628 TInt aNbGauss = aMMeshValue.myNbGauss;
1630 // AKL: fix of 0021175 issue. Non-regression test is GVIEW10561(import zzzz121b.med).
1631 // MED::TGeom2Gauss::const_iterator aGaussIter = theGeom2Gauss.find(aMGeom);
1632 // if(aGaussIter == theGeom2Gauss.end())
1636 "- aMGeom = "<<aMGeom<<
1637 "; aNbElem = "<<aNbElem<<
1638 "; aNbGauss = "<<aNbGauss<<
1641 VISU::TElemID2FamilyID anElemID2FamilyID = aGeom2ElemID2FamilyID[aMGeom];
1643 bool isAverageByGaussPoints = (aNbGauss > 1);
1644 // To calculate min/max per components
1645 for(TInt iElem = 0; iElem < aNbElem; iElem++){
1646 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
1648 for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
1649 VISU::TComp2MinMax& aComp2MinMax = theMetric2Comp2MinMax[aGaussMetric];
1650 VISU::TComp2MinMax& aComp2AverageMinMax = theMetric2Comp2AverageMinMax[aGaussMetric];
1651 VISU::TComp2Group2MinMax& aComp2Group2MinMax = theMetric2Comp2Group2MinMax[aGaussMetric];
1652 VISU::TComp2Group2MinMax& aComp2Group2AverageMinMax = theMetric2Comp2Group2AverageMinMax[aGaussMetric];
1654 for(TInt iComp = 0; iComp < theNbComp; iComp++){
1655 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
1657 VISU::TMinMax& aMinMax = aComp2MinMax[iComp+1];
1658 vtkFloatingPointType& aMin = aMinMax.first;
1659 vtkFloatingPointType& aMax = aMinMax.second;
1660 VISU::TMinMax& anAverageMinMax = aComp2AverageMinMax[iComp+1];
1661 vtkFloatingPointType& anAverageMin = anAverageMinMax.first;
1662 vtkFloatingPointType& anAverageMax = anAverageMinMax.second;
1663 vtkFloatingPointType anAverageValue = aBaseAverageValues[aGaussMetric];
1665 VISU::TGroup2MinMax& aGroup2MinMax = aComp2Group2MinMax[iComp+1];
1666 VISU::TGroup2MinMax& aGroup2AverageMinMax = aComp2Group2AverageMinMax[iComp+1];
1667 std::map<VISU::TName,vtkFloatingPointType> aGroup2AverageValue;
1669 // get names of groups, to which the element belongs
1670 VISU::TNames aGroupNames;
1671 VISU::TElemID2FamilyID::const_iterator anIter = anElemID2FamilyID.find(iElem);
1672 if(anIter != anElemID2FamilyID.end()){
1673 int aFamilyId = anIter->second;
1675 VISU::TFamilyIDMap::const_iterator aFamilyIter = aFamilyIDMap.find(aFamilyId);
1676 if(aFamilyIter != aFamilyIDMap.end()){
1677 VISU::PMEDFamily aFamily = aFamilyIter->second;
1678 aGroupNames = aFamily->myGroupNames;
1679 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1680 for(; aGroupIter != aGroupNames.end(); aGroupIter++)
1681 aGroup2AverageValue[*aGroupIter] = aBaseAverageValues[aGaussMetric];
1686 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1687 const vtkFloatingPointType& aVal = aMValueSlice[iGauss];
1688 aMin = isnan(aVal) ? aVal : std::min(aMin,aVal);
1689 aMax = isnan(aVal) ? aVal : std::max(aMax,aVal);
1690 if(isAverageByGaussPoints){
1691 switch(aGaussMetric) {
1692 case VISU::AVERAGE_METRIC: anAverageValue += aVal; break;
1693 case VISU::MINIMUM_METRIC: anAverageValue = std::min(anAverageValue, aVal); break;
1694 case VISU::MAXIMUM_METRIC: anAverageValue = std::max(anAverageValue, aVal); break;
1698 anAverageMin = aMin;
1699 anAverageMax = aMax;
1702 // additional calculation for each group, to which the element belongs
1703 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1704 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1705 VISU::TName aGroupName = *aGroupIter;
1706 bool isGroupFound = aGroup2MinMax.find(aGroupName) != aGroup2MinMax.end();
1707 VISU::TMinMax& aGroupMinMax = aGroup2MinMax[aGroupName];
1708 vtkFloatingPointType& aGroupMin = aGroupMinMax.first;
1709 vtkFloatingPointType& aGroupMax = aGroupMinMax.second;
1710 aGroupMin = isGroupFound ? std::min(aGroupMin,aVal) : aVal;
1711 aGroupMax = isGroupFound ? std::max(aGroupMax,aVal) : aVal;
1713 if(isAverageByGaussPoints){
1714 switch(aGaussMetric) {
1715 case VISU::AVERAGE_METRIC: aGroup2AverageValue[aGroupName] = aGroup2AverageValue[aGroupName] + aVal; break;
1716 case VISU::MINIMUM_METRIC: aGroup2AverageValue[aGroupName] = std::min(aGroup2AverageValue[aGroupName], aVal); break;
1717 case VISU::MAXIMUM_METRIC: aGroup2AverageValue[aGroupName] = std::max(aGroup2AverageValue[aGroupName], aVal); break;
1721 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1722 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1723 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1724 aGroupAverageMin = aGroupMin;
1725 aGroupAverageMax = aGroupMax;
1729 if(isAverageByGaussPoints){
1730 if(aGaussMetric == VISU::AVERAGE_METRIC)
1731 anAverageValue /= aNbGauss;
1732 anAverageMin = std::min(anAverageMin,anAverageValue);
1733 anAverageMax = std::max(anAverageMax,anAverageValue);
1735 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1736 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1737 VISU::TName aGroupName = *aGroupIter;
1738 vtkFloatingPointType aGroupAverageValue = aGroup2AverageValue[aGroupName];
1739 if(aGaussMetric == VISU::AVERAGE_METRIC)
1740 aGroupAverageValue /= aNbGauss;
1741 bool isGroupFound = aGroup2AverageMinMax.find(aGroupName) != aGroup2AverageMinMax.end();
1742 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1743 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1744 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1745 aGroupAverageMin = isGroupFound ? std::min(aGroupAverageMin,aGroupAverageValue) : aGroupAverageValue;
1746 aGroupAverageMax = isGroupFound ? std::max(aGroupAverageMax,aGroupAverageValue) : aGroupAverageValue;
1753 // To calculate min/max per vector modulus
1754 for(int aGaussMetric = (int)VISU::AVERAGE_METRIC; aGaussMetric <= (int)VISU::MAXIMUM_METRIC; aGaussMetric++){
1755 VISU::TComp2MinMax& aComp2MinMax = theMetric2Comp2MinMax[aGaussMetric];
1756 VISU::TComp2MinMax& aComp2AverageMinMax = theMetric2Comp2AverageMinMax[aGaussMetric];
1757 VISU::TComp2Group2MinMax& aComp2Group2MinMax = theMetric2Comp2Group2MinMax[aGaussMetric];
1758 VISU::TComp2Group2MinMax& aComp2Group2AverageMinMax = theMetric2Comp2Group2AverageMinMax[aGaussMetric];
1760 VISU::TMinMax& aMinMax = aComp2MinMax[0];
1761 vtkFloatingPointType& aMin = aMinMax.first;
1762 vtkFloatingPointType& aMax = aMinMax.second;
1763 VISU::TMinMax& anAverageMinMax = aComp2AverageMinMax[0];
1764 vtkFloatingPointType& anAverageMin = anAverageMinMax.first;
1765 vtkFloatingPointType& anAverageMax = anAverageMinMax.second;
1767 VISU::TGroup2MinMax& aGroup2MinMax = aComp2Group2MinMax[0];
1768 VISU::TGroup2MinMax& aGroup2AverageMinMax = aComp2Group2AverageMinMax[0];
1770 for(TInt iElem = 0; iElem < aNbElem; iElem++){
1771 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
1773 // get names of groups, to which the element belongs
1774 VISU::TNames aGroupNames;
1775 VISU::TElemID2FamilyID::const_iterator anIter = anElemID2FamilyID.find(iElem);
1776 if(anIter != anElemID2FamilyID.end()){
1777 int aFamilyId = anIter->second;
1779 VISU::TFamilyIDMap::const_iterator aFamilyIter = aFamilyIDMap.find(aFamilyId);
1780 if(aFamilyIter != aFamilyIDMap.end()){
1781 VISU::PMEDFamily aFamily = aFamilyIter->second;
1782 aGroupNames = aFamily->myGroupNames;
1787 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1788 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
1789 vtkFloatingPointType aValue = 0.0;
1790 for(TInt iComp = 0; iComp < theNbComp2; iComp++){
1791 vtkFloatingPointType aVal = aMValueSlice[iComp];
1792 aValue += aVal*aVal;
1794 aValue = sqrt(aValue);
1795 aMin = isnan(aValue) ? aValue : std::min(aMin,aValue);
1796 aMax = isnan(aValue) ? aValue : std::max(aMax,aValue);
1798 // additional calculation for each group, to which the element belongs
1799 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1800 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1801 VISU::TName aGroupName = *aGroupIter;
1802 bool isGroupFound = aGroup2MinMax.find(aGroupName) != aGroup2MinMax.end();
1803 VISU::TMinMax& aGroupMinMax = aGroup2MinMax[aGroupName];
1804 vtkFloatingPointType& aGroupMin = aGroupMinMax.first;
1805 vtkFloatingPointType& aGroupMax = aGroupMinMax.second;
1806 aGroupMin = isGroupFound ? std::min(aGroupMin,aValue) : aValue;
1807 aGroupMax = isGroupFound ? std::max(aGroupMax,aValue) : aValue;
1810 if(isAverageByGaussPoints){
1811 typename TimeStampValueType::TTMeshValue::TCValueSliceArr aMCompValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
1812 vtkFloatingPointType aValue = 0.0;
1813 for(TInt iComp = 0; iComp < theNbComp2; iComp++){
1814 const typename TimeStampValueType::TTMeshValue::TCValueSlice& aMCompValueSlice = aMCompValueSliceArr[iComp];
1815 vtkFloatingPointType anAverageValue = aBaseAverageValues[aGaussMetric];
1816 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
1817 const vtkFloatingPointType& aVal = aMCompValueSlice[iGauss];
1818 switch(aGaussMetric) {
1819 case VISU::AVERAGE_METRIC: anAverageValue += aVal; break;
1820 case VISU::MINIMUM_METRIC: anAverageValue = std::min(anAverageValue, aVal); break;
1821 case VISU::MAXIMUM_METRIC: anAverageValue = std::max(anAverageValue, aVal); break;
1824 if(aGaussMetric == VISU::AVERAGE_METRIC)
1825 anAverageValue /= aNbGauss;
1826 aValue += anAverageValue*anAverageValue;
1828 aValue = sqrt(aValue);
1829 anAverageMin = std::min(anAverageMin,aValue);
1830 anAverageMax = std::max(anAverageMax,aValue);
1832 // additional calculation for each group, to which the element belongs
1833 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1834 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1835 VISU::TName aGroupName = *aGroupIter;
1836 bool isGroupFound = aGroup2AverageMinMax.find(aGroupName) != aGroup2AverageMinMax.end();
1837 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1838 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1839 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1840 aGroupAverageMin = isGroupFound ? std::min(aGroupAverageMin,aValue) : aValue;
1841 aGroupAverageMax = isGroupFound ? std::max(aGroupAverageMax,aValue) : aValue;
1845 anAverageMin = aMin;
1846 anAverageMax = aMax;
1848 // additional calculation for each group, to which the element belongs
1849 VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
1850 for(; aGroupIter != aGroupNames.end(); aGroupIter++){
1851 VISU::TName aGroupName = *aGroupIter;
1852 VISU::TMinMax& aGroupAverageMinMax = aGroup2AverageMinMax[aGroupName];
1853 vtkFloatingPointType& aGroupAverageMin = aGroupAverageMinMax.first;
1854 vtkFloatingPointType& aGroupAverageMax = aGroupAverageMinMax.second;
1855 aGroupAverageMin = aGroup2MinMax[aGroupName].first;
1856 aGroupAverageMax = aGroup2MinMax[aGroupName].second;
1865 //---------------------------------------------------------------
1873 VISU_Convertor_impl::BuildMinMax();
1875 TSetIsDone aSetIsDone(myIsMinMaxDone);
1876 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax");
1878 MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(myMed);
1879 MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(myMed);
1881 TInt aNbMeshes = myMed->GetNbMeshes();
1882 VISU::TMeshMap& aMeshMap = myMeshMap;
1884 INITMSG(MYDEBUG,"BuildMinMax - aNbMeshes = "<<aNbMeshes<<"\n");
1886 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
1890 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPMeshInfo");
1892 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
1893 std::string aMeshName = aMeshInfo->GetName();
1895 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
1896 if(anIter == aMeshMap.end())
1898 VISU::PMEDMesh aMesh = anIter->second;
1903 TInt aNbFields = myMed->GetNbFields();
1906 "- aMeshName = '"<<aMeshName<<"'"<<
1907 "; aNbFields = "<<aNbFields<<"\n");
1909 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
1911 for(TInt iField = 1; iField <= aNbFields; iField++)
1913 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()");
1915 MED::TErr anError = 0;
1916 MED::PFieldInfo aFieldInfo = myMed->GetPFieldInfo(aMeshInfo, iField, &anError);
1920 std::string aFieldName = aFieldInfo->GetName();
1921 INITMSG(MYDEBUG,"- aFieldName = '"<<aFieldName<<"'\n");
1923 MED::TGeom2Size aGeom2Size;
1924 MED::EEntiteMaillage aMEntity;
1925 TInt aNbTimeStamps = myMed->GetNbTimeStamps(aFieldInfo,
1929 if(aNbTimeStamps < 1)
1932 VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
1933 VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
1934 VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
1935 VISU::PMEDField aField = aFieldMap[aFieldName];
1937 TInt aNbComp = aField->myNbComp;
1938 int aNbComp2 = aNbComp;
1939 if(aNbComp == 2 || aNbComp == 4)
1941 else if(aNbComp > 4)
1944 VISU::TMetric2Comp2MinMax& aMetric2Comp2MinMax = aField->myMetric2Comp2MinMax;
1945 VISU::TMetric2Comp2MinMax& aMetric2Comp2AverageMinMax = aField->myMetric2Comp2AverageMinMax;
1946 VISU::TMetric2Comp2Group2MinMax& aMetric2Comp2Group2MinMax = aField->myMetric2Comp2Group2MinMax;
1947 VISU::TMetric2Comp2Group2MinMax& aMetric2Comp2Group2AverageMinMax = aField->myMetric2Comp2Group2AverageMinMax;
1948 TSetIsDone aSetIsDone(aField->myIsMinMaxInitilized);
1949 for(TInt iTimeStamp = aNbTimeStamps; iTimeStamp >= 1; iTimeStamp--){
1950 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()");
1951 INITMSG(MYDEBUG,"- iTimeStamp = "<<iTimeStamp<<endl);
1959 MED::PTimeStampInfo aTimeStampInfo =
1960 myMed->GetPTimeStampInfo(aFieldInfo,
1965 MED::PTimeStampValueBase aTimeStampValue =
1966 myMed->GetPTimeStampValue(aTimeStampInfo,
1970 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
1972 if(aFieldInfo->GetType() == MED::eFLOAT64)
1973 BuildTimeStampMinMax<MED::TFloatTimeStampValue>(CastToFloatTimeStampValue(aTimeStampValue),
1976 aMetric2Comp2MinMax,
1977 aMetric2Comp2AverageMinMax,
1978 aMetric2Comp2Group2MinMax,
1979 aMetric2Comp2Group2AverageMinMax,
1984 BuildTimeStampMinMax<MED::TIntTimeStampValue>(CastToIntTimeStampValue(aTimeStampValue),
1987 aMetric2Comp2MinMax,
1988 aMetric2Comp2AverageMinMax,
1989 aMetric2Comp2Group2MinMax,
1990 aMetric2Comp2Group2AverageMinMax,
1995 }catch(Standard_Failure){
1996 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1997 MSG(MYDEBUG,"Follow signal was occured in:\n"<<aFail->GetMessageString());
1998 }catch(std::exception& exc){
1999 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2001 MSG(MYDEBUG,"Unknown exception !!!");
2005 for(TInt iComp = 0; iComp <= aNbComp; iComp++){
2006 VISU::TMinMax aMinMax = aField->GetMinMax(iComp, VISU::TNames());
2007 INITMSG(MYDEBUG,"- "<<iComp<<": "<<aMinMax.first<<"; "<<aMinMax.second<<endl);
2011 }catch(std::exception& exc){
2012 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2014 MSG(MYDEBUG,"Unknown exception !!!");
2019 }catch(std::exception& exc){
2020 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2022 MSG(MYDEBUG,"Unknown exception !!!");
2031 //---------------------------------------------------------------
2039 TSetIsDone aSetIsDone(myIsGroupsDone);
2040 VISU::TTimerLog aTimerLog(MYDEBUG,"BuildGroups");
2042 TInt aNbMeshes = myMed->GetNbMeshes();
2043 VISU::TMeshMap& aMeshMap = myMeshMap;
2045 INITMSG(MYDEBUG,"BuildGroups - aNbMeshes = "<<aNbMeshes<<"\n");
2047 for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
2051 VISU::TTimerLog aTimerLog(MYDEBUG,"GetPMeshInfo");
2053 MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh);
2054 std::string aMeshName = aMeshInfo->GetName();
2056 VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName);
2057 if(anIter == aMeshMap.end())
2059 VISU::PMEDMesh aMesh = anIter->second;
2061 INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'\n");
2063 MED::EMaillage aType = aMeshInfo->GetType();
2065 MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo);
2067 MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo =
2068 MED::GetEntity2TGeom2ElemInfo(myMed, aMeshInfo, anEntityInfo);
2073 MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(myMed, aMeshInfo);
2075 if(aType == MED::eNON_STRUCTURE)
2076 BuildFamilyMap(aMesh,
2078 anEntity2TGeom2ElemInfo,
2082 BuildGrilleFamilyMap(aMesh,
2087 BuildGroupMap(aMesh,
2090 }catch(std::exception& exc){
2091 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2093 MSG(MYDEBUG,"Unknown exception !!!");
2098 }catch(std::exception& exc){
2099 MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
2101 MSG(MYDEBUG,"Unknown exception !!!");
2110 //---------------------------------------------------------------
2113 ::LoadMeshOnEntity(VISU::PMeshImpl theMesh,
2114 VISU::PMeshOnEntityImpl theMeshOnEntity)
2116 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnEntity");
2117 INITMSG(MYDEBUG,"LoadMeshOnEntity"<<endl);
2119 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2121 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2122 if(anEntity == VISU::NODE_ENTITY){
2123 isPointsUpdated += LoadPoints(myMed, theMesh);
2125 isPointsUpdated += LoadPoints(myMed, theMesh);
2126 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed, theMesh, theMeshOnEntity);
2129 return (isPointsUpdated || isCellsOnEntityUpdated);
2133 //---------------------------------------------------------------
2136 ::LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
2137 VISU::PMeshOnEntityImpl theMeshOnEntity,
2138 VISU::PFamilyImpl theFamily)
2140 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity");
2141 INITMSG(MYDEBUG,"LoadFamilyOnEntity"<<endl);
2143 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2145 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2146 if(anEntity == VISU::NODE_ENTITY){
2147 isPointsUpdated += LoadPointsOnFamily(myMed, theMesh, theFamily);
2149 isPointsUpdated += LoadPoints(myMed, theMesh);
2150 isCellsOnEntityUpdated += LoadCellsOnFamily(myMed, theMesh, theMeshOnEntity, theFamily);
2153 return (isPointsUpdated || isCellsOnEntityUpdated);
2157 //---------------------------------------------------------------
2160 ::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
2161 const VISU::TFamilySet& theFamilySet)
2163 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup");
2164 INITMSG(MYDEBUG,"LoadMeshOnGroup"<<endl);
2166 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2167 VISU::TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
2168 for(; aFamilyIter != theFamilySet.end(); aFamilyIter++){
2169 VISU::PMEDFamily aFamily = (*aFamilyIter).second;
2170 const VISU::TEntity& anEntity = aFamily->myEntity;
2171 const VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
2172 isPointsUpdated += LoadPoints(myMed, theMesh);
2173 if(anEntity == VISU::NODE_ENTITY){
2174 isPointsUpdated += LoadPointsOnFamily(myMed, theMesh, aFamily);
2176 isCellsOnEntityUpdated += LoadCellsOnFamily(myMed,theMesh,aMeshOnEntity,aFamily);
2180 return (isPointsUpdated || isCellsOnEntityUpdated);
2184 //---------------------------------------------------------------
2187 ::LoadValForTimeOnMesh(VISU::PMeshImpl theMesh,
2188 VISU::PMeshOnEntityImpl theMeshOnEntity,
2189 VISU::PFieldImpl theField,
2190 VISU::PValForTimeImpl theValForTime)
2192 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh");
2193 INITMSG(MYDEBUG,"LoadValForTimeOnMesh"<<endl);
2195 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2196 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2197 isPointsUpdated += LoadPoints(myMed,theMesh);
2198 if(anEntity != VISU::NODE_ENTITY)
2199 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity);
2200 int isFieldUpdated = LoadValForTimeOnMesh(myMed,theMesh,theMeshOnEntity,theField,theValForTime);
2202 return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
2206 //---------------------------------------------------------------
2209 ::LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh,
2210 VISU::PMeshOnEntityImpl theMeshOnEntity,
2211 VISU::PFieldImpl theField,
2212 VISU::PValForTimeImpl theValForTime)
2214 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts");
2215 INITMSG(MYDEBUG,"LoadValForTimeOnGaussPts"<<endl);
2217 const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
2218 int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
2219 if(anEntity != VISU::NODE_ENTITY)
2220 isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity);
2221 int isFieldUpdated = LoadValForTimeOnGaussPts(myMed,theMesh,theMeshOnEntity,theField,theValForTime);
2223 return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
2227 //---------------------------------------------------------------
2230 ::LoadPoints(const MED::PWrapper& theMed,
2231 VISU::PMEDMesh theMesh)
2233 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPoints");
2235 //Check on existing family
2236 VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
2237 aMeshOnEntity->myMeshName = theMesh->myName;
2238 aMeshOnEntity->myEntity = VISU::NODE_ENTITY;
2240 INITMSG(MYDEBUG,"LoadPoints - theMesh->myIsDone = "<<theMesh->myIsDone<<"'\n");
2242 //Check on loading already done
2243 if(theMesh->myIsDone)
2246 MED::EMaillage aType = theMesh->myMeshInfo->GetType();
2248 if(aType == MED::eNON_STRUCTURE){
2250 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
2251 TInt aNbElem = aNodeInfo->GetNbElem();
2253 VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
2254 aNamedPointCoords->Init(aNodeInfo, theMed->GetVersion());
2256 VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
2257 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
2259 aSubMesh->Init(MED::PElemInfo(aNodeInfo), theMed->GetVersion());
2260 aSubMesh->myNbCells = theMesh->myNbPoints;
2261 aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
2263 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2264 aCell2Connect.resize(aNbElem);
2265 for (int iElem = 0; iElem < aNbElem; iElem++)
2266 aCell2Connect[iElem] = VISU::TConnect(1,iElem);
2267 } // END NON_STRUCTURED
2268 else { // STRUCTURED
2270 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(theMesh->myMeshInfo);
2271 TInt aNbElem = aGrilleInfo->GetNbNodes();
2273 VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
2274 aNamedPointCoords->Init(aGrilleInfo);
2276 VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
2277 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh());
2279 aSubMesh->Init(aGrilleInfo);
2280 aSubMesh->myNbCells = theMesh->myNbPoints;
2281 aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
2283 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2284 aCell2Connect.resize(aNbElem);
2285 for(int iElem = 0; iElem < aNbElem; iElem++)
2286 aCell2Connect[iElem] = VISU::TConnect(1,iElem);
2290 theMesh->myIsDone = true;
2294 }catch(std::exception& exc){
2297 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2304 //---------------------------------------------------------------
2307 ::LoadPointsOnFamily(const MED::PWrapper& theMed,
2308 const VISU::PMEDMesh theMesh,
2309 const VISU::PMEDFamily theFamily)
2311 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPointsOnFamily");
2313 if(theFamily->myIsDone)
2316 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2317 MED::EMaillage aType = aMeshInfo->GetType();
2320 if(aType == MED::eNON_STRUCTURE){
2321 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
2322 TInt aNbElem = aNodeInfo->GetNbElem();
2325 TInt anId = theFamily->myId;
2326 VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
2327 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2328 if(aNodeInfo->GetFamNum(iElem) == anId)
2329 aSubMeshID.push_back(iElem);
2333 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo);
2334 TInt aNbElem = aGrilleInfo->GetNbNodes();
2337 TInt anId = theFamily->myId;
2338 VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
2339 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2340 if(aGrilleInfo->GetFamNumNode(iElem) == anId)
2341 aSubMeshID.push_back(iElem);
2345 theFamily->myIsDone = true;
2349 }catch(std::exception& exc){
2352 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2359 //---------------------------------------------------------------
2362 ::LoadCellsOnEntity(const MED::PWrapper& theMed,
2363 const VISU::PMEDMesh theMesh,
2364 const VISU::PMEDMeshOnEntity theMeshOnEntity)
2366 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnEntity");
2370 const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
2371 const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
2373 INITMSG(MYDEBUG,"LoadCellsOnEntity - aVEntity = "<<aVEntity<<"\n");
2375 if(theMeshOnEntity->myIsDone)
2378 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2380 MED::EMaillage aType = aMeshInfo->GetType();
2382 if(aType == MED::eSTRUCTURE){
2384 MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo);
2385 TInt aNbPoints = aGrilleInfo->GetNbNodes();
2387 std::map<TInt,TInt> aNodeIdMap;
2388 EBooleen anIsNodeNum = MED::eFAUX;
2390 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2391 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2392 VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
2394 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2395 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2396 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2397 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"; aEGeom = "<<aEGeom<<"\n");
2399 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
2400 INITMSG(MYDEBUG,"aVNbNodes = "<<aVNbNodes<<"\n");
2402 TInt aNbElem = aGeom2SizeIter->second;//aGrilleInfo->GetNbCells();
2405 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2407 aSubMesh->Init(aGrilleInfo);
2408 aSubMesh->myNbCells = aNbElem;
2409 aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
2411 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2412 aCell2Connect.resize(aNbElem);
2414 TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
2415 VISU::TVector<TInt> aConnect(aMNbNodes);
2417 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2418 MED::TIntVector aConn = aGrilleInfo->GetConn(iElem, theMeshOnEntity->myEntity != VISU::CELL_ENTITY);
2419 VISU::TConnect& anArray = aCell2Connect[iElem];
2420 anArray.resize(aVNbNodes);
2423 for(TInt iConn = 0; iConn < aMNbNodes; iConn++){
2424 aConnect[iConn] = aNodeIdMap[aConn[iConn] - 1];
2427 for(int iConn = 0; iConn < aMNbNodes; ++iConn){
2428 aConnect[iConn] = aConn[iConn];
2434 anArray[0] = aConnect[0];
2435 anArray[1] = aConnect[2];
2436 anArray[2] = aConnect[3];
2437 anArray[3] = aConnect[1];
2440 anArray[0] = aConnect[0];
2441 anArray[1] = aConnect[2];
2442 anArray[2] = aConnect[3];
2443 anArray[3] = aConnect[1];
2444 anArray[4] = aConnect[4];
2445 anArray[5] = aConnect[6];
2446 anArray[6] = aConnect[7];
2447 anArray[7] = aConnect[5];
2450 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2451 anArray[iNode] = aConnect[iNode];
2454 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2455 if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
2456 EXCEPTION(std::runtime_error,"LoadCellsOnEntity - "<<
2457 " aNbPoints("<<aNbPoints<<") "<<
2458 "<= anArray["<<iElem<<"]"<<
2460 "("<<anArray[iNode]<<") < 0");
2466 theMeshOnEntity->myIsDone = true;
2472 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
2473 TInt aNbPoints = aNodeInfo->GetNbElem();
2475 std::map<TInt,TInt> aNodeIdMap;
2476 #ifdef _EDF_NODE_IDS_
2477 EBooleen anIsNodeNum = MED::eFAUX;
2479 EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
2481 for(TInt i = 0; i < aNbPoints; i++){
2482 aNodeIdMap[aNodeInfo->GetElemNum(i)-1] = i;
2487 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2488 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2489 VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
2491 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2492 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2493 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2494 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"; aEGeom = "<<aEGeom<<"\n");
2496 case MED::ePOLYGONE: {
2497 MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
2498 TInt aNbElem = aPolygoneInfo->GetNbElem();
2500 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2502 aSubMesh->Init(MED::PElemInfo(aPolygoneInfo),theMed->GetVersion());
2503 aSubMesh->myNbCells = aNbElem;
2505 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2506 aCell2Connect.resize(aNbElem);
2508 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2509 MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem);
2510 TInt aNbConn = aPolygoneInfo->GetNbConn(iElem);
2511 aSubMesh->myCellsSize += aNbConn;
2512 VISU::TConnect& anArray = aCell2Connect[iElem];
2513 anArray.resize(aNbConn);
2514 for(TInt iConn = 0; iConn < aNbConn; iConn++)
2515 anArray[iConn] = aConnSlice[iConn] - 1;
2520 case MED::ePOLYEDRE: {
2521 MED::PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
2522 TInt aNbElem = aPolyedreInfo->GetNbElem();
2525 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2527 aSubMesh->Init(MED::PElemInfo(aPolyedreInfo),theMed->GetVersion());
2528 aSubMesh->myNbCells = aNbElem;
2530 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2531 aCell2Connect.resize(aNbElem);
2533 for(TInt iElem = 0; iElem < aNbElem; iElem++){
2534 MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem);
2535 VISU::TConnect& anArray = aCell2Connect[iElem];
2536 typedef std::set<TInt> TConnectSet;
2537 TConnectSet aConnectSet;
2538 TInt aNbFaces = aConnSliceArr.size();
2539 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
2540 MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
2541 TInt aNbConn = aConnSlice.size();
2542 aSubMesh->myCellsSize += aNbConn;
2543 for(TInt iConn = 0; iConn < aNbConn; iConn++){
2544 aConnectSet.insert(aConnSlice[iConn]);
2548 int aNbConn = aConnectSet.size();
2549 anArray.resize(aNbConn);
2550 TConnectSet::iterator anIter = aConnectSet.begin();
2551 for(int i = 0; anIter != aConnectSet.end(); anIter++, i++){
2552 TInt anId = *anIter;
2553 anArray[i] = anId - 1;
2561 vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
2562 INITMSG(MYDEBUG,"aVNbNodes = "<<aVNbNodes<<"\n");
2564 MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
2565 TInt aNbElem = aCellInfo->GetNbElem();
2568 VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh());
2570 aSubMesh->Init(MED::PElemInfo(aCellInfo), theMed->GetVersion());
2571 aSubMesh->myNbCells = aNbElem;
2572 aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
2574 VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
2575 aCell2Connect.resize(aNbElem);
2577 TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
2578 VISU::TVector<TInt> aConnect(aMNbNodes);
2580 for(TInt iElem = 0; iElem < aNbElem; iElem++) {
2581 MED::TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
2582 VISU::TConnect& anArray = aCell2Connect[iElem];
2583 anArray.resize(aVNbNodes);
2586 for(TInt iConn = 0; iConn < aMNbNodes; iConn++){
2587 aConnect[iConn] = aNodeIdMap[aConnSlice[iConn] - 1];
2590 for(int iConn = 0; iConn < aMNbNodes; iConn++){
2591 aConnect[iConn] = aConnSlice[iConn] - 1;
2596 #if !(defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2598 anArray[0] = aConnect[0];
2599 anArray[2] = aConnect[1];
2601 anArray[1] = aConnect[2];
2604 #if !(defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2606 anArray[0] = aConnect[0];
2607 anArray[2] = aConnect[1];
2608 anArray[4] = aConnect[2];
2610 anArray[1] = aConnect[3];
2611 anArray[3] = aConnect[4];
2612 anArray[5] = aConnect[5];
2615 #if !(defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2617 anArray[0] = aConnect[0];
2618 anArray[2] = aConnect[1];
2619 anArray[4] = aConnect[2];
2620 anArray[6] = aConnect[3];
2622 anArray[1] = aConnect[4];
2623 anArray[3] = aConnect[5];
2624 anArray[5] = aConnect[6];
2625 anArray[7] = aConnect[7];
2628 #if !(defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2630 anArray[0] = aConnect[0];
2631 anArray[2] = aConnect[1];
2632 anArray[4] = aConnect[2];
2633 anArray[6] = aConnect[3];
2635 anArray[1] = aConnect[4];
2636 anArray[3] = aConnect[5];
2637 anArray[5] = aConnect[6];
2638 anArray[7] = aConnect[7];
2639 anArray[8] = aConnect[8];
2642 #if (defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2644 anArray[0] = aConnect[0];
2645 anArray[1] = aConnect[2];
2646 anArray[2] = aConnect[1];
2647 anArray[3] = aConnect[3];
2649 anArray[4] = aConnect[6];
2650 anArray[5] = aConnect[5];
2651 anArray[6] = aConnect[4];
2653 anArray[7] = aConnect[7];
2654 anArray[8] = aConnect[9];
2655 anArray[9] = aConnect[8];
2659 anArray[0] = aConnect[0];
2660 anArray[1] = aConnect[2];
2661 anArray[2] = aConnect[1];
2662 anArray[3] = aConnect[3];
2664 #if (defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2666 anArray[0] = aConnect[0];
2668 anArray[1] = aConnect[3];
2669 anArray[2] = aConnect[2];
2670 anArray[3] = aConnect[1];
2671 anArray[4] = aConnect[4];
2673 anArray[5] = aConnect[8];
2674 anArray[6] = aConnect[7];
2675 anArray[7] = aConnect[6];
2676 anArray[8] = aConnect[5];
2678 anArray[9] = aConnect[9];
2679 anArray[10] = aConnect[12];
2680 anArray[11] = aConnect[11];
2681 anArray[12] = aConnect[10];
2685 anArray[0] = aConnect[0];
2686 anArray[1] = aConnect[3];
2687 anArray[2] = aConnect[2];
2688 anArray[3] = aConnect[1];
2689 anArray[4] = aConnect[4];
2691 #if (defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
2693 anArray[0] = aConnect[0];
2694 anArray[1] = aConnect[3];
2695 anArray[2] = aConnect[2];
2696 anArray[3] = aConnect[1];
2698 anArray[4] = aConnect[4];
2699 anArray[5] = aConnect[7];
2700 anArray[6] = aConnect[6];
2701 anArray[7] = aConnect[5];
2703 anArray[8] = aConnect[11];
2704 anArray[9] = aConnect[10];
2705 anArray[10] = aConnect[9];
2706 anArray[11] = aConnect[8];
2708 anArray[12] = aConnect[15];
2709 anArray[13] = aConnect[14];
2710 anArray[14] = aConnect[13];
2711 anArray[15] = aConnect[12];
2713 anArray[16] = aConnect[16];
2714 anArray[17] = aConnect[19];
2715 anArray[18] = aConnect[18];
2716 anArray[19] = aConnect[17];
2718 anArray[20] = aConnect[21];
2719 anArray[21] = aConnect[23];
2720 anArray[22] = aConnect[24];
2721 anArray[23] = aConnect[22];
2723 anArray[24] = aConnect[20];
2724 anArray[25] = aConnect[25];
2725 anArray[26] = aConnect[26];
2729 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2730 anArray[iNode] = aConnect[iNode];
2732 for(int iNode = 0; iNode < aVNbNodes; iNode++)
2733 if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
2734 EXCEPTION(std::runtime_error,"LoadCellsOnEntity - "<<
2735 " aNbPoints("<<aNbPoints<<") "<<
2736 "<= anArray["<<iElem<<"]"<<
2738 "("<<anArray[iNode]<<") < 0");
2744 // END NON_STRUCTURED
2746 theMeshOnEntity->myIsDone = true;
2751 }catch(std::exception& exc){
2754 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2762 //---------------------------------------------------------------
2765 ::LoadCellsOnFamily(const MED::PWrapper& theMed,
2766 const VISU::PMEDMesh theMesh,
2767 const VISU::PMEDMeshOnEntity theMeshOnEntity,
2768 const VISU::PMEDFamily theFamily)
2770 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnFamily");
2774 const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
2775 const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
2777 INITMSG(MYDEBUG,"LoadCellsOnFamily - aVEntity = "<<aVEntity<<"\n");
2779 if(theFamily->myIsDone)
2782 TInt anId = theFamily->myId;
2784 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2785 VISU::TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
2786 MED::EMaillage aType = aMeshInfo->GetType();
2788 const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
2789 MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
2790 for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
2791 const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
2792 if(aType == MED::eNON_STRUCTURE){
2793 MED::PElemInfo anElemInfo;
2795 case MED::ePOLYGONE: {
2796 anElemInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
2799 case MED::ePOLYEDRE: {
2800 anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
2804 anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
2808 if(TInt aNbElem = anElemInfo->GetNbElem()){
2809 VISU::TSubMeshID aSubMeshID;
2810 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2811 if(anElemInfo->GetFamNum(iElem) == anId)
2812 aSubMeshID.push_back(iElem);
2813 if(!aSubMeshID.empty()){
2814 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2815 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
2816 aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
2821 MED::PGrilleInfo anElemInfo = theMed->GetPGrilleInfo(aMeshInfo);
2823 TInt aNbElem = anElemInfo->GetNbCells();
2824 if(aNbElem>0 && (aMGeom == anElemInfo->GetGeom()) ){
2825 VISU::TSubMeshID aSubMeshID;
2826 for(TInt iElem = 0; iElem < aNbElem; iElem++)
2827 if(anElemInfo->GetFamNum(iElem) == anId)
2828 aSubMeshID.push_back(iElem);
2829 if(!aSubMeshID.empty()){
2830 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2831 INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
2832 aGeom2SubMeshID.insert(VISU::TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
2839 theFamily->myIsDone = true;
2844 }catch(std::exception& exc){
2847 EXCEPTION(std::runtime_error,"Unknown exception !!!");
2855 //---------------------------------------------------------------
2857 LoadProfile(const MED::PWrapper& theMed,
2858 VISU::PMEDMesh theMesh,
2859 MED::PTimeStampValueBase theTimeStampValue,
2860 VISU::TMEDValForTime& theValForTime,
2861 VISU::TMEDMeshOnEntity& theMeshOnEntity)
2863 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadProfile");
2864 INITMSG(MYDEBUG,"LoadProfile"<<endl);
2866 VISU::PMEDProfile aProfile = theValForTime.myProfile;
2867 if(aProfile->myIsDone)
2870 const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
2871 const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile();
2872 MED::TGeom2Profile::const_iterator anIter = aGeom2Profile.begin();
2873 for(; anIter != aGeom2Profile.end(); anIter++){
2874 MED::PProfileInfo aProfileInfo = anIter->second;
2875 MED::EGeometrieElement aMGeom = anIter->first;
2876 VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
2878 VISU::TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aEGeom);
2879 if(anIter2 != aGeom2SubProfile.end()){
2880 VISU::PMEDSubProfile aSubProfile = anIter2->second;
2882 MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
2883 if(!anElemNum.empty()){
2884 VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
2885 TInt aSize = anElemNum.size();
2886 aSubMeshID.resize(aSize);
2887 for(TInt anId = 0; anId < aSize; anId++)
2888 aSubMeshID[anId] = anElemNum[anId] - 1;
2892 "- aEGeom = "<<aEGeom<<
2893 "; aNbCells = "<<aSubProfile->mySubMeshID.size()<<
2898 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2900 VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
2901 MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
2903 const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
2904 VISU::TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
2905 for(; anIter != aGeom2SubProfile.end(); anIter++){
2906 const VISU::PMEDSubProfile& aSubProfile = anIter->second;
2907 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
2908 MED::PElemInfo anElemInfo;
2909 anElemInfo = theMed->GetPElemInfo(aMeshInfo,aMEntity,aMGeom);
2910 aSubProfile->myIsElemNum = anElemInfo->IsElemNum();
2911 aSubProfile->myElemNum = anElemInfo->myElemNum;
2915 aProfile->myIsDone = true;
2919 //---------------------------------------------------------------
2921 LoadGaussMesh(const MED::PWrapper& theMed,
2922 VISU::PMEDMesh theMesh,
2923 MED::PTimeStampValueBase theTimeStampValue,
2924 VISU::TMEDValForTime& theValForTime,
2925 VISU::TMEDMeshOnEntity& theMeshOnEntity)
2927 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadGaussMesh");
2928 INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
2930 // this part of code must be reimplemented in connection with GRILLE structures
2931 if(theMesh->myMeshInfo->GetType() == MED::eSTRUCTURE)
2932 EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
2934 VISU::PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
2935 if(!aGaussMesh || aGaussMesh->myIsDone)
2938 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
2939 MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
2941 VISU::TEntity aVEntity = theMeshOnEntity.myEntity;
2942 MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
2944 const VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
2945 const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo();
2946 const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
2948 VISU::TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin();
2949 for(; aSubMeshIter != aGeom2GaussSubMesh.end(); aSubMeshIter++){
2950 VISU::PMEDGaussSubMesh aGaussSubMesh = aSubMeshIter->second;
2951 VISU::EGeometry aEGeom = aSubMeshIter->first;
2953 if(aGaussSubMesh->myIsDone)
2956 VISU::PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
2957 const VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
2958 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
2960 MED::PPolygoneInfo aPolygoneInfo;
2961 MED::PPolyedreInfo aPolyedreInfo;
2962 MED::PCellInfo aCellInfo;
2963 MED::PElemInfo anElemInfo;
2966 case MED::ePOLYGONE:
2967 aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,
2970 anElemInfo = aPolygoneInfo;
2972 case MED::ePOLYEDRE:
2973 aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,
2976 anElemInfo = aPolyedreInfo;
2979 aCellInfo = theMed->GetPCellInfo(aMeshInfo,
2982 anElemInfo = aCellInfo;
2984 aGaussSubMesh->myIsElemNum = anElemInfo->IsElemNum();
2985 aGaussSubMesh->myElemNum = anElemInfo->myElemNum;
2988 bool anIsGaussCoord3D = false;
2989 MED::PGaussCoord aGaussCoordPtr(new MED::TGaussCoord());
2990 MED::TGaussCoord& aGaussCoord = *aGaussCoordPtr;
2992 MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
2993 if(aGaussIter != aGeom2Gauss.end()){
2994 VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss;
2995 MED::PGaussInfo aGaussInfo = aGauss->myGaussInfo;
2997 aName = aGaussInfo->GetName();
2998 if(!aSubMeshID.empty()){
2999 const std::string& aProfileName = aSubProfile->myName;
3000 MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed,
3003 const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
3004 anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo,
3011 anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo,
3017 if(!aSubMeshID.empty()){
3018 const std::string& aProfileName = aSubProfile->myName;
3019 MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed,
3022 const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
3024 case MED::ePOLYGONE:
3025 anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo,
3030 case MED::ePOLYEDRE:
3031 anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo,
3037 anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo,
3045 case MED::ePOLYGONE:
3046 anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo,
3050 case MED::ePOLYEDRE:
3051 anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo,
3056 anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo,
3062 if(anIsGaussCoord3D){
3063 VISU::TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
3064 VISU::TMEDGaussCoordHolder* aCoordHolder = new VISU::TMEDGaussCoordHolder();
3065 aCoordHolder->Init(aGaussCoordPtr);
3066 aCoords.Init(VISU::PCoordHolder(aCoordHolder));
3068 aGaussSubMesh->myIsDone = true;
3070 TInt aNbGauss = aGaussCoord.GetNbGauss();
3071 TInt aNbElem = aGaussCoord.GetNbElem();
3072 TInt aNbCells = aNbElem*aNbGauss;
3075 "- aEGeom = "<<aEGeom<<
3076 "; aName = '"<<aName<<"'"<<
3077 "; aStatus = "<<aGaussSubMesh->myStatus<<
3078 "; aNbElem = "<<aNbElem<<
3079 "; aNbGauss = "<<aNbGauss<<
3080 "; aNbCells = "<<aNbCells<<
3083 EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
3086 aGaussMesh->myIsDone = true;
3090 //---------------------------------------------------------------
3091 template<class TimeStampValueType>
3093 FillValForTime(MED::SharedPtr<TimeStampValueType> theTimeStampValue,
3094 const VISU::TGeom2SubProfile& theGeom2SubProfile,
3095 VISU::PMEDValForTime theValForTime,
3096 VISU::PMEDField theField)
3098 if(theValForTime->myIsFilled)
3100 theField->myDataSize = 0;
3101 TInt aNbComp = theField->myNbComp;
3103 VISU::TGeom2SubProfile::const_iterator anIter = theGeom2SubProfile.begin();
3104 for(; anIter != theGeom2SubProfile.end(); anIter++) {
3105 VISU::EGeometry aEGeom = anIter->first;
3106 VISU::PMEDSubProfile aSubProfile(anIter->second);
3108 TInt aNbElem = aSubProfile->myNbCells;
3109 theField->myDataSize += aNbElem * aNbComp;
3111 if(aSubProfile->myStatus != VISU::eRemoveAll){
3112 TInt aNbGauss = theValForTime->GetNbGauss(aEGeom);
3115 "- aEGeom = "<<aEGeom<<
3116 "; aNbElem = "<<aNbElem<<
3117 "; aNbGauss = "<<aNbGauss<<
3120 VISU::PMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
3121 typedef typename TimeStampValueType::TElement TElement;
3122 typedef VISU::TTMEDMeshValue<TElement> TVMeshValue;
3123 TVMeshValue* aMeshValue = new TVMeshValue();
3125 MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
3126 typedef typename TimeStampValueType::PTMeshValue PTMeshValue;
3127 PTMeshValue aMeshValuePtr = theTimeStampValue->GetMeshValuePtr(aMGeom);
3128 aMeshValue->Init(aNbElem, aNbGauss, aNbComp, aMeshValuePtr);
3129 aVMeshValue.reset(aMeshValue);
3132 theValForTime->myIsFilled = true;
3135 //---------------------------------------------------------------
3137 LoadValForTime(const MED::PWrapper& theMed,
3138 VISU::PMEDMesh theMesh,
3139 VISU::PMEDMeshOnEntity theMeshOnEntity,
3140 VISU::PMEDField theField,
3141 VISU::PMEDValForTime theValForTime,
3145 VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTime");
3146 INITMSG(MYDEBUG,"LoadValForTime - theIsGauss = "<<theIsGauss<<endl);
3148 //Check on loading already done
3153 const std::string& aMeshName = theMeshOnEntity->myMeshName;
3154 const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
3155 MED::PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,
3158 MED::TGeom2Size aGeom2Size;
3159 MED::EEntiteMaillage aMEntity;
3160 theMed->GetNbTimeStamps(aFieldInfo,
3161 theMesh->myEntityInfo,
3165 MED::PTimeStampInfo aTimeStampInfo =
3166 theMed->GetPTimeStampInfo(aFieldInfo,
3169 theValForTime->myId);
3171 MED::TKey2Gauss aKey2Gauss = GetKey2Gauss(theMed);
3172 MED::TMKey2Profile aMKey2Profile = GetMKey2Profile(theMed);
3174 MED::PTimeStampValueBase aTimeStampValue =
3175 theMed->GetPTimeStampValue(aTimeStampInfo,
3194 InitGaussMesh(aTimeStampValue,
3199 LoadGaussMesh(theMed,
3206 VISU::PMEDProfile aProfile = theValForTime->myProfile;
3207 VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
3210 "- aMeshName = '"<<aMeshName<<"'"<<
3211 "; aFieldName = '"<<aFieldInfo->GetName()<<"'"<<
3212 "; aMEntity = "<<aMEntity<<
3213 "; aNbComp = "<<theField->myNbComp<<
3216 if(aFieldInfo->GetType() == MED::eFLOAT64)
3217 FillValForTime<MED::TFloatTimeStampValue>(CastToFloatTimeStampValue(aTimeStampValue),
3222 FillValForTime<MED::TIntTimeStampValue>(CastToIntTimeStampValue(aTimeStampValue),
3232 //---------------------------------------------------------------
3235 ::LoadValForTimeOnMesh(const MED::PWrapper& theMed,
3236 VISU::PMEDMesh theMesh,
3237 VISU::PMEDMeshOnEntity theMeshOnEntity,
3238 VISU::PMEDField theField,
3239 VISU::PMEDValForTime theValForTime)
3241 VISU::PUnstructuredGridIDMapperImpl anUnstructuredGridIDMapper = theValForTime->myUnstructuredGridIDMapper;
3242 return LoadValForTime(theMed,
3248 anUnstructuredGridIDMapper->myIsVTKDone);
3252 //---------------------------------------------------------------
3255 ::LoadValForTimeOnGaussPts(const MED::PWrapper& theMed,
3256 VISU::PMEDMesh theMesh,
3257 VISU::PMEDMeshOnEntity theMeshOnEntity,
3258 VISU::PMEDField theField,
3259 VISU::PMEDValForTime theValForTime)
3261 VISU::PGaussPtsIDFilter aGaussPtsIDFilter = theValForTime->myGaussPtsIDFilter;
3262 return LoadValForTime(theMed,
3268 aGaussPtsIDFilter->myIsVTKDone);