for(; anIter != aGeom2Size.end(); anIter++){
EGeometrieElement aMGeom = anIter->first;
vtkIdType aVGeom = MEDGeomToVTK(aMGeom);
- vtkIdType aVNbNodes = VTKGeom2NbNodes(aVGeom);
-
- PMEDGaussSubMesh aGaussSubMesh(new TMEDGaussSubMesh());
TGeom2SubProfile::iterator anIter2 = aGeom2SubProfile.find(aVGeom);
if(anIter2 == aGeom2SubProfile.end()){
continue;
}
- PMEDSubProfile aSubProfile = anIter2->second;
- aGaussSubMesh->mySubProfile = aSubProfile;
- aGaussSubMesh->myStatus = aSubProfile->myStatus;
-
- PMEDGauss aGauss(new TMEDGauss());
- aGaussSubMesh->myGauss = aGauss;
- aGauss->myGeom = aVGeom;
-
- std::string aName;
- TInt aNbGauss = 0;
-
TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(aMGeom);
if(aTimeStampIter != theGeom2Size.end()){
TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
- TInt aNbCells = aTimeStampIter->second;
if(aGaussIter != aGeom2Gauss.end()){
- PGaussInfo aGaussInfo = aGaussIter->second;
+ PMEDGaussSubMesh aGaussSubMesh(new TMEDGaussSubMesh());
+
+ PMEDSubProfile aSubProfile = anIter2->second;
+ aGaussSubMesh->mySubProfile = aSubProfile;
+ aGaussSubMesh->myStatus = aSubProfile->myStatus;
+
+ PMEDGauss aGauss(new TMEDGauss());
+ aGaussSubMesh->myGauss = aGauss;
+ aGauss->myGeom = aVGeom;
+ PGaussInfo aGaussInfo = aGaussIter->second;
aGauss->myGaussInfo = aGaussInfo;
- aName = aGaussInfo->GetName();
+ std::string aName = aGaussInfo->GetName();
aGauss->myName = aName;
- aNbGauss = aGaussInfo->GetNbGauss();
+ TInt aNbCells = aTimeStampIter->second;
+ TInt aNbGauss = aGaussInfo->GetNbGauss();
aGauss->myNbPoints = aNbGauss;
aGaussSubMesh->myNbCells = aNbCells*aNbGauss;
const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
const TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
- for (; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
+ for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
const string& aName = aFamilyMapIter->first;
aFamily = aFamilyMapIter->second;
if(aName == aFamilyName){
VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
aMeshOnEntity->myEntity = VISU::NODE_ENTITY;
aMeshOnEntity->myMeshName = theMesh->myName;
- PFamilyImpl aFamily = GetFamily(aMeshOnEntity,theFamilyName);
+ PMEDFamily aFamily = GetFamily(aMeshOnEntity,theFamilyName);
+
//Check on loading already done
- bool isPointsLoaded = !theMesh->myPointsCoord.empty();
- if(isPointsLoaded)
+ if(theMesh->myIsMEDDone)
if(!aFamily)
return 0;
- else if(!aFamily->myGeom2SubMeshID.empty())
+ else if(!aFamily->myIsMEDDone)
return 0;
- INITMSG(MYDEBUG,"LoadPoints - isPointsLoaded = "<<isPointsLoaded<<"; theFamilyName = '"<<theFamilyName<<"'\n");
+ INITMSG(MYDEBUG,"LoadPoints - theMesh->myIsMEDDone = "<<theMesh->myIsMEDDone<<
+ "; theFamilyName = '"<<theFamilyName<<"'\n");
//Main part of code
PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
TInt aNbElem = aNodeInfo->GetNbElem();
- if(!isPointsLoaded){
- VISU::TMeshImpl::TPointsDim& aPointsDim = theMesh->myPointsDim;
- aPointsDim.resize(theMesh->myDim);
- for(int iDim = 0; iDim < theMesh->myDim; iDim++)
- aPointsDim[iDim] = aNodeInfo->GetCoordName(iDim);
-
- VISU::TPointsCoord& aPointsCoord = theMesh->myPointsCoord;
- aPointsCoord.resize(aNbElem*theMesh->myDim);
- 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);
+ if(!theMesh->myIsMEDDone){
+ TInt aDim = theMesh->myDim;
+
+ TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
+ aCoords.Init(aNbElem,aDim);
+
+ for(int iDim = 0; iDim < aDim; iDim++)
+ aCoords.GetName(iDim) = aNodeInfo->GetCoordName(iDim);
+ for(int iElem = 0; iElem < aNbElem; iElem++){
+ VISU::TCoordSlice aCoordSlice = aCoords.GetCoordSlice(iElem);
+ for(int iDim = 0; iDim < aDim; iDim++)
+ aCoordSlice[iDim] = aNodeInfo->GetNodeCoord(iElem,iDim);
+ }
+
VISU::TCell2Connect& aConnForCellType = aMeshOnEntity->myGeom2Cell2Connect[VTK_VERTEX];
aConnForCellType.resize(aNbElem);
for (int iElem = 0; iElem < aNbElem; iElem++)
- aConnForCellType[iElem] = VISU::TConnect(1,iElem);
+ aConnForCellType[iElem] = VISU::TConnect(1,iElem);
+
+ theMesh->myIsMEDDone = true;
}
- if(aFamily && aNbElem > 0){
- VISU::TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[VTK_VERTEX];
- for (int iElem = 0; iElem < aNbElem; iElem++)
- if(aNodeInfo->GetFamNum(iElem) == aFamily->myId)
- aSubMeshID.push_back(iElem);
+
+ if(aFamily){
+ if(!aFamily->myIsMEDDone){
+ if(aNbElem > 0){
+ VISU::TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[VTK_VERTEX];
+ for (int iElem = 0; iElem < aNbElem; iElem++)
+ if(aNodeInfo->GetFamNum(iElem) == aFamily->myId)
+ aSubMeshID.push_back(iElem);
+ }
+ aFamily->myIsMEDDone = true;
+ }
}
+
return 1;
}catch(std::exception& exc){
- theMesh->myPointsCoord.clear();
throw;
}catch(...){
- theMesh->myPointsCoord.clear();
EXCEPTION(runtime_error,"Unknown exception !!!");
}
+
return 0;
}
aGaussCoord);
if(TInt aNbGauss = aGaussCoord.GetNbGauss()){
- TPoints& aPoints = aGaussSubMesh->myPoints;
+ TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
TInt aNbElem = aGaussCoord.GetNbElem();
TInt aDim = aGaussCoord.GetDim();
vtkIdType aNbCells = aNbElem*aNbGauss;
- aPoints.Init(aNbCells,aDim);
- for(TInt anElemId = 0, aCellId = 0; anElemId < aNbElem; anElemId++){
+ aCoords.Init(aNbCells,aDim);
+ for(TInt anElemId = 0, aNodeId = 0; anElemId < aNbElem; anElemId++){
TCoordSliceArr aCoordSliceArr = aGaussCoord.GetCoordSliceArr(anElemId);
- for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++, aCellId++){
- TPointSlice aPointSlice = aPoints.GetPointSlice(aCellId);
- TCoordSlice aCoordSlice = aCoordSliceArr[aGaussId];
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++, aNodeId++){
+ VISU::TCoordSlice aSlice = aCoords.GetCoordSlice(aNodeId);
+ MED::TCoordSlice aCoordSlice = aCoordSliceArr[aGaussId];
for(TInt aDimId = 0; aDimId < aDim; aDimId++)
- aPointSlice[aDimId] = aCoordSlice[aDimId];
+ aSlice[aDimId] = aCoordSlice[aDimId];
}
}