From: apo Date: Wed, 31 Aug 2005 09:47:21 +0000 (+0000) Subject: Minor changes X-Git-Tag: BR-D5-38-2003_D2005-12-09~61 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=14b7650fbe722f612a88c5784d2749d661c8caeb;p=modules%2Fvisu.git Minor changes --- diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index 0a7cdb97..a561d57f 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -115,6 +115,13 @@ namespace VISU return myFilter; } + TDataSet* + TAppendFilter + ::GetDataSet() const + { + return GetFilter()->GetOutput(); + } + //--------------------------------------------------------------- TPointCoords @@ -360,6 +367,22 @@ namespace VISU } + //--------------------------------------------------------------- + vtkIdType + TSubMeshImpl + ::GetElemVTKID(vtkIdType theID) const + { + return theID; + } + + vtkIdType + TSubMeshImpl + ::GetElemObjID(vtkIdType theID) const + { + return theID; + } + + //--------------------------------------------------------------- vtkIdType TMeshOnEntityImpl @@ -372,7 +395,11 @@ namespace VISU TMeshOnEntityImpl ::GetElemObjID(vtkIdType theID) const { - return theID; + vtkIdType anInputID; + const TVTKAppendFilter& anAppendFilter = GetFilter(); + vtkIdType aID = anAppendFilter->GetElemObjId(theID,anInputID); + const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputID]; + return aSubMesh->GetElemObjID(aID); } @@ -618,9 +645,8 @@ namespace //--------------------------------------------------------------- - void - GetPoints(const TVTKSource& theSource, - const PMeshImpl& theMesh) + vtkPoints* + GetPoints(const PMeshImpl& theMesh) { TVTKPoints& aPoints = theMesh->myPoints; const TNamedPointCoords& aCoords = theMesh->myNamedPointCoords; @@ -679,10 +705,11 @@ namespace } theMesh->myIsVTKDone = true; + if(MYVTKDEBUG) aPoints->DebugOn(); } - theSource->SetPoints(aPoints.GetPointer()); + return aPoints.GetPointer(); } @@ -704,13 +731,18 @@ namespace //--------------------------------------------------------------- void - GetCellsOnEntity(const TVTKSource& theSource, - const PMeshOnEntityImpl& theMeshOnEntity) + GetCellsOnSubMesh(const TVTKSource& theSource, + const PSubMeshImpl& theSubMesh, + const vtkIdType theGeom) { - INITMSG(MYDEBUG,"GetCellsOnEntity"<myCell2Connect; + vtkIdType aCellsSize = theSubMesh->myCellsSize; + vtkIdType aNbCells = theSubMesh->myNbCells; + INITMSG(MYDEBUG,"GetCellsOnSubMesh "<< + "- theGeom = "<GetNumberOfPoints()<GetNumberOfCells()<GetFilter(); if(theProfile->myIsAll){ - const TVTKSource& aSource = theMeshOnEntity->GetSource(); - anAppendFilter->AddInput(aSource.GetPointer()); + TDataSet* aDataSet = theMeshOnEntity->GetDataSet(); + anAppendFilter->AddInput(aDataSet); }else{ const TGeom2SubProfile& aGeom2SubProfile = theProfile->myGeom2SubProfile; + TSubProfileArr& aSubProfileArr = theProfile->mySubProfileArr; + aSubProfileArr.resize(aGeom2SubProfile.size()); TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin(); - for(; anIter != aGeom2SubProfile.end(); anIter++){ + for(vtkIdType anID = 0; anIter != aGeom2SubProfile.end(); anIter++, anID++){ PSubProfileImpl aSubProfile = anIter->second; if(aSubProfile->myStatus == eRemoveAll) continue; @@ -1046,6 +1071,8 @@ namespace const TVTKSource& aSource = aSubProfile->GetSource(); anAppendFilter->AddInput(aSource.GetPointer()); + + aSubProfileArr[anID] = aSubProfile; } } anAppendFilter->Update(); // Fix on VTK @@ -1329,21 +1356,33 @@ VISU_Convertor_impl //Cheching possibility do the query TFindMeshOnEntity aFindMeshOnEntity = FindMeshOnEntity(theMeshName,theEntity); - + PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);; PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity); - + //Main part of code - const TVTKSource& aSource = aMeshOnEntity->GetSource(); + const TVTKAppendFilter& anAppendFilter = aMeshOnEntity->GetFilter(); #ifndef _DEXCEPT_ try{ #endif if(!aMeshOnEntity->myIsVTKDone){ - if(MYVTKDEBUG) aSource->DebugOn(); + if(MYVTKDEBUG) anAppendFilter->DebugOn(); LoadMeshOnEntity(aMesh,aMeshOnEntity); - GetPoints(aSource,aMesh); - GetCellsOnEntity(aSource,aMeshOnEntity); + + const TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh; + TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.begin(); + TSubMeshArr& aSubMeshArr = aMeshOnEntity->mySubMeshArr; + aSubMeshArr.resize(aGeom2SubMesh.size()); + for(vtkIdType anID = 0; anIter != aGeom2SubMesh.end(); anIter++, anID++){ + const vtkIdType& aGeom = anIter->first; + PSubMeshImpl aSubMesh = anIter->second; + const TVTKSource& aSource = aSubMesh->GetSource(); + aSource->SetPoints(GetPoints(aMesh)); + GetCellsOnSubMesh(aSource,aSubMesh,aGeom); + anAppendFilter->AddInput(aSource.GetPointer()); + aSubMeshArr[anID] = aSubMesh; + } aMeshOnEntity->myIsVTKDone = true; @@ -1351,13 +1390,13 @@ VISU_Convertor_impl std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1(); std::string aFileName = string(getenv("HOME"))+"/"+getenv("USER")+"-"; aFileName += aMeshName + dtos("-%d-",int(theEntity)) + "-Conv.vtk"; - VISU::WriteToFile(aSource.GetPointer(),aFileName); + VISU::WriteToFile(anAppendFilter->GetOutput(),aFileName); } } if(MYVTKDEBUG){ GetMeshOnEntitySize(theMeshName,theEntity); - PrintMemorySize(aSource.GetPointer()); + PrintMemorySize(anAppendFilter->GetOutput()); } #ifndef _DEXCEPT_ @@ -1366,7 +1405,7 @@ VISU_Convertor_impl } #endif - return aSource.GetPointer(); + return anAppendFilter->GetOutput(); } @@ -1402,7 +1441,7 @@ VISU_Convertor_impl GetMeshOnEntity(theMeshName,theEntity); LoadFamilyOnEntity(aMesh,aMeshOnEntity,aFamily); - GetPoints(aSource,aMesh); + aSource->SetPoints(GetPoints(aMesh)); GetCellsOnFamily(aSource,aMeshOnEntity,aFamily); aFamily->myIsVTKDone = true; diff --git a/src/CONVERTOR/VISU_Convertor_impl.hxx b/src/CONVERTOR/VISU_Convertor_impl.hxx index 15c4bb1c..a655fdbc 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -30,8 +30,10 @@ namespace VISU using MED::TCSlice; using MED::TSlice; + typedef vtkUnstructuredGrid TDataSet; + typedef vtkSmartPointer TVTKSource; + typedef vtkSmartPointer TVTKPoints; - typedef vtkSmartPointer TVTKSource; typedef vtkSmartPointer TVTKAppendFilter; typedef float TCoord; @@ -74,6 +76,9 @@ namespace VISU const TVTKAppendFilter& GetFilter() const; + + TDataSet* + GetDataSet() const; }; @@ -281,17 +286,24 @@ namespace VISU struct TSubMeshImpl: virtual TSource { TCell2Connect myCell2Connect; + + virtual + vtkIdType + GetElemVTKID(vtkIdType theID) const; + + virtual + vtkIdType + GetElemObjID(vtkIdType theID) const; }; typedef SharedPtr PSubMeshImpl; //--------------------------------------------------------------- typedef std::map TGeom2SubMesh; + typedef TVector TSubMeshArr; - struct TMeshOnEntityImpl: virtual TMeshOnEntity, virtual TSource + struct TMeshOnEntityImpl: virtual TMeshOnEntity, virtual TAppendFilter, virtual TSizeCounter { - TGeom2SubMesh myGeom2SubMesh; - virtual vtkIdType GetElemVTKID(vtkIdType theID) const; @@ -300,7 +312,8 @@ namespace VISU vtkIdType GetElemObjID(vtkIdType theID) const; - TObj2VTKID myObj2VTKID; + TSubMeshArr mySubMeshArr; + TGeom2SubMesh myGeom2SubMesh; }; typedef SharedPtr PMeshOnEntityImpl; diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index 5fc96d78..f0c24e98 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -243,15 +243,7 @@ namespace vtkIdType aVGeom = aSubProfile->myGeom; aGeom2SubProfile[aVGeom] = aSubProfile; } - { - TSubProfileArr& aSubProfileArr = aProfile->mySubProfileArr; - aSubProfileArr.resize(aGeom2SubProfile.size()); - TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin(); - for(TInt anID = 0; anIter != aGeom2SubProfile.end(); anIter++, anID++){ - const PSubProfileImpl& aSubProfile = anIter->second; - aSubProfileArr[anID] = aSubProfile; - } - } + aProfileMap[aProfileKey] = aProfile; theValForTime.myProfile = aProfile; } @@ -634,10 +626,10 @@ namespace const MED::TFamilyTSize& aFamilyTSize = *aFamilyTSizeSetIter; const MED::PFamilyInfo& aFamilyInfo = boost::get<0>(aFamilyTSize); TInt aSize = boost::get<1>(aFamilyTSize); - if(aFamilyInfo->GetId() == 0) + TInt anId = aFamilyInfo->GetId(); + if(anId == 0) continue; - TInt anId = aFamilyInfo->GetId(); std::string aFamilyName = aFamilyInfo->GetName(); PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily()); @@ -693,7 +685,7 @@ namespace MED::TFamilyInfoSet::const_iterator aFamilyIter = aFamilyInfoSet.begin(); for(; aFamilyIter != aFamilyInfoSet.end(); aFamilyIter++){ const MED::PFamilyInfo& aFamilyInfo = *aFamilyIter; - const std::string& aFamilyName = aFamilyInfo->GetName(); + std::string aFamilyName = aFamilyInfo->GetName(); TEntity aVEntity = TEntity(-1); PMEDFamily aFamily; @@ -757,6 +749,33 @@ namespace return TGaussPointID(aCellID,aLocalPntID); } + + //--------------------------------------------------------------- + vtkIdType + TMEDSubMesh + ::GetElemObjID(vtkIdType theID) const + { + if(myIsElemNum) + return myElemNum[theID]; + else + return TSubMeshImpl::GetElemObjID(theID); + } + + vtkIdType + TMEDSubMesh + ::GetElemVTKID(vtkIdType theID) const + { + if(myIsElemNum){ + MED::TElemNum::const_iterator anIter = + std::find(myElemNum.begin(),myElemNum.end(),theID); + if(anIter != myElemNum.end()) + return *anIter; + else + return -1; + }else + return TSubMeshImpl::GetElemVTKID(theID); + } + } @@ -1015,7 +1034,19 @@ VISU_MedConvertor aSubMesh->myIsElemNum = aNodeInfo->IsElemNum(); aSubMesh->myElemNum = aNodeInfo->myElemNum; + aSubMesh->myNbCells = theMesh->myNbPoints; + aSubMesh->myCellsSize = 2*theMesh->myNbPoints; + { + TSubMeshArr& aSubMeshArr = aMeshOnEntity->mySubMeshArr; + aSubMeshArr.resize(aGeom2SubMesh.size()); + TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.begin(); + for(TInt anID = 0; anIter != aGeom2SubMesh.end(); anIter++, anID++){ + const PSubMeshImpl& aSubMesh = anIter->second; + aSubMeshArr[anID] = aSubMesh; + } + } + TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; aCell2Connect.resize(aNbElem); for (int iElem = 0; iElem < aNbElem; iElem++) @@ -1123,6 +1154,7 @@ VISU_MedConvertor aSubMesh->myIsElemNum = aPolygoneInfo->IsElemNum(); aSubMesh->myElemNum = aPolygoneInfo->myElemNum; + aSubMesh->myNbCells = aNbElem; TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; aCell2Connect.resize(aNbElem); @@ -1130,6 +1162,7 @@ VISU_MedConvertor for(TInt iElem = 0; iElem < aNbElem; iElem++) { MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem); TInt aNbConn = aPolygoneInfo->GetNbConn(iElem); + aSubMesh->myCellsSize += aNbConn; TConnect& anArray = aCell2Connect[iElem]; anArray.resize(aNbConn); for(TInt iConn = 0; iConn < aNbConn; iConn++) @@ -1147,6 +1180,7 @@ VISU_MedConvertor aSubMesh->myIsElemNum = aPolyedreInfo->IsElemNum(); aSubMesh->myElemNum = aPolyedreInfo->myElemNum; + aSubMesh->myNbCells = aNbElem; TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; aCell2Connect.resize(aNbElem); @@ -1160,6 +1194,7 @@ VISU_MedConvertor for(TInt iFace = 0; iFace < aNbFaces; iFace++){ MED::TCConnSlice aConnSlice = aConnSliceArr[iFace]; TInt aNbConn = aConnSlice.size(); + aSubMesh->myCellsSize += aNbConn; for(TInt iConn = 0; iConn < aNbConn; iConn++){ aConnectSet.insert(aConnSlice[iConn]); } @@ -1178,7 +1213,7 @@ VISU_MedConvertor break; } default: { - int aVNbNodes = VTKGeom2NbNodes(aVGeom); + TInt aVNbNodes = VTKGeom2NbNodes(aVGeom); MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom); TInt aNbElem = aCellInfo->GetNbElem(); @@ -1188,6 +1223,8 @@ VISU_MedConvertor aSubMesh->myIsElemNum = aCellInfo->IsElemNum(); aSubMesh->myElemNum = aCellInfo->myElemNum; + aSubMesh->myNbCells = aNbElem; + aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1); TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; aCell2Connect.resize(aNbElem); diff --git a/src/CONVERTOR/VISU_MedConvertor.hxx b/src/CONVERTOR/VISU_MedConvertor.hxx index 3ae1891f..74aabc04 100644 --- a/src/CONVERTOR/VISU_MedConvertor.hxx +++ b/src/CONVERTOR/VISU_MedConvertor.hxx @@ -32,6 +32,10 @@ namespace VISU { MED::EGeometrieElement myMGeom; + TMEDSubProfile(): + myIsElemNum(MED::eFAUX) + {} + MED::EBooleen myIsElemNum; MED::TElemNum myElemNum; @@ -59,6 +63,10 @@ namespace VISU //--------------------------------------------------------------- struct TMEDGaussSubMesh: virtual TGaussSubMeshImpl { + TMEDGaussSubMesh(): + myIsElemNum(MED::eFAUX) + {} + MED::EBooleen myIsElemNum; MED::TElemNum myElemNum; @@ -78,8 +86,20 @@ namespace VISU //--------------------------------------------------------------- struct TMEDSubMesh: virtual TSubMeshImpl { + TMEDSubMesh(): + myIsElemNum(MED::eFAUX) + {} + MED::EBooleen myIsElemNum; MED::TElemNum myElemNum; + + virtual + vtkIdType + GetElemVTKID(vtkIdType theID) const; + + virtual + vtkIdType + GetElemObjID(vtkIdType theID) const; }; typedef SharedPtr PMEDSubMesh;