From: eap Date: Mon, 19 Nov 2012 12:58:43 +0000 (+0000) Subject: 0021985: [CEA 715] "Clear mesh data" on a skin mesh without geometry does not preserv... X-Git-Tag: V6_6_0rc1~32 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8ae4d1e9ae7ea9a5ba234601114ba08e76bc5aea;p=modules%2Fsmesh.git 0021985: [CEA 715] "Clear mesh data" on a skin mesh without geometry does not preserve the skin mesh New behavior: - mesh is built on geometry -> "Clear mesh data" removes all nodes/elements - mesh w/o geometry (imported, compound, made from scratch) -> "Clear mesh data" removes only nodes/elements computed by algorithms --- diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index 8a357cd1e..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; }