Salome HOME
PR: adjust points number
[modules/smesh.git] / src / SMDS / SMDS_Mesh.cxx
index f5d44ed8a4164be03e08c6dbe2ad1a4fc33041e7..1fbe8d3242dfeed12b3baa2fd118fe8fd394c99e 100644 (file)
@@ -39,6 +39,7 @@
 #include "SMDS_SpacePosition.hxx"
 
 #include <vtkUnstructuredGrid.h>
+#include <vtkUnsignedCharArray.h>
 
 #include <algorithm>
 #include <map>
@@ -2783,7 +2784,7 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement *        elem,
 void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
 {
   int elemId = elem->GetID();
-  //MESSAGE("SMDS_Mesh::RemoveFreeElement " << elemId);
+  MESSAGE("SMDS_Mesh::RemoveFreeElement " << elemId);
   SMDSAbs_ElementType aType = elem->GetType();
   SMDS_MeshElement* todest = (SMDS_MeshElement*)(elem);
   if (aType == SMDSAbs_Node) {
@@ -2801,6 +2802,8 @@ void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
       // this methods is only for meshes without descendants
       return;
 
+    int vtkid = this->fromSmdsToVtk(elemId);
+
     // Remove element from <InverseElements> of its nodes
     SMDS_ElemIteratorPtr itn = elem->nodesIterator();
     while (itn->more()) {
@@ -2835,6 +2838,9 @@ void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
       break;
     }
     myElementIDFactory->ReleaseID(elemId);
+
+    this->myGrid->GetCellTypesArray()->SetValue(vtkid, VTK_EMPTY_CELL);
+    // --- to do: keep vtkid in a list of reusable cells
   }
 }
 
@@ -3582,3 +3588,9 @@ void SMDS_Mesh::incrementCellsCapacity(int nbCells)
   MESSAGE(" ------------------- resize myCells " << val << " --> " << val + nbCells);
   myNodes.resize(val +nbCells, 0);
 }
+
+void SMDS_Mesh::adjustStructure()
+{
+  myGrid->GetPoints()->GetData()->SetNumberOfTuples(myNodeIDFactory->GetMaxID()+1);
+}
+