]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
fix update of sub-meshes on group in checkGeomModif()
authoreap <eap@opencascade.com>
Mon, 20 Jan 2020 15:57:12 +0000 (18:57 +0300)
committereap <eap@opencascade.com>
Mon, 20 Jan 2020 15:57:12 +0000 (18:57 +0300)
+ make SMESH_Mesh_i::_mainShapeTick persistent, which is needed for the case:
    - open a saved study with shaper data
    - edit an object in the shaper
    - switch to smesh ==> shape modification not detected

src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_Mesh_i.hxx

index 334fc10eee228bf505bc722991527950f77a25e0..41588902e8581a29114a4f910021ce65efc9a301 100644 (file)
@@ -4369,6 +4369,14 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
             aDataset->WriteOnDisk( &meshPersistentId );
             aDataset->CloseOnDisk();
 
+            // Store SMESH_Mesh_i::_mainShapeTick
+            int shapeTick = myImpl->MainShapeTick();
+            aSize[ 0 ] = 1;
+            aDataset = new HDFdataset( "shapeTick", aTopGroup, HDF_INT32, aSize, 1 );
+            aDataset->CreateOnDisk();
+            aDataset->WriteOnDisk( &shapeTick );
+            aDataset->CloseOnDisk();
+
             // write reference on a shape if exists
             SALOMEDS::SObject_wrap myRef;
             bool shapeRefFound = false;
@@ -5393,7 +5401,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
           }
 
           // issue 20918. Restore Persistent Id of SMESHDS_Mesh
-          if( aTopGroup->ExistInternalObject( "meshPersistentId" ) )
+          if ( aTopGroup->ExistInternalObject( "meshPersistentId" ) )
           {
             aDataset = new HDFdataset( "meshPersistentId", aTopGroup );
             aDataset->OpenOnDisk();
@@ -5405,6 +5413,16 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
             delete [] meshPersistentId;
           }
 
+          // Restore SMESH_Mesh_i::_mainShapeTick
+          if ( aTopGroup->ExistInternalObject( "shapeTick" ))
+          {
+            aDataset = new HDFdataset( "shapeTick", aTopGroup );
+            aDataset->OpenOnDisk();
+            int* shapeTick = & myNewMeshImpl->MainShapeTick();
+            aDataset->ReadFromDisk( shapeTick );
+            aDataset->CloseOnDisk();
+          }
+
           // Restore file info
           if ( aTopGroup->ExistInternalObject( "file info" ))
           {
index 57daad4a63b7e7071c79dfcbde4fd38bac270f46..b0d14f8bb4d6b4435beac2ba39b8113eec8eaba5 100644 (file)
@@ -2046,7 +2046,7 @@ void SMESH_Mesh_i::removeGeomGroupData(CORBA::Object_ptr theSmeshObj)
  */
 //================================================================================
 
-TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData)
+TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData, bool onlyIfChanged )
 {
   TopoDS_Shape newShape;
 
@@ -2066,7 +2066,7 @@ TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData)
     for ( CORBA::ULong i = 0; i < ids->length(); ++i )
       curIndices.insert( ids[i] );
 
-    if ( groupData._indices == curIndices )
+    if ( onlyIfChanged && groupData._indices == curIndices )
       return newShape; // group not changed
 
     // update data
@@ -2344,7 +2344,7 @@ void SMESH_Mesh_i::CheckGeomModif()
   std::list<TGeomGroupData>::iterator data = _geomGroupData.begin();
   for ( ; data != _geomGroupData.end(); ++data )
   {
-    TopoDS_Shape newShape = newGroupShape( *data );
+    TopoDS_Shape newShape = newGroupShape( *data, /*onlyIfChanged=*/false );
     if ( !newShape.IsNull() )
     {
       if ( meshDS->ShapeToIndex( newShape ) > 0 ) // a group reduced to one sub-shape
@@ -2527,7 +2527,7 @@ void SMESH_Mesh_i::CheckGeomGroupModif()
     bool processedGroup    = !it_new.second;
     TopoDS_Shape& newShape = it_new.first->second;
     if ( !processedGroup )
-      newShape = newGroupShape( *data );
+      newShape = newGroupShape( *data, /*onlyIfChanged=*/true );
     if ( newShape.IsNull() )
       continue; // no changes
 
index 535931d93ec465683d6d6edc7dc064e1bfcacd6a..388a04587675447ee8529b65c038646781fe2185 100644 (file)
@@ -623,6 +623,12 @@ public:
   std::string FileInfoToString();
   void FileInfoFromString(const std::string& info);
 
+  /*!
+   * Persistence of geometry tick
+   */
+  int& MainShapeTick() { return _mainShapeTick; }
+  
+
   /*!
    * Sets list of notebook variables used for Mesh operations separated by ":" symbol
    */
@@ -769,7 +775,7 @@ private:
   /*!
    * Return new group contents if it has been changed and update group data
    */
-  TopoDS_Shape newGroupShape( TGeomGroupData & groupData);
+  TopoDS_Shape newGroupShape( TGeomGroupData & groupData, bool onlyIfChanged);
 
 };