Salome HOME
Fix regressions
[modules/smesh.git] / src / OBJECT / SMESH_Object.cxx
index 61b36a78c706f0b5270700ee4678bd80994a9b19..a1a69ff3fc4e4df79c066ceeaedf55cb468b1c94 100644 (file)
@@ -32,6 +32,8 @@
 #include "SMDS_Mesh.hxx"
 #include "SMDS_MeshCell.hxx"
 #include "SMDS_PolyhedralVolumeOfNodes.hxx"
+#include "SMESHDS_Mesh.hxx"
+#include "SMESHDS_Script.hxx"
 #include "SMESH_Actor.h"
 #include "SMESH_ControlsDef.hxx"
 
@@ -54,7 +56,7 @@
 #include <stdexcept>
 #include <set>
 
-#include "utilities.h"
+#include <utilities.h>
 
 using namespace std;
 
@@ -280,8 +282,11 @@ void SMESH_VisualObjDef::buildPrs(bool buildGrid)
     myLocalGrid = false;
     if (!GetMesh()->isCompacted())
     {
+      NulData(); // detach from the SMDS grid to allow immediate memory de-allocation in compactMesh()
       if ( MYDEBUG ) MESSAGE("*** buildPrs ==> compactMesh!");
       GetMesh()->compactMesh();
+      if ( SMESHDS_Mesh* m = dynamic_cast<SMESHDS_Mesh*>( GetMesh() )) // IPAL53915
+        m->GetScript()->SetModified(false); // drop IsModified set in compactMesh()
     }
     vtkUnstructuredGrid *theGrid = GetMesh()->getGrid();
     updateEntitiesFlags();
@@ -458,7 +463,7 @@ void SMESH_VisualObjDef::buildElemPrs()
 
         SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
         {
-          // Convertions connectivities from SMDS to VTK
+          // Convert connectivities from SMDS to VTK
 
           if (aType == SMDSAbs_Volume && anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
             anIdList->Reset();
@@ -570,7 +575,10 @@ vtkUnstructuredGrid* SMESH_VisualObjDef::GetUnstructuredGrid()
 {
   if ( !myLocalGrid && !GetMesh()->isCompacted() )
   {
+    NulData(); // detach from the SMDS grid to allow immediate memory de-allocation in compactMesh()
     GetMesh()->compactMesh();
+    if ( SMESHDS_Mesh* m = dynamic_cast<SMESHDS_Mesh*>( GetMesh() )) // IPAL53915
+      m->GetScript()->SetModified(false); // drop IsModified set in compactMesh()
     updateEntitiesFlags();
     vtkUnstructuredGrid *theGrid = GetMesh()->getGrid();
     myGrid->ShallowCopy(theGrid);
@@ -717,7 +725,7 @@ bool SMESH_MeshObj::NulData()
     points->SetNumberOfPoints(0);
     myEmptyGrid->SetPoints( points );
     points->Delete();
-    myEmptyGrid->BuildLinks();
+    //myEmptyGrid->BuildLinks();
   }
   myGrid->ShallowCopy(myEmptyGrid);
   return true;