From 93ac2e89649b6c9fdeaa40f2e46aa3408a678d51 Mon Sep 17 00:00:00 2001 From: eap Date: Mon, 20 Jan 2020 18:57:12 +0300 Subject: [PATCH] fix update of sub-meshes on group in checkGeomModif() + 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 | 20 +++++++++++++++++++- src/SMESH_I/SMESH_Mesh_i.cxx | 8 ++++---- src/SMESH_I/SMESH_Mesh_i.hxx | 8 +++++++- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 334fc10ee..41588902e 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -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" )) { diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index 57daad4a6..b0d14f8bb 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -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::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 diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index 535931d93..388a04587 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -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); }; -- 2.30.2