using namespace VISU;
#ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
#else
static int MYDEBUG = 0;
#endif
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);
}
MSG(MYDEBUG,"VISU_MedConvertor::Build()");
INITMSG(MYDEBUG,"GetNbMeshes() = "<<aNbMeshes<<"\n");
- for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++)
- try{
+ for (TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++) {
+ try {
PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
- TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aNodeInfo,aElemGroup,aFamilyGroup);
+ TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup);
TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
// creating TMesh structure and TMeshOnEntityMap
typedef map<TInt,TInt> TFamilyCounterMap;
TFamilyCounterMap aFamilyNbCellsCounterMap, aFamilyCellsSizeCounterMap;
- TFamilyCounterMap aFamilyNbPolygonesCounterMap, aFamilyPolygonesSizeCounterMap;
TInt aDim = aMeshInfo->GetDim();
const string& aMeshName = aMeshInfo->GetName();
TInt aFamId = aPolygoneInfo->GetFamNum(iElem);
if(aFamId != 0){
aFamilyNbCellsCounterMap[aFamId] += 1;
- ADDMSG(MYDEBUG,"aFamId = "<<aFamId<<" ");
+ 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:
{
int aVNbNodes = VTKGeom2NbNodes(MEDGeomToVTK(aGeom));
TInt aNbComp = aFieldInfo->GetNbComp();
const string& aFieldName = aFieldInfo->GetName();
+ MED::TErr anErr;
MED::TGeom aTGeom;
EEntiteMaillage aMEntity;
- TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,aMEntity,aTGeom);
+ TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,aMEntity,aTGeom,&anErr);
+ if (anErr < 0 || aNbTimeStamps < 1)
+ continue;
+
TEntity aVEntity = MEDEntityToVTK(aMEntity);
VISU::PMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
PTimeStampInfo aTimeStamp = aMed->GetPTimeStampInfo(aFieldInfo,
aMEntity,
aTGeom,
- iTimeStamp);
+ iTimeStamp,
+ &anErr);
+ if (anErr < 0)
+ continue;
+
TFloat aDt = aTimeStamp->GetDt();
const string& anUnitDt = aTimeStamp->GetUnitDt();
- PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStamp);
+ PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStamp,&anErr);
TValField& aValField = aField->myValField;
PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
aValForTime->myId = iTimeStamp;
} catch(...){
EXCEPTION(runtime_error,"Unknown exception !!!");
}
+ }
return this;
}
if(aFamily && aNbElem > 0){
VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[VTK_VERTEX];
for (int iElem = 0; iElem < aNbElem; iElem++)
- if(aNodeInfo->GetElemNum(iElem) == aFamily->myId)
+ if(aNodeInfo->GetFamNum(iElem) == aFamily->myId)
aSubMeshOnCellType.insert(iElem);
}
return 1;
}
break;
}
+ case ePOLYEDRE:
+ {
+ PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aGeom);
+ TInt aNbElem = aPolyedreInfo->GetNbElem();
+
+ int aMNbNodes = aPolyedreInfo->GetNbConn();
+ vector<TInt> aConnect(aMNbNodes);
+ aConnect = aPolyedreInfo->GetConnectivite();
+
+ if(!isCellsLoaded){
+ VISU::TMeshOnEntityImpl::TConnForCellType& aConnForPolyedreType = aCellsConn[aVTKGeomType];
+ aConnForPolyedreType.resize(aNbElem);
+
+ vector<TInt> aFacesIndex = aPolyedreInfo->GetFacesIndex();
+ vector<TInt> aIndex = aPolyedreInfo->GetIndex();
+
+ for (int iElem = 0; iElem < aNbElem; iElem++) {
+ set<TInt> aArrayNew;
+ VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForPolyedreType[iElem];
+
+ int aInd1 = aIndex[iElem]-1;
+ int aInd2 = aIndex[iElem+1]-2;
+
+ for (int i=aInd1;i<=aInd2;i++){
+ for (int j=aFacesIndex[i]-1;j<aFacesIndex[i+1]-1;j++){
+ aArrayNew.insert(aConnect[j]);
+ }
+ }
+
+ int aNbConnNew = aArrayNew.size();
+ anArray.resize(aNbConnNew);
+ set<TInt>::iterator aIter = aArrayNew.begin();
+ for (int i=0; aIter!=aArrayNew.end();aIter++, i++)
+ anArray[i] = (*aIter)-1;
+
+ }
+ }
+ 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;
+ }
default:
{
int aVNbNodes = VTKGeom2NbNodes(aVTKGeomType);
TInt aNbComp = theField->myNbComp;
PTimeStampVal aTimeStampVal = theMed->GetPTimeStampVal(aTimeStampInfo);
-
+ bool anIsTrimmed = theField->myIsTrimmed;
INITMSG(MYDEBUG,"LoadField - aMeshName = '"<<aMeshName<<
"'; aFieldName = '"<<aFieldInfo->GetName()<<
"'; aMEntity = "<<aMEntity<<
INITMSG(MYDEBUG,"LoadField - aGeom = "<<aGeom<<"; aNbElem = '"<<aNbElem<<endl);
if(aTGeom.find(aGeom) == aTGeom.end()){
- theField->myDataSize -= aNbElem*theField->myNbComp;
- theField->myIsTrimmed = true;
+ if(!theField->myIsTrimmed){
+ theField->myDataSize -= aNbElem*theField->myNbComp;
+ anIsTrimmed = true;
+ }
}else{
int aVTKGeomType = MEDGeomToVTK(aGeom);
VISU::TValForTimeImpl::TValForCellsWithType& anArray = theValForTime->myValForCells[aVTKGeomType];
}
}
}
+ theField->myIsTrimmed = anIsTrimmed;
return 1;
}