}
}
+ //---------------------------------------------------------------
+ void
+ BuildMeshGrilleOnEntityMap(PMEDMesh theMesh,
+ const MED::TEntityInfo& theEntityInfo,
+ const MED::PGrilleInfo& theGrilleInfo,
+ const MED::PWrapper& theMEDWrapper)
+ {
+ TTimerLog aTimerLog(MYDEBUG,"BuildMeshGrilleOnEntityMap");
+ INITMSG(MYDEBUG,"BuildMeshGrilleOnEntityMap"<<endl);
+
+ MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
+ const std::string& aMeshName = theMesh->myName;
+ TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+ MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
+ for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
+ const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
+ const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
+
+ TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ PMEDMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TMEDMeshOnEntity());
+ aMeshOnEntity->myEntity = aVEntity;
+ aMeshOnEntity->myMeshName = aMeshName;
+ aMeshOnEntity->myGeom2Size = aGeom2Size;
+// TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize;
+
+ INITMSG(MYDEBUG,
+ "- aMEntity = "<<aMEntity<<
+ "; aVEntity = "<<aVEntity<<
+ endl);
+
+ if(aMEntity == MED::eNOEUD){
+ aMeshOnEntity->myNbCells = theGrilleInfo->GetNbNodes();
+ aMeshOnEntity->myCellsSize = 2*theGrilleInfo->GetNbNodes();
+
+ // must be implemented (shadow point for GRILLE STANDARD,CARTESIAN,...)
+// for(TInt iElem = 0; iElem < theMesh->myNbPoints; iElem++){
+// TInt aFamId = theNodeInfo->GetFamNum(iElem);
+// if(aFamId != 0)
+// aFamilyID2CellsSize[aFamId] += 2;
+// }
+
+ INITMSG(MYDEBUG,
+ "- myNbCells = "<<aMeshOnEntity->myNbCells<<
+ "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
+ endl);;
+
+ } else {
+ MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
+ aMeshOnEntity->myNbCells = 0;
+ aMeshOnEntity->myCellsSize = 0;
+ for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
+ const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
+ VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+ vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
+ TInt aNbElem = theGrilleInfo->GetNbCells();
+ aMeshOnEntity->myNbCells += aNbElem;
+ aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
+
+ INITMSG(MYDEBUG,
+ "- aMGeom = "<<aMGeom<<
+ "; aNbElem = "<<aNbElem<<
+ "; myNbCells = "<<aMeshOnEntity->myNbCells<<
+ "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
+ endl);
+
+// for(TInt iElem = 0; iElem < aNbElem; iElem++){
+// TInt aFamId = aCellInfo->GetFamNum(iElem);
+// if(aFamId != 0)
+// aFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
+// }
+ }
+
+ }
+
+ }
+
+
+ }
+
//---------------------------------------------------------------
void
myNodeInfo = theNodeInfo;
}
+ void
+ TMEDNamedPointCoords
+ ::Init(vtkIdType theNbPoints,
+ vtkIdType theDim,
+ const MED::PGrilleInfo& theInfo)
+ {
+ TNamedPointCoords::Init(theNbPoints,theDim);
+ }
+
std::string
TMEDNamedPointCoords
::GetNodeName(vtkIdType theObjID) const
myElemInfo = theElemInfo;
}
+
+ void
+ TMEDSubMesh
+ ::Init(const MED::PGrilleInfo& theGrilleInfo)
+ {
+ myIsElemNum = MED::eFAUX;
+ // must be implemented
+ }
+
vtkIdType
TMEDSubMesh
::GetElemObjID(vtkIdType theID) const
MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
std::string aMeshName = aMeshInfo->GetName();
TInt aDim = aMeshInfo->GetDim();
-
- MED::PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
-
- MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
-
+ MED::EMaillage aType = aMeshInfo->GetType();
+
// creating TMesh structure and TMeshOnEntityMap
PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh());
+
aMesh->myDim = aDim;
aMesh->myName = aMeshName;
- aMesh->myNbPoints = aNodeInfo->GetNbElem();
aMesh->myMeshInfo = aMeshInfo;
- aMesh->myEntityInfo = anEntityInfo;
aMesh->myNamedPointCoords(new TMEDNamedPointCoords());
+
+ if(aType == MED::eNON_STRUCTURE){
- INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
- "'; myNbPoints = "<<aMesh->myNbPoints<<
- "; aDim = "<<aDim<<"\n");
+ MED::PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
+ MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+
+ aMesh->myNbPoints = aNodeInfo->GetNbElem();
+ aMesh->myEntityInfo = anEntityInfo;
+
+ INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
+ "'; myNbPoints = "<<aMesh->myNbPoints<<
+ "; aDim = "<<aDim<<"\n");
+
#ifndef _DEXCEPT_
- try{
+ try{
#endif
- BEGMSG(MYDEBUG,"anEntityInfo.size() = "<<anEntityInfo.size()<<"\n");
-
- BuildMeshOnEntityMap(aMesh,
- anEntityInfo,
- aNodeInfo,
- aMed);
+ BEGMSG(MYDEBUG,"anEntityInfo.size() = "<<anEntityInfo.size()<<"\n");
+
+ BuildMeshOnEntityMap(aMesh,
+ anEntityInfo,
+ aNodeInfo,
+ aMed);
+
+#ifndef _DEXCEPT_
+ }catch(std::exception& exc){
+ MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+ }catch(...){
+ MSG(MYDEBUG,"Unknown exception !!!");
+ }
+#endif
+ } // NON STRUCTURED MESH
+ else {
+ MED::PGrilleInfo aGrilleInfo = aMed->GetPGrilleInfo(aMeshInfo);
+
+ MED::TEntityInfo anEntityInfo;
+ anEntityInfo[MED::eNOEUD][MED::ePOINT1] = aGrilleInfo->GetNbNodes();
+ anEntityInfo[aGrilleInfo->GetEntity()][aGrilleInfo->GetGeom()] = aGrilleInfo->GetNbCells();
+ aMesh->myNbPoints = aGrilleInfo->GetNbNodes();
+ aMesh->myEntityInfo = anEntityInfo;
+
#ifndef _DEXCEPT_
- }catch(std::exception& exc){
- MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
- }catch(...){
- MSG(MYDEBUG,"Unknown exception !!!");
- }
+ try{
+#endif
+ BEGMSG(MYDEBUG,"anEntityInfo.size() = "<<anEntityInfo.size()<<"\n");
+
+ BuildMeshGrilleOnEntityMap(aMesh,
+ anEntityInfo,
+ aGrilleInfo,
+ aMed);
+
+#ifndef _DEXCEPT_
+ }catch(std::exception& exc){
+ MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+ }catch(...){
+ MSG(MYDEBUG,"Unknown exception !!!");
+ }
#endif
+ }
+
#ifndef _DEXCEPT_
}catch(std::exception& exc){
MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
if(theMesh->myIsDone)
return 0;
- //Main part of code
- MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
- TInt aNbElem = aNodeInfo->GetNbElem();
- TInt aDim = theMesh->myDim;
-
- PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
- TMEDNamedPointCoords& aCoords = aNamedPointCoords;
- aCoords.Init(aNbElem,aDim,aNodeInfo);
-
- for(int iDim = 0; iDim < aDim; iDim++)
- aCoords.GetName(iDim) = aNodeInfo->GetCoordName(iDim);
+ MED::EMaillage aType = theMesh->myMeshInfo->GetType();
- for(int iElem = 0; iElem < aNbElem; iElem++){
- TCoordSlice aVCoordSlice = aCoords.GetCoordSlice(iElem);
- MED::TCCoordSlice aMCoordSlice = aNodeInfo->GetCoordSlice(iElem);
+ if(aType == MED::eNON_STRUCTURE){
+ //Main part of code
+ MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
+ TInt aNbElem = aNodeInfo->GetNbElem();
+ TInt aDim = theMesh->myDim;
+
+ PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
+ TMEDNamedPointCoords& aCoords = aNamedPointCoords;
+ aCoords.Init(aNbElem,aDim,aNodeInfo);
+
for(int iDim = 0; iDim < aDim; iDim++)
- aVCoordSlice[iDim] = aMCoordSlice[iDim];
+ aCoords.GetName(iDim) = aNodeInfo->GetCoordName(iDim);
+
+ for(int iElem = 0; iElem < aNbElem; iElem++){
+ TCoordSlice aVCoordSlice = aCoords.GetCoordSlice(iElem);
+ MED::TCCoordSlice aMCoordSlice = aNodeInfo->GetCoordSlice(iElem);
+ for(int iDim = 0; iDim < aDim; iDim++)
+ aVCoordSlice[iDim] = aMCoordSlice[iDim];
+ }
+
+ TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
+ PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new TMEDSubMesh());
+
+ aSubMesh->Init(MED::PElemInfo(aNodeInfo));
+ aSubMesh->myNbCells = theMesh->myNbPoints;
+ aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
+
+ TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+ aCell2Connect.resize(aNbElem);
+ for (int iElem = 0; iElem < aNbElem; iElem++)
+ aCell2Connect[iElem] = VISU::TConnect(1,iElem);
+ } // END NON_STRUCTURED
+ else { // STRUCTURED
+ //Main part of code
+ MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(theMesh->myMeshInfo);
+ TInt aNbElem = aGrilleInfo->GetNbNodes();
+ TInt aDim = theMesh->myDim;
+
+ PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
+ TMEDNamedPointCoords& aCoords = aNamedPointCoords;
+ aCoords.Init(aNbElem,aDim,aGrilleInfo);
+
+ for(int iDim = 0; iDim < aDim; iDim++)
+ aCoords.GetName(iDim) = aGrilleInfo->GetCoordName(iDim);
+
+ for(int iElem = 0; iElem < aNbElem; iElem++){
+ TCoordSlice aVCoordSlice = aCoords.GetCoordSlice(iElem);
+ MED::TNodeCoord aMCoord = aGrilleInfo->GetCoord(iElem);
+ for(int iDim = 0; iDim < aDim; iDim++){
+ aVCoordSlice[iDim] = aMCoord[iDim];
+ }
+ }
+
+ TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
+ PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new TMEDSubMesh());
+
+ aSubMesh->Init(aGrilleInfo);
+ aSubMesh->myNbCells = theMesh->myNbPoints;
+ aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
+
+ TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+ aCell2Connect.resize(aNbElem);
+ for (int iElem = 0; iElem < aNbElem; iElem++)
+ aCell2Connect[iElem] = VISU::TConnect(1,iElem);
+
}
- TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
- PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new TMEDSubMesh());
-
- aSubMesh->Init(aNodeInfo);
- aSubMesh->myNbCells = theMesh->myNbPoints;
- aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
-
- TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
- aCell2Connect.resize(aNbElem);
- for (int iElem = 0; iElem < aNbElem; iElem++)
- aCell2Connect[iElem] = VISU::TConnect(1,iElem);
-
theMesh->myIsDone = true;
return 1;
return 0;
const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+
+ MED::EMaillage aType = aMeshInfo->GetType();
+
+ if(aType == MED::eSTRUCTURE){
+
+ MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo);
+ TInt aNbPoints = aGrilleInfo->GetNbNodes();
+
+ std::map<TInt,TInt> aNodeIdMap;
+ EBooleen anIsNodeNum = MED::eFAUX;
+
+ const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
+ MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
+ TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
+
+ for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
+ const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
+ VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+ INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"; aEGeom = "<<aEGeom<<"\n");
+ {
+ vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
+ INITMSG(MYDEBUG,"aVNbNodes = "<<aVNbNodes<<"\n");
+
+ TInt aNbElem = aGrilleInfo->GetNbCells();
+
+ if(aNbElem > 0){
+ PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
+
+ aSubMesh->Init(aGrilleInfo);
+ aSubMesh->myNbCells = aNbElem;
+ aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
+
+ TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+ aCell2Connect.resize(aNbElem);
+
+ TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
+ TVector<TInt> aConnect(aMNbNodes);
+
+ for(TInt iElem = 0; iElem < aNbElem; iElem++) {
+ MED::TIntVector aConn = aGrilleInfo->GetConn(iElem);
+ TConnect& anArray = aCell2Connect[iElem];
+ anArray.resize(aVNbNodes);
+
+ if(anIsNodeNum){
+ for(TInt iConn = 0; iConn < aMNbNodes; iConn++){
+ aConnect[iConn] = aNodeIdMap[aConn[iConn] - 1];
+ }
+ }else{
+ for(int iConn = 0; iConn < aMNbNodes; ++iConn){
+ aConnect[iConn] = aConn[iConn];
+ }
+ }
+
+ switch(aMGeom){
+ case MED::eQUAD4:
+ anArray[0] = aConnect[0];
+ anArray[1] = aConnect[2];
+ anArray[2] = aConnect[3];
+ anArray[3] = aConnect[1];
+ break;
+ case MED::eHEXA8:
+ anArray[0] = aConnect[0];
+ anArray[1] = aConnect[2];
+ anArray[2] = aConnect[3];
+ anArray[3] = aConnect[1];
+ anArray[4] = aConnect[4];
+ anArray[5] = aConnect[6];
+ anArray[6] = aConnect[7];
+ anArray[7] = aConnect[5];
+ 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,"LoadCellsOnEntity - "<<
+ " aNbPoints("<<aNbPoints<<") "<<
+ "<= anArray["<<iElem<<"]"<<
+ "["<<iNode<<"]"<<
+ "("<<anArray[iNode]<<") < 0");
+ }
+ }
+ }
+ }
+
+ theMeshOnEntity->myIsDone = true;
+
+ return 1;
+
+ }
+
MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
TInt aNbPoints = aNodeInfo->GetNbElem();
if(aNbElem > 0){
PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
- aSubMesh->Init(aPolygoneInfo);
+ aSubMesh->Init(MED::PElemInfo(aPolygoneInfo));
aSubMesh->myNbCells = aNbElem;
TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
if(aNbElem > 0){
PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
- aSubMesh->Init(aPolyedreInfo);
+ aSubMesh->Init((MED::PElemInfo)aPolyedreInfo);
aSubMesh->myNbCells = aNbElem;
TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
if(aNbElem > 0){
PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
- aSubMesh->Init(aCellInfo);
+ aSubMesh->Init((MED::PElemInfo)aCellInfo);
aSubMesh->myNbCells = aNbElem;
aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
}}
}
+ // END NON_STRUCTURED
+
theMeshOnEntity->myIsDone = true;
return 1;
const PMEDSubProfile& aSubProfile = anIter->second;
MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
MED::PElemInfo anElemInfo;
- if(aMEntity == MED::eNOEUD)
- anElemInfo = theMed->GetPNodeInfo(aMeshInfo);
- else{
- switch(aMGeom){
- case MED::ePOLYGONE: {
- anElemInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
- break;
- }
- case MED::ePOLYEDRE: {
- anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
- break;
- }
- default: {
- anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
- break;
- }}
- }
+ anElemInfo = theMed->GetPElemInfo(aMeshInfo,aMEntity,aMGeom);
aSubProfile->myIsElemNum = anElemInfo->IsElemNum();
aSubProfile->myElemNum = anElemInfo->myElemNum;
}
TTimerLog aTimerLog(MYDEBUG,"LoadGaussMesh");
INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
+ // this part of code must be reimplemented in connection with GRILLE structures
+ if(theMesh->myMeshInfo->GetType() == MED::eSTRUCTURE)
+ EXCEPTION(runtime_error,"LoadGaussMesh - Gauss Points localization error!!!");
+
PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
if(!aGaussMesh || aGaussMesh->myIsDone)
return;