Salome HOME
creating_meshes_ex02.py test is now OK
[modules/smesh.git] / src / SMDS / SMDS_UnstructuredGrid.cxx
index 0a928ad11a5510f0bc2727a21ef37eec8a71c577..e06cf3ba2ca20b4b94634662f4fcf245ffd87049 100644 (file)
@@ -320,12 +320,14 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
     newFaceLocations->Squeeze();
     newFaces->Squeeze();
     this->SetCells( newTypes, newLocations, newConnectivity, newFaceLocations, newFaces );
+    this->CellLocations = newLocations;
     newFaceLocations->Delete();
     newFaces->Delete();
   }
   else
   {
     this->SetCells( newTypes, newLocations, newConnectivity, FaceLocations, Faces );
+    this->CellLocations = newLocations;
   }
 
   newTypes->Delete();
@@ -360,10 +362,11 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray *  newTypes,
   {
     int iOld = idCellsNewToOld[ iNew ];
     newTypes->SetValue( iNew, this->Types->GetValue( iOld ));
-    vtkIdType oldLoc = this->CellLocations->GetValue( iOld );
+
+    vtkIdType oldLoc = ((vtkIdTypeArray *)(this->Connectivity->GetOffsetsArray()))->GetValue( iOld );
     vtkIdType nbpts;
     vtkIdType const *oldPtsCell(nullptr);
-    this->Connectivity->GetCell( oldLoc, nbpts, oldPtsCell );
+    this->Connectivity->GetCell( oldLoc+iOld, nbpts, oldPtsCell );
     if ((vtkIdType) pointsCell.size() < nbpts )
       pointsCell.resize( nbpts );
     for ( int l = 0; l < nbpts; l++ )