From: apo Date: Thu, 28 Jul 2005 05:11:36 +0000 (+0000) Subject: To introduce new way of points coordinates handling - special structures TPointCoords... X-Git-Tag: BR-D5-38-2003_D2005-12-09~148 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4f46252442db2a9c7430d5e053ee957f6db436b7;p=modules%2Fvisu.git To introduce new way of points coordinates handling - special structures TPointCoords and TNamedPointCoords are designed and used in TMesh and TGaussMesh structures respectively Also, corresponding Gauss Points structures will be created only when there is a corresponding MED::GaussInfo for the TimeStampInfo --- diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index 4a900234..c48b9233 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -270,9 +270,6 @@ namespace 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()){ @@ -280,30 +277,28 @@ namespace 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; @@ -714,7 +709,7 @@ VISU_MedConvertor 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){ @@ -831,52 +826,64 @@ VISU_MedConvertor 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 = "<myIsMEDDone = "<myIsMEDDone<< + "; theFamilyName = '"<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; } @@ -1185,18 +1192,18 @@ LoadGaussMesh(const MED::PWrapper& theMed, 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]; } } diff --git a/src/CONVERTOR/VISU_MedConvertor.hxx b/src/CONVERTOR/VISU_MedConvertor.hxx index 557e1b24..ffa3c24c 100644 --- a/src/CONVERTOR/VISU_MedConvertor.hxx +++ b/src/CONVERTOR/VISU_MedConvertor.hxx @@ -15,8 +15,8 @@ #include -namespace VISU{ - +namespace VISU +{ //--------------------------------------------------------------- struct TIsMEDDone: virtual TBaseStructure { @@ -28,7 +28,7 @@ namespace VISU{ //--------------------------------------------------------------- - struct TMEDMesh: virtual TMeshImpl + struct TMEDMesh: virtual TMeshImpl, virtual TIsMEDDone { MED::PMeshInfo myMeshInfo; MED::TEntityInfo myEntityInfo; @@ -79,7 +79,7 @@ namespace VISU{ //--------------------------------------------------------------- - struct TMEDFamily: virtual TFamilyImpl + struct TMEDFamily: virtual TFamilyImpl, virtual TIsMEDDone {}; typedef SharedPtr PMEDFamily;