From: apo Date: Wed, 31 Aug 2005 11:48:09 +0000 (+0000) Subject: To introduce ID's mapping for Family mesh X-Git-Tag: BR-D5-38-2003_D2005-12-09~59 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=381d83be9eeb615a92b4a5b902dec5ba83009727;p=modules%2Fvisu.git To introduce ID's mapping for Family mesh --- diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index 4bf49421..cd0f1599 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -405,6 +405,37 @@ namespace VISU } + //--------------------------------------------------------------- + vtkCell* + TFamilyImpl + ::GetElemCell(int theObjID) + { + vtkIdType aVtkID = GetElemVTKID(theObjID); + return GetSource()->GetCell(aVtkID); + } + + vtkIdType + TFamilyImpl + ::GetElemVTKID(vtkIdType theID) const + { + if(myElemObj2VTKID.empty()) + return theID; + else{ + TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID); + if(anIter != myElemObj2VTKID.end()) + return anIter->second; + } + return -1; + } + + vtkIdType + TFamilyImpl + ::GetElemObjID(vtkIdType theID) const + { + return myMeshID[theID]; + } + + //--------------------------------------------------------------- TNbASizeCells TGroupImpl @@ -794,6 +825,11 @@ namespace aCellTypesArray->SetNumberOfComponents(1); aCellTypesArray->SetNumberOfTuples(aNbCells); + TSubMeshID& aMeshID = theFamily->myMeshID; + aMeshID.resize(aNbCells); + + VISU::TID2ID& anElemObj2VTKID = theFamily->myElemObj2VTKID; + const VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh; VISU::TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.begin(); for(vtkIdType i = 0, j = 0; anIter != aGeom2SubMesh.end(); anIter++){ @@ -817,8 +853,12 @@ namespace VISU::TSubMeshID::const_iterator aSubMeshIDIter = aSubMeshID.begin(); for(; aSubMeshIDIter != aSubMeshID.end(); aSubMeshIDIter++, i++){ - PrintCells(i,aConnectivity,anArray[*aSubMeshIDIter]); + vtkIdType anID = *aSubMeshIDIter; + PrintCells(i,aConnectivity,anArray[anID]); aCellTypesArray->SetValue(j++,(unsigned char)aGeom); + + anElemObj2VTKID[anID] = i; + aMeshID[i] = anID; } } vtkIdType *pts = 0, npts = 0; diff --git a/src/CONVERTOR/VISU_Convertor_impl.hxx b/src/CONVERTOR/VISU_Convertor_impl.hxx index feb422a0..51f65ff0 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -323,6 +323,21 @@ namespace VISU struct TFamilyImpl: virtual TFamily, virtual TSource { + virtual + vtkCell* + GetElemCell(int theObjID); + + virtual + vtkIdType + GetElemVTKID(vtkIdType theID) const; + + virtual + vtkIdType + GetElemObjID(vtkIdType theID) const; + + TID2ID myElemObj2VTKID; + TSubMeshID myMeshID; + TGeom2SubMeshID myGeom2SubMeshID; }; typedef SharedPtr PFamilyImpl;