]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To generalize implementation of direct passing MED node coordinates to VTK (for Gauss...
authorapo <apo@opencascade.com>
Thu, 28 Dec 2006 06:52:32 +0000 (06:52 +0000)
committerapo <apo@opencascade.com>
Thu, 28 Dec 2006 06:52:32 +0000 (06:52 +0000)
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx

index fe77253dfc190e506729f2bc4111ed29a272665e..f632a6f12aac1dde346dadf4c4f8a7046923e0f1 100644 (file)
@@ -308,6 +308,31 @@ namespace VISU
   TPointCoords
   ::GetPoints() const
   { 
+    if(!myIsVTKDone){
+      vtkIdType aNbPoints = GetNbPoints();
+      vtkIdType aDim = GetDim();
+
+      INITMSG(MYDEBUG,"TPointCoords::GetPoints - aNbPoints = "<<aNbPoints<<
+             "; aDim = "<<aDim<<
+             endl);
+      
+      if(GetDim() == 3){
+       SetVoidArray();
+      }else{
+       for(vtkIdType aPointId = 0; aPointId < aNbPoints; aPointId++){
+         TCCoordSlice aSlice = GetCoordSlice(aPointId);
+      
+         vtkFloatingPointType aCoords[3] = {0.0, 0.0, 0.0};
+         for(vtkIdType aDimId = 0; aDimId < aDim; aDimId++)
+           aCoords[aDimId] = aSlice[aDimId];
+
+         myPoints->SetPoint(aPointId, aCoords);
+       }
+      }
+      
+      myIsVTKDone = true;
+    }
+    
     return myPoints.GetPointer();
   }
 
@@ -1939,7 +1964,6 @@ namespace
   {
     const TPointCoords& aCoords = theGaussSubMesh->myPointCoords;
     vtkIdType aNbPoints = aCoords.GetNbPoints();
-    vtkIdType aDim = aCoords.GetDim();
     
     vtkIdType aNbCells = theGaussSubMesh->myNbCells;
     vtkIdType aCellsSize = theGaussSubMesh->myCellsSize;
@@ -1950,19 +1974,10 @@ namespace
     aCellTypesArray->SetNumberOfComponents(1);
     aCellTypesArray->SetNumberOfTuples(aNbCells);
     
-    vtkPoints* aPoints = aCoords.GetPoints();
     vtkIdList *anIdList = vtkIdList::New();
     anIdList->SetNumberOfIds(1);
     for(vtkIdType aPointId = 0; aPointId < aNbPoints; aPointId++){
-      TCCoordSlice aSlice = aCoords.GetCoordSlice(aPointId);
-      
-      vtkFloatingPointType aCoords[3] = {0.0, 0.0, 0.0};
-      for(vtkIdType aDimId = 0; aDimId < aDim; aDimId++)
-       aCoords[aDimId] = aSlice[aDimId];
-      
-      aPoints->SetPoint(aPointId, aCoords);
-      
-      anIdList->SetId(0,aPointId);
+      anIdList->SetId(0, aPointId);
       aConnectivity->InsertNextCell(anIdList);
       aCellTypesArray->SetValue(aPointId, (unsigned char)VTK_VERTEX);
     }
@@ -1979,7 +1994,7 @@ namespace
     
     const TVTKSource& aSource = theGaussSubMesh->GetSource();
     aSource->SetCells(aCellTypesArray, aCellLocationsArray, aConnectivity);
-    aSource->SetPoints(aPoints);
+    aSource->SetPoints(aCoords.GetPoints());
     
     aCellLocationsArray->Delete();
     aCellTypesArray->Delete();
index 53b1b5048ec6606b1a60c573f5d75aed28e608de..c427897039889975ef1c4cedfa1671c534482fd9 100644 (file)
@@ -286,7 +286,7 @@ namespace VISU
 
   //---------------------------------------------------------------
   //! This class is responsible for representation of mesh nodes
-  class TPointCoords: public virtual TBaseStructure
+  class TPointCoords: public virtual TIsVTKDone
   {
   protected:
     //! An container for coordinates of the nodes
@@ -339,8 +339,7 @@ namespace VISU
     In additition to its base functionlity it support mapping of VTK to object numeration and
     keeps names for each of nodes.
   */
-  class TNamedPointCoords: public virtual TPointCoords,
-                          public virtual TIsVTKDone
+  class TNamedPointCoords: public virtual TPointCoords
   {
   protected:
     typedef TVector<std::string> TPointsDim;