Salome HOME
Copyright update 2021
[modules/smesh.git] / src / OBJECT / SMESH_Object.cxx
index 3f64bf4abc6d3ace5af52b849b606ef11f5686c2..af6410d1792d3864aede72d9e4cfccb9f8eecb79 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -472,7 +472,8 @@ void SMESH_VisualObjDef::buildElemPrs()
   SMDS_Mesh::CheckMemory(); // PAL16631
 
   aConnectivity->InitTraversal();
-  for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
+  vtkIdType const *pts(nullptr);
+  for( vtkIdType idType = 0, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
     aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
 
   myGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
@@ -518,7 +519,8 @@ bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
 
 vtkUnstructuredGrid* SMESH_VisualObjDef::GetUnstructuredGrid()
 {
-  if ( !myLocalGrid && !GetMesh()->IsCompacted() )
+  if ( !myLocalGrid && ( !GetMesh()->IsCompacted() || // !IsCompacted() is needed ???
+                         GetMesh()->GetGrid()->GetMTime() > myGrid->GetMTime() ))
   {
     NulData(); // detach from the SMDS grid to allow immediate memory de-allocation in CompactMesh()
     GetMesh()->CompactMesh();