case ePYRA5: return VTK_PYRAMID;
case ePYRA13: return VTK_PYRAMID;
case ePOLYGONE: return VTK_POLYGON;
-// case ePOLYEDRE: return VTK_POLYEDRE;
+ case ePOLYEDRE: return VTK_CONVEX_POINT_SET;
}
return -1;
}
case VTK_WEDGE: return ePENTA6;
case VTK_PYRAMID: return ePYRA5;
case VTK_POLYGON: return ePOLYGONE;
+ case VTK_CONVEX_POINT_SET: return ePOLYEDRE;
}
return EGeometrieElement(-1);
}
}
VISU_Convertor* VISU_MedConvertor::Build() {
- MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
- MED::TInt aNbMeshes = aMed->GetNbMeshes();
+ PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
+ TInt aNbMeshes = aMed->GetNbMeshes();
+ TMeshMap& aMeshMap = myMeshMap;
MSG(MYDEBUG,"VISU_MedConvertor::Build()");
INITMSG(MYDEBUG,"GetNbMeshes() = "<<aNbMeshes<<"\n");
- for(MED::TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
+ for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++)
try{
- MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
-
- MED::PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
-
- MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
-
- MED::TElemGroup anElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
+ PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
- MED::TInt aDim = aMeshInfo->GetDim();
- std::string aMeshName = aMeshInfo->GetName();
+ PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
+
+ MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+
+ TElemGroup aElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
- VISU::PMEDMesh aMesh = myMeshMap[aMeshName](new VISU::TMEDMesh());
- aMesh->myDim = aDim;
- aMesh->myName = aMeshName;
- aMesh->myNbPoints = aNodeInfo->GetNbElem();
- aMesh->myMeshInfo = aMeshInfo;
- aMesh->myEntityInfo = aEntityInfo;
+ TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
- INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
- "'; myNbPoints = "<<aMesh->myNbPoints<<
- "; aDim = "<<aDim<<"\n");
-
- BEGMSG(MYDEBUG,"aEntityInfo.size() = "<<aEntityInfo.size()<<"\n");
-
- typedef std::map<TInt,TInt> TFamilyCounterMap;
- TFamilyCounterMap aFamilyNbCellsCounterMap, aFamilyCellsSizeCounterMap;
- TFamilyCounterMap aFamilyNbPolygonesCounterMap, aFamilyPolygonesSizeCounterMap;
-
- VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
- MED::TElemGroup::const_iterator anElemGroupIter = anElemGroup.begin();
- for(; anElemGroupIter != anElemGroup.end(); anElemGroupIter++){
- const MED::EEntiteMaillage& aMEntity = anElemGroupIter->first;
- const MED::TElemMap& anElemMap = anElemGroupIter->second;
-
- VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
- VISU::PMEDMeshOnEntity aMeshOnEntity =
- aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity());
- aMeshOnEntity->myEntity = aVEntity;
- aMeshOnEntity->myMeshName = aMeshName;
- aMeshOnEntity->myGeom = aEntityInfo[aMEntity];
-
- INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
-
- if(aMEntity == MED::eNOEUD){
- aMeshOnEntity->myNbCells = aMesh->myNbPoints;
- aMeshOnEntity->myCellsSize = 2*aMesh->myNbPoints;
-
- for(MED::TInt iElem = 0; iElem < aMesh->myNbPoints; iElem++){
- MED::TInt aFamId = aNodeInfo->GetFamNum(iElem);
- if(aFamId != 0){
- aFamilyNbCellsCounterMap[aFamId] += 1;
- aFamilyCellsSizeCounterMap[aFamId] += 2;
- }
+ TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup);
+
+ TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
+
+ // creating TMesh structure and TMeshOnEntityMap
+ typedef map<TInt,TInt> TFamilyCounterMap;
+ TFamilyCounterMap aFamilyNbCellsCounterMap, aFamilyCellsSizeCounterMap;
+
+ TInt aDim = aMeshInfo->GetDim();
+ const string& aMeshName = aMeshInfo->GetName();
+
+ PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh());
+ aMesh->myDim = aDim;
+ aMesh->myName = aMeshName;
+ aMesh->myNbPoints = aNodeInfo->GetNbElem();
+ aMesh->myMeshInfo = aMeshInfo;
+ aMesh->myEntityInfo = aEntityInfo;
+
+ INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
+ "'; myNbPoints = "<<aMesh->myNbPoints<<
+ "; aDim = "<<aDim<<"\n");
+
+ BEGMSG(MYDEBUG,"aEntityInfo.size() = "<<aEntityInfo.size()<<"\n");
+
+ TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
+ for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
+ const EEntiteMaillage& aMEntity = anEntityIter->first;
+ const MED::TGeom& aTGeom = anEntityIter->second;
+
+ TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ PMEDMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TMEDMeshOnEntity());
+ aMeshOnEntity->myEntity = aVEntity;
+ aMeshOnEntity->myMeshName = aMeshName;
+ aMeshOnEntity->myGeom = aTGeom;
+
+ INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
+
+ if(aMEntity == eNOEUD){
+ aMeshOnEntity->myNbCells = aMesh->myNbPoints;
+ aMeshOnEntity->myCellsSize = 2*aMesh->myNbPoints;
+
+ for(TInt iElem = 0; iElem < aMesh->myNbPoints; iElem++){
+ TInt aFamId = aNodeInfo->GetFamNum(iElem);
+ if(aFamId != 0){
+ aFamilyNbCellsCounterMap[aFamId] += 1;
+ aFamilyCellsSizeCounterMap[aFamId] += 2;
}
+ }
- INITMSG(MYDEBUG,"myNbCells = "<<aMeshOnEntity->myNbCells<<
- "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<"\n");;
-
- }else{
- aMeshOnEntity->myNbCells = 0;
- aMeshOnEntity->myCellsSize = 0;
- MED::TElemMap::const_iterator anElemMapIter = anElemMap.begin();
- for(; anElemMapIter != anElemMap.end(); anElemMapIter++){
- const MED::EGeometrieElement& aGeom = anElemMapIter->first;
- MED::PElemInfo anElemInfo = anElemMapIter->second;
-
- switch(aGeom){
- case MED::ePOLYGONE: {
- MED::PPolygoneInfo aPolygoneInfo =
- aMed->GetPPolygoneInfo(aMeshInfo,aMEntity,MED::ePOLYGONE);
- MED::TInt aNbElem = aPolygoneInfo->GetNbElem();
- MED::TElemNum aConn = aPolygoneInfo->GetConnectivite();
- MED::TElemNum aIndex = aPolygoneInfo->GetIndex();
- MED::TInt aNbConn = aConn.size();
-
- aMeshOnEntity->myNbCells += aNbElem;
+ INITMSG(MYDEBUG,"myNbCells = "<<aMeshOnEntity->myNbCells<<
+ "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<"\n");;
+
+ }else{
+ MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
+ aMeshOnEntity->myNbCells = 0;
+ aMeshOnEntity->myCellsSize = 0;
+ for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
+ const EGeometrieElement& aGeom = anTGeomIter->first;
+
+ switch(aGeom){
+ case ePOLYGONE:
+ {
+ PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aGeom);
+ TInt aNbElem = aPolygoneInfo->GetNbElem();
+ TElemNum aConn = aPolygoneInfo->GetConnectivite();
+ TElemNum aIndex = aPolygoneInfo->GetIndex();
+ TInt aNbIndex = aIndex.size();
+ TInt aNbConn = aConn.size();
+
+ aMeshOnEntity->myNbCells += aNbElem;
- for (int ii = 0; ii<aNbElem ; ii++){
+ for (int ii = 0; ii<aNbElem ; ii++){
int aNbConnii = aPolygoneInfo->GetNbConn(ii);
- aMeshOnEntity->myCellsSize += aNbConnii;
- }
-
+ aMeshOnEntity->myCellsSize += aNbConnii;
+ }
INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<
"; myNbPolygones = "<<aNbElem<<
"; nbConn= "<<aNbConn<<"\n");
- for(MED::TInt iElem = 0; iElem < aNbElem; iElem++){
- MED::TInt aFamId = aPolygoneInfo->GetFamNum(iElem);
- if(aFamId != 0){
- aFamilyNbCellsCounterMap[aFamId] += 1;
- aFamilyCellsSizeCounterMap[aFamId] += aPolygoneInfo->GetNbConn(iElem) + 1;
- }
- }
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ TInt aFamId = aPolygoneInfo->GetFamNum(iElem);
+ if(aFamId != 0){
+ aFamilyNbCellsCounterMap[aFamId] += 1;
+ ADDMSG(MYDEBUG,"aFamId="<<aFamId<<" ");
+ aFamilyCellsSizeCounterMap[aFamId] += aPolygoneInfo->GetNbConn(iElem) + 1;
+ }
+ }
+ ADDMSG(MYDEBUG,endl);
+ break;
+ }
+ case ePOLYEDRE:
+ {
+ PPolyedreInfo aPolyedreInfo = aMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aGeom);
+ TInt aNbElem = aPolyedreInfo->GetNbElem();
+ TElemNum aConn = aPolyedreInfo->GetConnectivite();
+ TElemNum aIndex = aPolyedreInfo->GetIndex();
+ TInt aNbIndex = aIndex.size();
+ TInt aNbConn = aConn.size();
+
+ aMeshOnEntity->myNbCells += aNbElem;
+
+ for (int ii = 0; ii<aNbElem ; ii++){
+ int aNbConnii = aPolyedreInfo->GetNbConn(ii);
+ aMeshOnEntity->myCellsSize += aNbConnii;
+ }
+ INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<
+ "; myNbPolyedres = "<<aNbElem<<
+ "; nbConn= "<<aNbConn<<"\n");
+
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ TInt aFamId = aPolyedreInfo->GetFamNum(iElem);
+ std::string aName = aPolyedreInfo->GetElemName(iElem);
+ if(aFamId != 0){
+ aFamilyNbCellsCounterMap[aFamId] += 1;
+ ADDMSG(MYDEBUG,"(aFamId="<<aFamId<<";Name='"<<aName<<"') ");
+ aFamilyCellsSizeCounterMap[aFamId] += aPolyedreInfo->GetNbConn(iElem) + 1;
+ }
+ }
+ ADDMSG(MYDEBUG,endl);
break;
}
- default: {
+ default:
+ {
int aVNbNodes = VTKGeom2NbNodes(MEDGeomToVTK(aGeom));
- MED::PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
- MED::TInt aNbElem = aCellInfo->GetNbElem();
+ PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
+ TInt aNbElem = aCellInfo->GetNbElem();
aMeshOnEntity->myNbCells += aNbElem;
aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<
"; myNbCells = "<<aMeshOnEntity->myNbCells<<
"; myCellsSize = "<<aMeshOnEntity->myCellsSize<<"\n");
-
- for(MED::TInt iElem = 0; iElem < aNbElem; iElem++){
- MED::TInt aFamId = aCellInfo->GetFamNum(iElem);
+
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ TInt aFamId = aCellInfo->GetFamNum(iElem);
if(aFamId != 0){
aFamilyNbCellsCounterMap[aFamId] += 1;
+ ADDMSG(MYDEBUG,"aFamId = "<<aFamId<<" ");
aFamilyCellsSizeCounterMap[aFamId] += aVNbNodes + 1;
}
}
- }}
- }
+ ADDMSG(MYDEBUG,endl);
+ }
+ } // end switch(...)
}
}
-
- BEGMSG(MYDEBUG,"TFamilyByEntity:\n");
-
- MED::TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
-
- MED::TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
-
- MED::TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,anElemGroup,aFamilyGroup);
-
- MED::TFamilyByEntity::const_iterator aFamilyByEntityIter = aFamilyByEntity.begin();
- for(; aFamilyByEntityIter != aFamilyByEntity.end(); aFamilyByEntityIter++){
- const MED::EEntiteMaillage& aMEntity = aFamilyByEntityIter->first;
- const MED::TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second;
-
- VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
- VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
- VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+ }
+
+ TFamilyByEntity::const_iterator aFamilyByEntityIter = aFamilyByEntity.begin();
+ BEGMSG(MYDEBUG,"TFamilyByEntity:\n");
+ for(; aFamilyByEntityIter != aFamilyByEntity.end(); aFamilyByEntityIter++){
+ const EEntiteMaillage& aMEntity = aFamilyByEntityIter->first;
+ const TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second;
+
+ TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
+ VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
- if(aFamilyGroup.empty())
+ if(aFamilyGroup.empty())
+ continue;
+
+ INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
+ TFamilyGroup::const_iterator aFamilyGroupIter = aFamilyGroup.begin();
+ for(; aFamilyGroupIter != aFamilyGroup.end(); aFamilyGroupIter++){
+ const PFamilyInfo& aFamilyInfo = *aFamilyGroupIter;
+ if (aFamilyInfo->GetId() == 0)
continue;
+
+ const std::string& aFamilyName = aFamilyInfo->GetName();
+ PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
- INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
- MED::TFamilyGroup::const_iterator aFamilyGroupIter = aFamilyGroup.begin();
- for(; aFamilyGroupIter != aFamilyGroup.end(); aFamilyGroupIter++){
- MED::PFamilyInfo aFamilyInfo = *aFamilyGroupIter;
- if(aFamilyInfo->GetId() == 0)
- continue;
-
- std::string aFamilyName = aFamilyInfo->GetName();
- VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
-
- aFamily->myId = aFamilyInfo->GetId();
- aFamily->myName = aFamilyInfo->GetName();
- aFamily->myEntity = aVEntity;
- aFamily->myNbCells = aFamilyNbCellsCounterMap[aFamily->myId];
- aFamily->myCellsSize = aFamilyCellsSizeCounterMap[aFamily->myId];
-
- INITMSG(MYDEBUG,"aFamilyName = '"<<aFamily->myName<<
- "'; myId = "<<aFamily->myId<<"; "<<
- "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
- "; myEntity = "<<aFamily->myEntity<<
- "; myNbCells = "<<aFamily->myNbCells<<
- "; myCellsSize = "<<aFamily->myCellsSize<<"\n");
-
- VISU::TBindGroups& aBindGroups = aFamily->myGroups;
- MED::TInt aNbGroup = aFamilyInfo->GetNbGroup();
- for(MED::TInt i = 0; i < aNbGroup; i++){
- std::string aGroupName = aFamilyInfo->GetGroupName(i);
- aBindGroups.insert(aGroupName);
- INITMSG(MYDEBUG,"aGroupName = '"<<aGroupName<<"'\n");
- }
+ aFamily->myId = aFamilyInfo->GetId();
+ aFamily->myName = aFamilyInfo->GetName();
+ aFamily->myEntity = aVEntity;
+ aFamily->myNbCells = aFamilyNbCellsCounterMap[aFamily->myId];
+ aFamily->myCellsSize = aFamilyCellsSizeCounterMap[aFamily->myId];
+
+ INITMSG(MYDEBUG,"aFamilyName = '"<<aFamily->myName<<
+ "'; myId = "<<aFamily->myId<<"; "<<
+ "; aNbAttr = "<<aFamilyInfo->GetNbAttr()<<
+ "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
+ "; myEntity = "<<aFamily->myEntity<<
+ "; myNbCells = "<<aFamily->myNbCells<<
+ "; myCellsSize = "<<aFamily->myCellsSize<<"\n");
+
+ VISU::TBindGroups& aBindGroups = aFamily->myGroups;
+ const TInt aNbGroup = aFamilyInfo->GetNbGroup();
+ for(TInt i = 0; i < aNbGroup; i++){
+ const string& aGroupName = aFamilyInfo->GetGroupName(i);
+ aBindGroups.insert(aGroupName);
+ INITMSG(MYDEBUG,"aGroupName = '"<<aGroupName<<"'\n");
}
}
-
- BEGMSG(MYDEBUG,"VISU::TGroup:\n");
-
- VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
- MED::TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
- for(; aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
- const std::string& aGroupName = aGroupInfoIter->first;
- const MED::TFamilyGroup& aFamilyGroup = aGroupInfoIter->second;
- VISU::PMEDGroup aGroup(new TMEDGroup());
- aGroup->myName = aGroupName;
- aGroup->myMeshName = aMeshName;
-
- INITMSG(MYDEBUG,"aGroup->myName = '"<<aGroup->myName<<"'\n");
-
- MED::TFamilyGroup::const_iterator aFamilyIter = aFamilyGroup.begin();
- for(; aFamilyIter != aFamilyGroup.end(); aFamilyIter++){
- MED::PFamilyInfo aFamilyInfo = *aFamilyIter;
- std::string aFamilyName = aFamilyInfo->GetName();
-
- VISU::TEntity aVEntity = TEntity(-1);
- VISU::PFamily aFamily;
-
- // Find aVisuEntity
- const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
- VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
- for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
- const VISU::PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
- const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
- VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
- for (; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
- const std::string& aName = aFamilyMapIter->first;
- aFamily = aFamilyMapIter->second;
- if(aName == aFamilyName){
- aVEntity = aFamily->myEntity;
- goto exit_lable;
- }
+ }
+
+ BEGMSG(MYDEBUG,"VISU::TGroup:\n");
+
+ VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
+ TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
+ for(;aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
+ const string& aGroupName = aGroupInfoIter->first;
+ const TFamilyGroup& aFamilyGroup = aGroupInfoIter->second;
+ PMEDGroup aGroup(new TMEDGroup());
+ aGroup->myName = aGroupName;
+ aGroup->myMeshName = aMesh->myName;
+
+ INITMSG(MYDEBUG,"aGroup->myName = '"<<aGroup->myName<<"'\n");
+
+ TFamilyGroup::const_iterator aFamilyIter = aFamilyGroup.begin();
+ for(; aFamilyIter != aFamilyGroup.end(); aFamilyIter++){
+ const PFamilyInfo& aFamilyInfo = *aFamilyIter;
+ const string& aFamilyName = aFamilyInfo->GetName();
+
+ TEntity aVEntity = TEntity(-1);
+ PFamily aFamily;
+
+ // Find aVisuEntity
+ const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
+ for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
+ const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
+ const TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+ TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+ for (; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
+ const string& aName = aFamilyMapIter->first;
+ aFamily = aFamilyMapIter->second;
+ if(aName == aFamilyName){
+ aVEntity = aFamily->myEntity;
+ goto exit_lable;
}
}
- exit_lable:
- if(aFamily && aVEntity >= 0){
- aGroup->myFamilyAndEntitySet.insert(TFamilyAndEntity(aFamilyName,aVEntity));
- INITMSG(MYDEBUG,"aFamilyName = '"<<aFamilyName<<"'; '"<<aFamily->myName<<"'; aVEntity = "<<aVEntity<<"\n");
-
- aGroup->myNbCells += aFamily->myNbCells;
- aGroup->myCellsSize += aFamily->myCellsSize;
- }
}
- if(!aGroup->myFamilyAndEntitySet.empty() && aGroup->myNbCells > 0){
- BEGMSG(MYDEBUG,"myNbCells = "<<aGroup->myNbCells<<
- "; myCellsSize = "<<aGroup->myCellsSize<<"\n\n");
- aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
+ exit_lable:
+ if(aFamily && aVEntity >= 0){
+ aGroup->myFamilyAndEntitySet.insert(TFamilyAndEntity(aFamilyName,aVEntity));
+ INITMSG(MYDEBUG,"aFamilyName = '"<<aFamilyName<<"'; '"<<aFamily->myName<<"'; aVEntity = "<<aVEntity<<"\n");
+
+ aGroup->myNbCells += aFamily->myNbCells;
+ aGroup->myCellsSize += aFamily->myCellsSize;
}
}
-
- MED::TInt aNbFields = aMed->GetNbFields();
- BEGMSG(MYDEBUG,"VISU::TField aNbFields = "<<aNbFields<<"\n");
- for(MED::TInt iField = 1; iField <= aNbFields; iField++){
- MED::PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
- MED::TInt aNbComp = aFieldInfo->GetNbComp();
- std::string aFieldName = aFieldInfo->GetName();
-
- MED::TErr anErr;
- MED::TGeom aTGeom;
- MED::EEntiteMaillage aMEntity;
- MED::TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,
- aEntityInfo,
- aMEntity,
- aTGeom,
- &anErr);
- if(anErr < 0)
- continue;
+ if(!aGroup->myFamilyAndEntitySet.empty() && aGroup->myNbCells > 0){
+ BEGMSG(MYDEBUG,"myNbCells = "<<aGroup->myNbCells<<
+ "; myCellsSize = "<<aGroup->myCellsSize<<"\n\n");
+ aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
+ }
+ }
+
+ TInt aNbFields = aMed->GetNbFields();
+ BEGMSG(MYDEBUG,"VISU::TField: NbFields="<<aNbFields<<"\n");
+ for(TInt iField = 1; iField <= aNbFields; iField++){
+ PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
+ TInt aNbComp = aFieldInfo->GetNbComp();
+ const string& aFieldName = aFieldInfo->GetName();
+
+ MED::TGeom aTGeom;
+ EEntiteMaillage aMEntity;
+ TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,aMEntity,aTGeom);
+ if (aNbTimeStamps<1)
+ continue;
+ TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ VISU::PMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
+ TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+ PMEDField aField = aFieldMap[aFieldName](new TMEDField());
+ aField->myId = iField;
+ aField->myNbComp = aNbComp;
+ aField->myEntity = aVEntity;
+ aField->myName = aFieldName;
+ aField->myMeshName = aMeshName;
+ aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
+ aField->myCompNames.resize(aNbComp);
+ aField->myUnitNames.resize(aNbComp);
+
+ INITMSG(MYDEBUG,"myName = '"<<aField->myName<<
+ "'; myId = "<<aField->myId<<
+ "; myEntity = "<<aField->myEntity<<
+ "; myDataSize = "<<aField->myDataSize<<
+ "; myNbComp = "<<aField->myNbComp<<"\n");
+
+ for(TInt iComp = 0; iComp < aNbComp; iComp++){
+ aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
+ aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
+ }
- VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
- VISU::PMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
- VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
- VISU::PMEDField aField = aFieldMap[aFieldName](new TMEDField());
- aField->myId = iField;
- aField->myNbComp = aNbComp;
- aField->myEntity = aVEntity;
- aField->myName = aFieldName;
- aField->myMeshName = aMeshName;
- aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
- aField->myCompNames.resize(aNbComp);
- aField->myUnitNames.resize(aNbComp);
-
- INITMSG(MYDEBUG,"myName = '"<<aField->myName<<
- "'; myId = "<<aField->myId<<
- "; myEntity = "<<aField->myEntity<<
- "; myDataSize = "<<aField->myDataSize<<
- "; myNbComp = "<<aField->myNbComp<<"\n");
-
- for(MED::TInt iComp = 0; iComp < aNbComp; iComp++){
- aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
- aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
- }
-
- for(MED::TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
- MED::PTimeStampInfo aTimeStamp = aMed->GetPTimeStampInfo(aFieldInfo,
- aMEntity,
- aTGeom,
- iTimeStamp,
- &anErr);
- if(anErr < 0)
- continue;
-
- MED::PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStamp,&anErr);
-
- MED::TFloat aDt = aTimeStamp->GetDt();
- std::string anUnitDt = aTimeStamp->GetUnitDt();
- VISU::TValField& aValField = aField->myValField;
- VISU::PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
- aValForTime->myId = iTimeStamp;
- aValForTime->myFieldName = aField->myName;
- aValForTime->myEntity = aField->myEntity;
- aValForTime->myMeshName = aField->myMeshName;
- aValForTime->myNbComp = aField->myNbComp;
- aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
- INITMSG(MYDEBUG,"aDt = "<<aDt<<", "<<anUnitDt<<"\n");
- }
+ for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
+ PTimeStampInfo aTimeStamp = aMed->GetPTimeStampInfo(aFieldInfo,
+ aMEntity,
+ aTGeom,
+ iTimeStamp);
+ TFloat aDt = aTimeStamp->GetDt();
+ const string& anUnitDt = aTimeStamp->GetUnitDt();
+ PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStamp);
+ TValField& aValField = aField->myValField;
+ PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
+ aValForTime->myId = iTimeStamp;
+ aValForTime->myFieldName = aField->myName;
+ aValForTime->myEntity = aField->myEntity;
+ aValForTime->myMeshName = aField->myMeshName;
+ aValForTime->myNbComp = aField->myNbComp;
+ aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
+ INITMSG(MYDEBUG,"aDt = "<<aDt<<", "<<anUnitDt<<"\n");
}
- }catch (std::exception& exc){
- MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
- throw;
- }catch(...){
- EXCEPTION(runtime_error,"Unknown exception !!!");
}
+ } catch (std::runtime_error& exc){
+ MSG(MYDEBUG,"Follow exception wqs occured in:\n"<<exc.what());
+ } catch(...){
+ EXCEPTION(runtime_error,"Unknown exception !!!");
}
+
return this;
}
int VISU_MedConvertor::LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity,
const string& theFamilyName)
{
- MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
- const std::string& aMeshName = theMeshOnEntity->myMeshName;
+ PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
+ const string& aMeshName = theMeshOnEntity->myMeshName;
const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
- VISU::PMeshImpl aMesh = myMeshMap[aMeshName];
+ PMeshImpl aMesh = myMeshMap[aMeshName];
int isPointsUpdated;
if(anEntity == VISU::NODE_ENTITY)
isPointsUpdated = LoadPoints(aMed,aMesh,theFamilyName);
int VISU_MedConvertor::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
{
- MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+ PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
- const std::string& aFamilyName = aFamilyAndEntitySetIter->first;
+ const string& aFamilyName = aFamilyAndEntitySetIter->first;
const VISU::TEntity& anEntity = aFamilyAndEntitySetIter->second;
const VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
if(anEntity == VISU::NODE_ENTITY){
VISU::PFieldImpl theField,
VISU::PValForTimeImpl theValForTime)
{
- MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+ PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
int isPointsUpdated = LoadPoints(aMed,theMesh);
int isCellsOnEntityUpdated = LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity);
int isFieldUpdated = LoadField(aMed,theMesh,theMeshOnEntity,theField,theValForTime);
VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
aMeshOnEntity->myEntity = VISU::NODE_ENTITY;
aMeshOnEntity->myMeshName = theMesh->myName;
- VISU::PFamilyImpl aFamily = GetFamily(aMeshOnEntity,theFamilyName);
+ PFamilyImpl aFamily = GetFamily(aMeshOnEntity,theFamilyName);
//Check on loading already done
bool isPointsLoaded = !theMesh->myPointsCoord.empty();
if(isPointsLoaded)
return 0;
INITMSG(MYDEBUG,"LoadPoints - isPointsLoaded = "<<isPointsLoaded<<"; theFamilyName = '"<<theFamilyName<<"'\n");
-
+
//Main part of code
- MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
- MED::TInt aNbElem = aNodeInfo->GetNbElem();
+ PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
+ TInt aNbElem = aNodeInfo->GetNbElem();
if(!isPointsLoaded){
VISU::TMeshImpl::TPointsDim& aPointsDim = theMesh->myPointsDim;
VISU::TMeshImpl::TPointsCoord& aPointsCoord = theMesh->myPointsCoord;
aPointsCoord.resize(aNbElem*theMesh->myDim);
- for(int iElem = 0; iElem < aNbElem; iElem++)
+ for (int iElem = 0; iElem < aNbElem; iElem++)
for(int iDim = 0, iElem2Dim = iElem*theMesh->myDim; iDim < theMesh->myDim; iDim++, iElem2Dim++)
aPointsCoord[iElem2Dim] = aNodeInfo->GetNodeCoord(iElem,iDim);
VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aMeshOnEntity->myCellsConn[VTK_VERTEX];
aConnForCellType.resize(aNbElem);
for (int iElem = 0; iElem < aNbElem; iElem++)
- aConnForCellType[iElem] = TMeshOnEntityImpl::TConnect(1,iElem);
+ aConnForCellType[iElem] = VISU::TMeshOnEntityImpl::TConnect(1,iElem);
}
if(aFamily && aNbElem > 0){
VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[VTK_VERTEX];
aSubMeshOnCellType.insert(iElem);
}
return 1;
- }catch(std::exception& exc){
- MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
+ }catch(std::runtime_error& exc){
theMesh->myPointsCoord.clear();
throw;
}catch(...){
{
try{
//Check on existing family
- VISU::PFamilyImpl aFamily = GetFamily(theMeshOnEntity,theFamilyName);
+ PFamilyImpl aFamily = GetFamily(theMeshOnEntity,theFamilyName);
//Check on loading already done
bool isCellsLoaded = !theMeshOnEntity->myCellsConn.empty();
if(isCellsLoaded)
BEGMSG(MYDEBUG,"LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<bool(aFamily)<<endl);
const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
- const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
+ const EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
- MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
- MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
- MED::TInt aNbPoints = aNodeInfo->GetNbElem();
+ const PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+ PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
+ TInt aNbPoints = aNodeInfo->GetNbElem();
std::map<TInt,TInt> aNodeIdMap;
#ifdef _EDF_NODE_IDS_
- MED::EBooleen anIsNodeNum = MED::eFAUX;
+ EBooleen anIsNodeNum = eFAUX;
#else
- MED::EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
+ EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
if(anIsNodeNum){
- for(MED::TInt i = 0; i < aNbPoints; i++){
+ for(TInt i = 0; i < aNbPoints; i++){
aNodeIdMap[aNodeInfo->GetElemNum(i)-1] = i;
}
}
const MED::TGeom& aTGeom = theMeshOnEntity->myGeom;
MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
- VISU::TMeshOnEntityImpl::TCellsConn& aCellsConn = theMeshOnEntity->myCellsConn;
+ TMeshOnEntityImpl::TCellsConn& aCellsConn = theMeshOnEntity->myCellsConn;
for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
- const MED::EGeometrieElement& aGeom = anTGeomIter->first;
+ const EGeometrieElement& aGeom = anTGeomIter->first;
int aVTKGeomType = MEDGeomToVTK(aGeom);
+ ADDMSG(MYDEBUG,"LoadCellsOnEntity aGeom="<<aGeom<<"\n");
switch(aGeom){
- case MED::ePOLYGONE: {
- MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aGeom);
- MED::TInt aNbElem = aPolygoneInfo->GetNbElem();
-
- if(!isCellsLoaded){
- VISU::TMeshOnEntityImpl::TConnForCellType& aConnForPolygoneType = aCellsConn[aVTKGeomType];
- aConnForPolygoneType.resize(aNbElem);
-
- int aMNbNodes = aPolygoneInfo->GetConnDim();
+ case ePOLYGONE:
+ {
+ PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aGeom);
+ TInt aNbElem = aPolygoneInfo->GetNbElem();
- vector<MED::TInt> aConnect(aMNbNodes);
- vector<MED::TInt> aIndex = aPolygoneInfo->GetIndex();
-
- for(int iElem = 0; iElem < aNbElem; iElem++){
- VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForPolygoneType[iElem];
- int aNbConn = aPolygoneInfo->GetNbConn(iElem);
-
- anArray.resize(aNbConn);
+ if(!isCellsLoaded){
+ VISU::TMeshOnEntityImpl::TConnForCellType& aConnForPolygoneType = aCellsConn[aVTKGeomType];
+ aConnForPolygoneType.resize(aNbElem);
- aConnect = aPolygoneInfo->GetConnectivite();
+ int aMNbNodes = aPolygoneInfo->GetConnDim();
- for(int i = 0 ; i < aNbConn; i++){
- anArray[i] = aConnect[aIndex[iElem]-1+i]-1;
+ vector<TInt> aConnect(aMNbNodes);
+ vector<TInt> aIndex = aPolygoneInfo->GetIndex();
+
+ for (int iElem = 0; iElem < aNbElem; iElem++) {
+ VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForPolygoneType[iElem];
+ int aNbConn = aPolygoneInfo->GetNbConn(iElem);
+
+ anArray.resize(aNbConn);
+
+ aConnect = aPolygoneInfo->GetConnectivite();
+
+ for (int i=0;i<aNbConn;i++){
+ anArray[i] = aConnect[aIndex[iElem]-1+i]-1;
+ }
}
}
+ if(aFamily){
+ VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
+ for(int iElem = 0; iElem < aNbElem; iElem++)
+ if(aPolygoneInfo->GetFamNum(iElem) == aFamily->myId)
+ aSubMeshOnCellType.insert(iElem);
+ }
+ break;
}
- if(aFamily){
- VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
- for(int iElem = 0; iElem < aNbElem; iElem++)
- if(aPolygoneInfo->GetFamNum(iElem) == aFamily->myId)
- aSubMeshOnCellType.insert(iElem);
+ case ePOLYEDRE:
+ {
+ PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aGeom);
+ TInt aNbElem = aPolyedreInfo->GetNbElem();
+
+ if(!isCellsLoaded){
+ VISU::TMeshOnEntityImpl::TConnForCellType& aConnForPolyedreType = aCellsConn[aVTKGeomType];
+ aConnForPolyedreType.resize(aNbElem);
+
+ int aMNbNodes = aPolyedreInfo->GetNbConn();
+
+ vector<TInt> aConnect(aMNbNodes);
+ vector<TInt> aFacesIndex = aPolyedreInfo->GetFacesIndex();
+ vector<TInt> aIndex = aPolyedreInfo->GetIndex();
+
+ for (int iElem = 0; iElem < aNbElem; iElem++) {
+ VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForPolyedreType[iElem];
+ int aNbConn = aPolyedreInfo->GetNbConn(iElem);
+
+ anArray.resize(aNbConn);
+
+ aConnect = aPolyedreInfo->GetConnectivite();
+
+ int aInd1 = aIndex[iElem]-1;
+ int aInd2 = aIndex[iElem+1]-2;
+
+ int k = 0;
+ for (int i=aInd1;i<=aInd2;i++){
+ for (int j=aFacesIndex[i]-1;j<aFacesIndex[i+1]-1;j++){
+ anArray[k] = aConnect[j]-1;
+ k++;
+ }
+ }
+ ADDMSG(MYDEBUG," k="<<k<<"; aNbConn="<<aNbConn<<endl);
+ }
+ }
+ if(aFamily){
+ VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
+ for(int iElem = 0; iElem < aNbElem; iElem++)
+ if(aPolyedreInfo->GetFamNum(iElem) == aFamily->myId)
+ aSubMeshOnCellType.insert(iElem);
+ }
+ break;
}
- break;
- }
- default: {
- int aVNbNodes = VTKGeom2NbNodes(aVTKGeomType);
-
- MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
- MED::TInt aNbElem = aCellInfo->GetNbElem();
-
- if(!isCellsLoaded){
- VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aCellsConn[aVTKGeomType];
- aConnForCellType.resize(aNbElem);
+ default:
+ {
+ int aVNbNodes = VTKGeom2NbNodes(aVTKGeomType);
- int aMNbNodes = MEDGeom2NbNodes(aGeom);
- vector<MED::TInt> aConnect(aMNbNodes);
+ PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
+ TInt aNbElem = aCellInfo->GetNbElem();
- for(int iElem = 0; iElem < aNbElem; iElem++) {
- TMeshOnEntityImpl::TConnect& anArray = aConnForCellType[iElem];
- anArray.resize(aVNbNodes);
+ if(!isCellsLoaded){
+ VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aCellsConn[aVTKGeomType];
+ aConnForCellType.resize(aNbElem);
- if(anIsNodeNum){
- for(int i = 0; i < aMNbNodes; i++){
- aConnect[i] = aNodeIdMap[aCellInfo->GetConn(iElem,i)-1];
+ int aMNbNodes = MEDGeom2NbNodes(aGeom);
+ vector<TInt> aConnect(aMNbNodes);
+
+ for (int iElem = 0; iElem < aNbElem; iElem++) {
+ VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForCellType[iElem];
+ anArray.resize(aVNbNodes);
+
+ if(anIsNodeNum){
+ for(int i = 0; i < aMNbNodes; i++){
+ aConnect[i] = aNodeIdMap[aCellInfo->GetConn(iElem,i)-1];
+ }
+ }else{
+ for(int i = 0; i < aMNbNodes; i++){
+ aConnect[i] = aCellInfo->GetConn(iElem,i)-1;
+ }
}
- }else{
- for(int i = 0; i < aMNbNodes; i++){
- aConnect[i] = aCellInfo->GetConn(iElem,i)-1;
+
+ switch(aGeom){
+ case eTETRA4:
+ case eTETRA10:
+ anArray[0] = aConnect[0];
+ anArray[1] = aConnect[1];
+ anArray[2] = aConnect[3];
+ anArray[3] = aConnect[2];
+ break;
+ case ePYRA5:
+ case ePYRA13:
+ anArray[0] = aConnect[0];
+ anArray[1] = aConnect[3];
+ anArray[2] = aConnect[2];
+ anArray[3] = aConnect[1];
+ anArray[4] = aConnect[4];
+ break;
+ default:
+ for(int iNode = 0; iNode < aVNbNodes; iNode++)
+ anArray[iNode] = aConnect[iNode];
}
- }
-
- switch(aGeom){
- case MED::eTETRA4:
- case MED::eTETRA10:
- anArray[0] = aConnect[0];
- anArray[1] = aConnect[1];
- anArray[2] = aConnect[3];
- anArray[3] = aConnect[2];
- break;
- case MED::ePYRA5:
- case MED::ePYRA13:
- anArray[0] = aConnect[0];
- anArray[1] = aConnect[3];
- anArray[2] = aConnect[2];
- anArray[3] = aConnect[1];
- anArray[4] = aConnect[4];
- break;
- default:
for(int iNode = 0; iNode < aVNbNodes; iNode++)
- anArray[iNode] = aConnect[iNode];
+ if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
+ EXCEPTION(runtime_error,"ImportCells >> aNbPoints("<<aNbPoints<<") "<<
+ "<= anArray["<<iElem<<"]"<<
+ "["<<iNode<<"]"<<
+ "("<<anArray[iNode]<<") < 0");
}
- for(int iNode = 0; iNode < aVNbNodes; iNode++)
- if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
- EXCEPTION(runtime_error,"ImportCells >> aNbPoints("<<aNbPoints<<") "<<
- "<= anArray["<<iElem<<"]"<<
- "["<<iNode<<"]"<<
- "("<<anArray[iNode]<<") < 0");
+ }
+ //Filling aFamily SubMesh
+ if(aFamily){
+ VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
+ for(int iElem = 0; iElem < aNbElem; iElem++)
+ if(aCellInfo->GetFamNum(iElem) == aFamily->myId)
+ aSubMeshOnCellType.insert(iElem);
}
}
- //Filling aFamily SubMesh
- if(aFamily){
- VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
- for(int iElem = 0; iElem < aNbElem; iElem++)
- if(aCellInfo->GetFamNum(iElem) == aFamily->myId)
- aSubMeshOnCellType.insert(iElem);
- }
- }}
+ }
}
return 1;
- }catch(std::exception& exc){
+ }catch(std::runtime_error& exc){
theMeshOnEntity->myCellsConn.clear();
throw;
}catch(...){
if(!theValForTime->myValForCells.empty()) return 0;
//Main part of code
- MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
- MED::TInt anId = theField->myId;
- MED::PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,anId);
+ const std::string& aMeshName = theMeshOnEntity->myMeshName;
+ const PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+ PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,theField->myId);
MED::TGeom aTGeom;
- MED::EEntiteMaillage aMEntity;
- const MED::TEntityInfo& anEntityInfo = theMesh->myEntityInfo;
- theMed->GetNbTimeStamps(aFieldInfo,anEntityInfo,aMEntity,aTGeom);
+ EEntiteMaillage aMEntity;
+ theMed->GetNbTimeStamps(aFieldInfo,theMesh->myEntityInfo,aMEntity,aTGeom);
- anId = theValForTime->myId;
- MED::PTimeStampInfo aTimeStampInfo =
- theMed->GetPTimeStampInfo(aFieldInfo,aMEntity,aTGeom,anId);
+ PTimeStampInfo aTimeStampInfo = theMed->GetPTimeStampInfo(aFieldInfo,
+ aMEntity,
+ aTGeom,
+ theValForTime->myId);
+ TInt aNbGauss = aTimeStampInfo->GetNbGauss();
+ TInt aNbComp = theField->myNbComp;
- MED::PTimeStampVal aTimeStampVal = theMed->GetPTimeStampVal(aTimeStampInfo);
+ PTimeStampVal aTimeStampVal = theMed->GetPTimeStampVal(aTimeStampInfo);
- MED::TInt aNbGauss = aTimeStampInfo->GetNbGauss();
- MED::TInt aNbComp = theField->myNbComp;
+ INITMSG(MYDEBUG,"LoadField - aMeshName = '"<<aMeshName<<
+ "'; aFieldName = '"<<aFieldInfo->GetName()<<
+ "'; aMEntity = "<<aMEntity<<
+ "; anId = "<<theValForTime->myId<<endl);
+ BEGMSG(MYDEBUG,"LoadField - aNbComp = "<<aNbComp<<
+ "; aNbGauss = "<<aNbGauss<<endl);
const MED::TGeom& anEntityTGeom = theMeshOnEntity->myGeom;
MED::TGeom::const_iterator aTGeomIter = anEntityTGeom.begin();
for(; aTGeomIter != anEntityTGeom.end(); aTGeomIter++){
- const MED::EGeometrieElement& aGeom = aTGeomIter->first;
- const MED::TInt& aNbElem = aTGeomIter->second;
+ const EGeometrieElement& aGeom = aTGeomIter->first;
+ const TInt& aNbElem = aTGeomIter->second;
INITMSG(MYDEBUG,"LoadField - aGeom = "<<aGeom<<"; aNbElem = '"<<aNbElem<<endl);
int aVTKGeomType = MEDGeomToVTK(aGeom);
VISU::TValForTimeImpl::TValForCellsWithType& anArray = theValForTime->myValForCells[aVTKGeomType];
anArray.resize(aNbComp*aNbElem);
- for(MED::TInt iElem = 0, anId = 0; iElem < aNbElem; iElem++){
- for(MED::TInt iComp = 0; iComp < aNbComp; iComp++, anId++){
- for(MED::TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+ for(TInt iElem = 0, anId = 0; iElem < aNbElem; iElem++){
+ for(TInt iComp = 0; iComp < aNbComp; iComp++, anId++){
+ for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
anArray[anId] += aTimeStampVal->GetVal(aGeom,iElem,iComp,iGauss);
}
anArray[anId] /= aNbGauss;