using MED::EBooleen;
#ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
static int MYVALUEDEBUG = 0;
-static int MY_FAMILY_DEBUG = 0;
-static int MY_GROUP_DEBUG = 0;
+static int MY_FAMILY_DEBUG = 1;
+static int MY_GROUP_DEBUG = 1;
#else
static int MYDEBUG = 0;
static int MYVALUEDEBUG = 0;
InitProfile(theTimeStampVal,theMeshOnEntity,theGeom2Size,theValForTime);
InitGaussMesh(theTimeStampVal,theMeshOnEntity,theGeom2Size,theValForTime);
}
+
+
+ //---------------------------------------------------------------
+ typedef std::map<TInt,TInt> TFamilyCounterMap;
+
+ void
+ BuildMeshOnEntityMap(PMEDMesh theMesh,
+ TFamilyCounterMap& theFamilyNbCellsCounterMap,
+ TFamilyCounterMap& theFamilyCellsSizeCounterMap,
+ const MED::TEntityInfo& theEntityInfo,
+ MED::PNodeInfo theNodeInfo,
+ MED::PWrapper theMEDWrapper)
+ {
+ INITMSG(MYDEBUG,"BuildMeshOnEntityMap"<<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;
+
+ INITMSG(MYDEBUG,
+ "- aMEntity = "<<aMEntity<<
+ "; aVEntity = "<<aVEntity<<
+ endl);
+
+ if(aMEntity == MED::eNOEUD){
+ aMeshOnEntity->myNbCells = theMesh->myNbPoints;
+ aMeshOnEntity->myCellsSize = 2*theMesh->myNbPoints;
+
+ for(TInt iElem = 0; iElem < theMesh->myNbPoints; iElem++){
+ TInt aFamId = theNodeInfo->GetFamNum(iElem);
+ if(aFamId != 0){
+ theFamilyNbCellsCounterMap[aFamId] += 1;
+ theFamilyCellsSizeCounterMap[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;
+
+ switch(aMGeom){
+ case MED::ePOLYGONE: {
+ MED::PPolygoneInfo aPolygoneInfo = theMEDWrapper->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
+ TInt aNbElem = aPolygoneInfo->GetNbElem();
+
+ INITMSG(MYDEBUG,
+ "- aMGeom = "<<aMGeom<<
+ "; aNbElem = "<<aNbElem<<
+ endl);
+
+ aMeshOnEntity->myNbCells += aNbElem;
+ for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
+ TInt aNbConn = aPolygoneInfo->GetNbConn(anElemId);
+ aMeshOnEntity->myCellsSize += aNbConn;
+ TInt aFamId = aPolygoneInfo->GetFamNum(anElemId);
+ if(aFamId != 0){
+ theFamilyNbCellsCounterMap[aFamId] += 1;
+ theFamilyCellsSizeCounterMap[aFamId] += aNbConn + 1;
+ }
+ }
+ break;
+ }
+ case MED::ePOLYEDRE: {
+ MED::PPolyedreInfo aPolyedreInfo = theMEDWrapper->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
+ TInt aNbElem = aPolyedreInfo->GetNbElem();
+
+ INITMSG(MYDEBUG,
+ "- aMGeom = "<<aMGeom<<
+ "; aNbElem = "<<aNbElem<<
+ endl);
+
+ aMeshOnEntity->myNbCells += aNbElem;
+ for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
+ MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(anElemId);
+ TInt aNbFaces = aConnSliceArr.size();
+ TInt aCellSize = 0;
+ for(TInt iFace = 0; iFace < aNbFaces; iFace++){
+ MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
+ TInt aNbConn = aConnSlice.size();
+ aCellSize += aNbConn;
+ }
+ aMeshOnEntity->myCellsSize += aCellSize;
+ TInt aFamId = aPolyedreInfo->GetFamNum(anElemId);
+ if(aFamId != 0){
+ theFamilyNbCellsCounterMap[aFamId] += 1;
+ theFamilyCellsSizeCounterMap[aFamId] += aCellSize + 1;
+ }
+ }
+ break;
+ }
+ default: {
+ vtkIdType aVGeom = MEDGeomToVTK(aMGeom);
+ int aVNbNodes = VTKGeom2NbNodes(aVGeom);
+ MED::PCellInfo aCellInfo = theMEDWrapper->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
+ TInt aNbElem = aCellInfo->GetNbElem();
+ 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){
+ theFamilyNbCellsCounterMap[aFamId] += 1;
+ theFamilyCellsSizeCounterMap[aFamId] += aVNbNodes + 1;
+ }
+ }
+ }} // end switch(...)
+ }
+ }
+ }
+ }
+
}
MED::TElemGroup aElemGroup = MED::GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
- // creating TMesh structure and TMeshOnEntityMap
- typedef map<TInt,TInt> TFamilyCounterMap;
- TFamilyCounterMap aFamilyNbCellsCounterMap, aFamilyCellsSizeCounterMap;
-
+ // creating TMesh structure and TMeshOnEntityMap
TInt aDim = aMeshInfo->GetDim();
- const string& aMeshName = aMeshInfo->GetName();
+ std::string aMeshName = aMeshInfo->GetName();
PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh());
aMesh->myDim = aDim;
"; aDim = "<<aDim<<"\n");
BEGMSG(MYDEBUG,"aEntityInfo.size() = "<<aEntityInfo.size()<<"\n");
+ TFamilyCounterMap aFamilyNbCellsCounterMap, aFamilyCellsSizeCounterMap;
+
+ BuildMeshOnEntityMap(aMesh,
+ aFamilyNbCellsCounterMap,
+ aFamilyCellsSizeCounterMap,
+ aEntityInfo,
+ aNodeInfo,
+ aMed);
TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
- MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
- for(; anEntityIter != aEntityInfo.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;
-
- INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<
- "; aVEntity = "<<aVEntity<<
- endl);
-
- if(aMEntity == MED::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<<
- 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;
-
- switch(aMGeom){
- case MED::ePOLYGONE: {
- MED::PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
- TInt aNbElem = aPolygoneInfo->GetNbElem();
-
- INITMSG(MYDEBUG,
- "- aMGeom = "<<aMGeom<<
- "; aNbElem = "<<aNbElem<<
- endl);
-
- aMeshOnEntity->myNbCells += aNbElem;
- for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
- TInt aNbConn = aPolygoneInfo->GetNbConn(anElemId);
- aMeshOnEntity->myCellsSize += aNbConn;
- TInt aFamId = aPolygoneInfo->GetFamNum(anElemId);
- if(aFamId != 0){
- aFamilyNbCellsCounterMap[aFamId] += 1;
- aFamilyCellsSizeCounterMap[aFamId] += aNbConn + 1;
- }
- }
- break;
- }
- case MED::ePOLYEDRE: {
- MED::PPolyedreInfo aPolyedreInfo = aMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
- TInt aNbElem = aPolyedreInfo->GetNbElem();
-
- INITMSG(MYDEBUG,
- "- aMGeom = "<<aMGeom<<
- "; aNbElem = "<<aNbElem<<
- endl);
-
- aMeshOnEntity->myNbCells += aNbElem;
- for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
- MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(anElemId);
- TInt aNbFaces = aConnSliceArr.size();
- TInt aCellSize = 0;
- for(TInt iFace = 0; iFace < aNbFaces; iFace++){
- MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
- TInt aNbConn = aConnSlice.size();
- aCellSize += aNbConn;
- }
- aMeshOnEntity->myCellsSize += aCellSize;
- TInt aFamId = aPolyedreInfo->GetFamNum(anElemId);
- if(aFamId != 0){
- aFamilyNbCellsCounterMap[aFamId] += 1;
- aFamilyCellsSizeCounterMap[aFamId] += aCellSize + 1;
- }
- }
- break;
- }
- default: {
- vtkIdType aVGeom = MEDGeomToVTK(aMGeom);
- int aVNbNodes = VTKGeom2NbNodes(aVGeom);
- MED::PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
- TInt aNbElem = aCellInfo->GetNbElem();
- 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){
- aFamilyNbCellsCounterMap[aFamId] += 1;
- aFamilyCellsSizeCounterMap[aFamId] += aVNbNodes + 1;
- }
- }
- }} // end switch(...)
- }
- }
- }
-
+
TInt aNbFields = aMed->GetNbFields();
BEGMSG(MYDEBUG,"TField: aNbFields = "<<aNbFields<<"\n");
for(TInt iField = 1; iField <= aNbFields; iField++){