Salome HOME
Regression of doc/salome/examples/transforming_meshes_ex10.py
[modules/smesh.git] / src / SMDS / SMDS_UnstructuredGrid.cxx
index e32eb798c36abd87b71863c4853e9a88eb889048..bf9df36cffc1c1c80eb5fa3b3fde23e680f301a0 100644 (file)
@@ -125,9 +125,9 @@ SMDS_UnstructuredGrid::~SMDS_UnstructuredGrid()
 {
 }
 
-unsigned long SMDS_UnstructuredGrid::GetMTime()
+vtkMTimeType SMDS_UnstructuredGrid::GetMTime()
 {
-  unsigned long mtime = vtkUnstructuredGrid::GetMTime();
+  vtkMTimeType mtime = vtkUnstructuredGrid::GetMTime();
   return mtime;
 }
 
@@ -139,10 +139,12 @@ vtkPoints* SMDS_UnstructuredGrid::GetPoints()
 
 int SMDS_UnstructuredGrid::InsertNextLinkedCell(int type, int npts, vtkIdType *pts)
 {
-  if ( !this->Links )
-    BuildLinks();
+  if ( !this->Links ) // don't create Links until they are needed
+  {
+    return this->InsertNextCell(type, npts, pts);
+  }
 
-  if (type != VTK_POLYHEDRON)
+  if ( type != VTK_POLYHEDRON )
     return vtkUnstructuredGrid::InsertNextLinkedCell(type, npts, pts);
 
   // --- type = VTK_POLYHEDRON
@@ -187,13 +189,14 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
 
   // --- if newNodeSize, create a new compacted vtkPoints
 
-  vtkPoints *newPoints = vtkPoints::New();
-  newPoints->SetDataType(VTK_DOUBLE);
-  newPoints->SetNumberOfPoints(newNodeSize);
-  if (newNodeSize)
+  if ( newNodeSize )
   {
     // rnv: to fix bug "21125: EDF 1233 SMESH: Degradation of precision in a test case for quadratic conversion"
     // using double type for storing coordinates of nodes instead float.
+    vtkPoints *newPoints = vtkPoints::New();
+    newPoints->SetDataType(VTK_DOUBLE);
+    newPoints->SetNumberOfPoints(newNodeSize);
+
     int oldNodeSize = idNodesOldToNew.size();
 
     int i = 0;
@@ -209,21 +212,16 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
       int endBloc = i;
       copyNodes(newPoints, idNodesOldToNew, alreadyCopied, startBloc, endBloc);
     }
-    newPoints->Squeeze();
-  }
-
-  if (1/*newNodeSize*/)
-  {
     this->SetPoints(newPoints);
+    newPoints->Delete();
   }
-  newPoints->Delete();
-
+  this->Points->Squeeze();
 
   // --- create new compacted Connectivity, Locations and Types
 
   int oldCellSize = this->Types->GetNumberOfTuples();
 
-  if ( oldCellSize == newCellSize ) // no holes in elements
+  if ( !newNodeSize && oldCellSize == newCellSize ) // no holes in elements
   {
     this->Connectivity->Squeeze();
     this->Locations->Squeeze();