From: enk Date: Fri, 21 Jan 2005 11:51:51 +0000 (+0000) Subject: CEA DEN - PAL/SALOME 2005 - L1.4.1 - Polyhedral elements X-Git-Tag: V2_2_0b2~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=226e74bcf68a1846cf5ea3dee6dfed46f24b5b72;p=modules%2Fvisu.git CEA DEN - PAL/SALOME 2005 - L1.4.1 - Polyhedral elements --- diff --git a/src/CONVERTOR/VISUConvertor.cxx b/src/CONVERTOR/VISUConvertor.cxx index 47cdbeea..c81e39e0 100644 --- a/src/CONVERTOR/VISUConvertor.cxx +++ b/src/CONVERTOR/VISUConvertor.cxx @@ -104,11 +104,11 @@ void parseFile(const char* theFileName) { } } MSG(MYDEBUG,"OK"); - //}catch(std::exception& exc){ - // MSG(MYDEBUG,"Follow exception was occured in file:"<GetPMeshInfo(iMesh); - - PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo); + PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo); + MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo); - TCellGroup aCellGroup = GetCellsByEntity(aMed,aMeshInfo,aEntityInfo); + TElemGroup aElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo); TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo); - TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aNodeInfo,aCellGroup,aFamilyGroup); + TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aNodeInfo,aElemGroup,aFamilyGroup); TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup); // creating TMesh structure and TMeshOnEntityMap typedef map TFamilyCounterMap; TFamilyCounterMap aFamilyNbCellsCounterMap, aFamilyCellsSizeCounterMap; + TFamilyCounterMap aFamilyNbPolygonesCounterMap, aFamilyPolygonesSizeCounterMap; TInt aDim = aMeshInfo->GetDim(); const string& aMeshName = aMeshInfo->GetName(); @@ -224,22 +228,60 @@ VISU_Convertor* VISU_MedConvertor::Build() { aMeshOnEntity->myCellsSize = 0; for(; anTGeomIter != aTGeom.end(); anTGeomIter++){ const EGeometrieElement& aGeom = anTGeomIter->first; - int aVNbNodes = VTKGeom2NbNodes(MEDGeomToVTK(aGeom)); - PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom); - TInt aNbElem = aCellInfo->GetNbElem(); - aMeshOnEntity->myNbCells += aNbElem; - aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1); - INITMSG(MYDEBUG,"aGeom = "<myNbPoints; iElem++){ - TInt aFamId = aCellInfo->GetFamNum(iElem); - if(aFamId != 0){ - aFamilyNbCellsCounterMap[aFamId] += 1; - aFamilyCellsSizeCounterMap[aFamId] += aVNbNodes + 1; + + 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; iiGetNbConn(ii); + aMeshOnEntity->myCellsSize += aNbConnii; + } + INITMSG(MYDEBUG,"aGeom = "<GetFamNum(iElem); + if(aFamId != 0){ + aFamilyNbCellsCounterMap[aFamId] += 1; + ADDMSG(MYDEBUG,"aFamId = "<GetNbConn(iElem) + 1; + } + } + ADDMSG(MYDEBUG,endl); + break; } - } + default: + { + int aVNbNodes = VTKGeom2NbNodes(MEDGeomToVTK(aGeom)); + PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom); + TInt aNbElem = aCellInfo->GetNbElem(); + aMeshOnEntity->myNbCells += aNbElem; + aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1); + INITMSG(MYDEBUG,"aGeom = "<GetFamNum(iElem); + if(aFamId != 0){ + aFamilyNbCellsCounterMap[aFamId] += 1; + ADDMSG(MYDEBUG,"aFamId = "<myMeshOnEntityMap[aVEntity]; VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; + + if(aFamilyGroup.empty()) + continue; INITMSG(MYDEBUG,"aMEntity = "<myFamilyMap; TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin(); for (; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){ - const string& aFamilyName = aFamilyMapIter->first; + const string& aName = aFamilyMapIter->first; aFamily = aFamilyMapIter->second; - if(aFamily){ - TFamilyGroup::const_iterator aGroupInfoIter = aFamilyGroup.begin(); - for(; aGroupInfoIter != aFamilyGroup.end(); aGroupInfoIter++){ - const PFamilyInfo& aFamilyInfo = *aGroupInfoIter; - if(aFamilyInfo->GetName() == aFamilyName){ - aVEntity = aFamily->myEntity; - goto exit_lable; - } - } + if(aName == aFamilyName){ + aVEntity = aFamily->myEntity; + goto exit_lable; } } } exit_lable: if(aFamily && aVEntity >= 0){ aGroup->myFamilyAndEntitySet.insert(TFamilyAndEntity(aFamilyName,aVEntity)); - INITMSG(MYDEBUG,"aFamilyName = '"<myName<<"'; aVEntity = "<myNbCells += aFamily->myNbCells; aGroup->myCellsSize += aFamily->myCellsSize; @@ -347,9 +386,8 @@ VISU_Convertor* VISU_MedConvertor::Build() { } } - BEGMSG(MYDEBUG,"VISU::TField:\n"); - TInt aNbFields = aMed->GetNbFields(); + BEGMSG(MYDEBUG,"VISU::TField: NbFields="<GetPFieldInfo(aMeshInfo,iField); TInt aNbComp = aFieldInfo->GetNbComp(); @@ -358,7 +396,6 @@ VISU_Convertor* VISU_MedConvertor::Build() { MED::TGeom aTGeom; EEntiteMaillage aMEntity; TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,aMEntity,aTGeom); - TEntity aVEntity = MEDEntityToVTK(aMEntity); VISU::PMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity]; TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; @@ -402,6 +439,10 @@ VISU_Convertor* VISU_MedConvertor::Build() { INITMSG(MYDEBUG,"aDt = "<myCellsConn.empty(); - if(isCellsLoaded) + if(isCellsLoaded) if(!aFamily) return 0; else if(!aFamily->mySubMesh.empty()) @@ -566,67 +607,108 @@ VISU_MedConvertor::LoadCellsOnEntity(const MED::PWrapper& theMed, for(; anTGeomIter != aTGeom.end(); anTGeomIter++){ const EGeometrieElement& aGeom = anTGeomIter->first; int aVTKGeomType = MEDGeomToVTK(aGeom); - int aVNbNodes = VTKGeom2NbNodes(aVTKGeomType); - - PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom); - TInt aNbElem = aCellInfo->GetNbElem(); - - if(!isCellsLoaded){ - VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aCellsConn[aVTKGeomType]; - aConnForCellType.resize(aNbElem); - - int aMNbNodes = MEDGeom2NbNodes(aGeom); - vector 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]; + ADDMSG(MYDEBUG,"LoadCellsOnEntity aGeom="<GetPPolygoneInfo(aMeshInfo,aMEntity,aGeom); + TInt aNbElem = aPolygoneInfo->GetNbElem(); + + if(!isCellsLoaded){ + VISU::TMeshOnEntityImpl::TConnForCellType& aConnForPolygoneType = aCellsConn[aVTKGeomType]; + aConnForPolygoneType.resize(aNbElem); + + int aMNbNodes = aPolygoneInfo->GetConnDim(); + + vector aConnect(aMNbNodes); + vector 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;iGetConn(iElem,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; + } + default: + { + int aVNbNodes = VTKGeom2NbNodes(aVTKGeomType); + + PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom); + TInt aNbElem = aCellInfo->GetNbElem(); + + if(!isCellsLoaded){ + VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aCellsConn[aVTKGeomType]; + aConnForCellType.resize(aNbElem); + + int aMNbNodes = MEDGeom2NbNodes(aGeom); + vector 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; + } + } + + 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]; + } + for(int iNode = 0; iNode < aVNbNodes; iNode++) + if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode]) + EXCEPTION(runtime_error,"ImportCells >> aNbPoints("<mySubMesh[aVTKGeomType]; + for(int iElem = 0; iElem < aNbElem; iElem++) + if(aCellInfo->GetFamNum(iElem) == aFamily->myId) + aSubMeshOnCellType.insert(iElem); } - for(int iNode = 0; iNode < aVNbNodes; iNode++) - if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode]) - EXCEPTION(runtime_error,"ImportCells >> aNbPoints("<mySubMesh[aVTKGeomType]; - for(int iElem = 0; iElem < aNbElem; iElem++) - if(aCellInfo->GetFamNum(iElem) == aFamily->myId) - aSubMeshOnCellType.insert(iElem); - } } return 1; }catch(std::runtime_error& exc){