]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To introduce ID's mapping for Family mesh
authorapo <apo@opencascade.com>
Wed, 31 Aug 2005 12:19:26 +0000 (12:19 +0000)
committerapo <apo@opencascade.com>
Wed, 31 Aug 2005 12:19:26 +0000 (12:19 +0000)
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx

index cd0f15999d949063aad4600e46b0900a0db22e43..0869c2830a3c89a63a35df132c5f5f11d54d5a0f 100644 (file)
@@ -371,6 +371,28 @@ namespace VISU
 
 
   //---------------------------------------------------------------
+  float*  
+  TMeshOnEntityImpl
+  ::GetNodeCoord(vtkIdType theObjID)
+  {
+    vtkIdType aVtkID = GetNodeVTKID(theObjID);
+    return GetFilter()->GetOutput()->GetPoint(aVtkID);
+  }
+
+  vtkIdType
+  TMeshOnEntityImpl
+  ::GetNodeVTKID(vtkIdType theID) const
+  {
+    return myNamedPointCoords->GetVTKID(theID);
+  }
+
+  vtkIdType
+  TMeshOnEntityImpl
+  ::GetNodeObjID(vtkIdType theID) const
+  {
+    return myNamedPointCoords->GetObjID(theID);
+  }
+
   vtkCell* 
   TMeshOnEntityImpl
   ::GetElemCell(int theObjID)
@@ -451,6 +473,39 @@ namespace VISU
     return make_pair(aNbCells,aCellsSize);
   }
   
+  vtkCell* 
+  TGroupImpl
+  ::GetElemCell(int theObjID)
+  {
+    vtkIdType aVtkID = GetElemVTKID(theObjID);
+    return GetFilter()->GetOutput()->GetCell(aVtkID);
+  }
+
+  vtkIdType
+  TGroupImpl
+  ::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
+  TGroupImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    vtkIdType anInputID;
+    const TVTKAppendFilter& anAppendFilter = GetFilter();
+    vtkIdType anID = anAppendFilter->GetCellInputID(theID,anInputID);
+    const PFamilyImpl& aFamily = myFamilyArr[anInputID];
+    return aFamily->GetElemObjID(anID);
+  }
+
   
   //---------------------------------------------------------------
   void
@@ -1492,6 +1547,8 @@ VISU_Convertor_impl
       aSource->SetPoints(GetPoints(aMesh));
       GetCellsOnFamily(aSource,aMeshOnEntity,aFamily);
 
+      aFamily->myNamedPointCoords = aMesh->myNamedPointCoords;
+
       aFamily->myIsVTKDone = true;
 
       if(MYDEBUGWITHFILES){
@@ -1544,14 +1601,26 @@ VISU_Convertor_impl
       const VISU::TFamilySet& aFamilySet = aGroup->myFamilySet;
       LoadMeshOnGroup(aMesh,aFamilySet);
 
-      TFamilySet::const_iterator aFamilyIter = aFamilySet.begin();
-      for(; aFamilyIter != aFamilySet.end(); aFamilyIter++){
-       PFamilyImpl aFamily = *aFamilyIter;
+      TFamilySet::const_iterator anIter = aFamilySet.begin();
+
+      TID2ID& anElemObj2VTKID = aGroup->myElemObj2VTKID;
+      TFamilyArr& aFamilyArr = aGroup->myFamilyArr;
+      aFamilyArr.resize(aFamilySet.size());
+
+      for(vtkIdType anID = 0; anIter != aFamilySet.end(); anIter++){
+       PFamilyImpl aFamily = *anIter;
        const std::string& aFamilyName = aFamily->myName;
        const VISU::TEntity& anEntity = aFamily->myEntity;
        TOutput* anOutput = GetFamilyOnEntity(theMeshName,anEntity,aFamilyName);
        anAppendFilter->AddInput(anOutput);
+
+       vtkIdType aNbCells = anOutput->GetNumberOfCells();
+       for(vtkIdType aCellID = 0; aCellID < aNbCells; aCellID++){
+         anElemObj2VTKID[aFamily->GetElemObjID(aCellID)] = aCellID;
+       }
+       aFamilyArr[anID] = aFamily;
       }
+      aGroup->myNamedPointCoords = aMesh->myNamedPointCoords;
 
       aGroup->myIsVTKDone = true;
 
index 51f65ff0ab39117f581845c5ac30daf136739a60..11c1fe878d2447064983c6a19b033220687530fb 100644 (file)
@@ -297,9 +297,21 @@ namespace VISU
 
   struct TMeshOnEntityImpl: virtual TMeshOnEntity, virtual TAppendFilter, virtual TSizeCounter
   {
+    virtual
+    float* 
+    GetNodeCoord(vtkIdType theObjID);
+
+    virtual 
+    vtkIdType 
+    GetNodeVTKID(vtkIdType theID) const;
+
+    virtual 
+    vtkIdType 
+    GetNodeObjID(vtkIdType theID) const;
+
     virtual
     vtkCell* 
-    GetElemCell(int theObjID);
+    GetElemCell(vtkIdType theID);
 
     virtual 
     vtkIdType 
@@ -335,6 +347,7 @@ namespace VISU
     vtkIdType 
     GetElemObjID(vtkIdType theID) const;
 
+    PNamedPointCoords myNamedPointCoords;
     TID2ID myElemObj2VTKID;
     TSubMeshID myMeshID;
 
@@ -345,11 +358,28 @@ namespace VISU
 
   //---------------------------------------------------------------
   typedef std::pair<vtkIdType,vtkIdType> TNbASizeCells;
+  typedef TVector<PFamilyImpl> TFamilyArr;
 
   struct TGroupImpl: virtual TGroup, virtual TAppendFilter
   {
     TNbASizeCells 
     GetNbASizeCells() const;
+
+    virtual
+    vtkCell* 
+    GetElemCell(int theObjID);
+
+    virtual 
+    vtkIdType 
+    GetElemVTKID(vtkIdType theID) const;
+
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
+
+    TID2ID myElemObj2VTKID;
+    TFamilyArr myFamilyArr;
+    PNamedPointCoords myNamedPointCoords;
   };
   typedef SharedPtr<TGroupImpl> PGroupImpl;