X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH%2FSMESH_Mesh.cxx;h=2616e0b5f368b3b2c58b8d576a9590f7351ca54e;hp=0b171a6efbb293fddecff2e4c8f44059ca114d11;hb=1067ffa6e7e5c394e3a1b17219d8b355a57607cd;hpb=e6fb82fec115653b65edff9f5155d4e39bc13c6a diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index 0b171a6ef..2616e0b5f 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -347,16 +347,32 @@ void SMESH_Mesh::Load() void SMESH_Mesh::Clear() { - // clear mesh data - _myMeshDS->ClearMesh(); + if ( HasShapeToMesh() ) // remove all nodes and elements + { + // clear mesh data + _myMeshDS->ClearMesh(); - // update compute state of submeshes - if ( SMESH_subMesh *sm = GetSubMeshContaining( GetShapeToMesh() ) ) + // update compute state of submeshes + if ( SMESH_subMesh *sm = GetSubMeshContaining( GetShapeToMesh() ) ) + { + sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); + sm->ComputeSubMeshStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); + sm->ComputeStateEngine( SMESH_subMesh::CLEAN ); // for event listeners (issue 0020918) + sm->ComputeSubMeshStateEngine( SMESH_subMesh::CLEAN ); + } + } + else // remove only nodes/elements computed by algorithms { - sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); - sm->ComputeSubMeshStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); - sm->ComputeStateEngine( SMESH_subMesh::CLEAN ); // for event listeners (issue 0020918) - sm->ComputeSubMeshStateEngine( SMESH_subMesh::CLEAN ); + if ( SMESH_subMesh *sm = GetSubMeshContaining( GetShapeToMesh() ) ) + { + SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true, + /*complexShapeFirst=*/true); + while ( smIt->more() ) + { + sm = smIt->next(); + sm->ComputeStateEngine( SMESH_subMesh::CLEAN ); + } + } } _isModified = false; } @@ -545,11 +561,13 @@ int SMESH_Mesh::CGNSToMesh(const char* theFileName, */ //================================================================================ -SMESH_ComputeErrorPtr SMESH_Mesh::GMFToMesh(const char* theFileName) +SMESH_ComputeErrorPtr SMESH_Mesh::GMFToMesh(const char* theFileName, + bool theMakeRequiredGroups) { DriverGMF_Read myReader; myReader.SetMesh(_myMeshDS); myReader.SetFile(theFileName); + myReader.SetMakeRequiredGroups( theMakeRequiredGroups ); myReader.Perform(); //theMeshName = myReader.GetMeshName(); @@ -1419,11 +1437,14 @@ void SMESH_Mesh::ExportCGNS(const char * file, //================================================================================ void SMESH_Mesh::ExportGMF(const char * file, - const SMESHDS_Mesh* meshDS) + const SMESHDS_Mesh* meshDS, + bool withRequiredGroups) { DriverGMF_Write myWriter; myWriter.SetFile( file ); myWriter.SetMesh( const_cast( meshDS )); + myWriter.SetExportRequiredGroups( withRequiredGroups ); + myWriter.Perform(); } @@ -1999,7 +2020,9 @@ void SMESH_Mesh::fillAncestorsMap(const TopoDS_Shape& theShape) { // a geom group is added. Insert it into lists of ancestors before // the first ancestor more complex than group members - int memberType = TopoDS_Iterator( theShape ).Value().ShapeType(); + TopoDS_Iterator subIt( theShape ); + if ( !subIt.More() ) return; + int memberType = subIt.Value().ShapeType(); for ( desType = TopAbs_VERTEX; desType >= memberType; desType-- ) for (TopExp_Explorer des( theShape, TopAbs_ShapeEnum( desType )); des.More(); des.Next()) {