X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH%2FSMESH_Mesh.cxx;h=dcdf7fe3f81ecb4cba3b7eff76455e3e5347230b;hp=3988f2a236eef7e45d55c162a5af6ddcdde42140;hb=fa9a9581d37a45a53111f7df9ae5429c9692851f;hpb=f1013bf7248e1d093c9a5865acbe74f6f98140b6 diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index 3988f2a23..dcdf7fe3f 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -984,6 +984,8 @@ SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape) throw(SALOME_Exception) { int index = _myMeshDS->ShapeToIndex(aSubShape); + if ( !index && aSubShape.IsNull() ) + return 0; // for submeshes on GEOM Group if (( !index || index > _nbSubShapes ) && aSubShape.ShapeType() == TopAbs_COMPOUND ) { @@ -996,14 +998,29 @@ SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape) fillAncestorsMap( _myMeshDS->IndexToShape( ++_nbSubShapes )); } } -// if ( !index ) -// return NULL; // neither sub-shape nor a group + // if ( !index ) + // return NULL; // neither sub-shape nor a group SMESH_subMesh* aSubMesh = _subMeshHolder->Get( index ); if ( !aSubMesh ) { aSubMesh = new SMESH_subMesh(index, this, _myMeshDS, aSubShape); _subMeshHolder->Add( index, aSubMesh ); + + // include non-computable sub-meshes in SMESH_subMesh::_ancestors of sub-submeshes + switch ( aSubShape.ShapeType() ) { + case TopAbs_COMPOUND: + case TopAbs_WIRE: + case TopAbs_SHELL: + for ( TopoDS_Iterator subIt( aSubShape ); subIt.More(); subIt.Next() ) + { + SMESH_subMesh* sm = GetSubMesh( subIt.Value() ); + SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*inclideSelf=*/true); + while ( smIt->more() ) + smIt->next()->ClearAncestors(); + } + default:; + } } return aSubMesh; } @@ -1157,6 +1174,9 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* h const SMESH_HypoFilter* compatibleHypoKind; list usedHyps; + // keep sub-meshes not to miss ones whose state can change due to notifying others + vector< SMESH_subMesh* > smToNotify; + SMESH_subMeshIteratorPtr smIt( _subMeshHolder->GetIterator() ); while ( smIt->more() ) { @@ -1184,11 +1204,17 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* h if ( GetHypotheses( aSubMesh, *compatibleHypoKind, usedHyps, true ) && find( usedHyps.begin(), usedHyps.end(), hyp ) != usedHyps.end() ) { - aSubMesh->AlgoStateEngine(SMESH_subMesh::MODIF_HYP, - const_cast< SMESH_Hypothesis*>( hyp )); + smToNotify.push_back( aSubMesh ); } } } + + for ( size_t i = 0; i < smToNotify.size(); ++i ) + { + smToNotify[i]->AlgoStateEngine(SMESH_subMesh::MODIF_HYP, + const_cast< SMESH_Hypothesis*>( hyp )); + } + HasModificationsToDiscard(); // to reset _isModified flag if mesh becomes empty GetMeshDS()->Modified(); } @@ -2185,12 +2211,10 @@ void SMESH_Mesh::fillAncestorsMap(const TopoDS_Shape& theShape) while ( ancIt.More() && ancIt.Value().ShapeType() >= memberType ) ancIt.Next(); if ( ancIt.More() ) - { ancList.InsertBefore( theShape, ancIt ); - GetSubMesh( des.Current() )->ClearAncestors(); // to re-fill _ancestors - } } } + else // else added for 52457: Addition of hypotheses is 8 time longer than meshing { for ( desType = TopAbs_VERTEX; desType > TopAbs_COMPOUND; desType-- ) for ( ancType = desType - 1; ancType >= TopAbs_COMPOUND; ancType-- ) @@ -2202,9 +2226,11 @@ void SMESH_Mesh::fillAncestorsMap(const TopoDS_Shape& theShape) // visit COMPOUNDs inside a COMPOUND that are not reachable by TopExp_Explorer if ( theShape.ShapeType() == TopAbs_COMPOUND ) { - for ( TopoDS_Iterator sIt(theShape); sIt.More(); sIt.Next() ) - if ( sIt.Value().ShapeType() == TopAbs_COMPOUND ) - fillAncestorsMap( sIt.Value() ); + TopoDS_Iterator sIt(theShape); + if ( sIt.More() && sIt.Value().ShapeType() == TopAbs_COMPOUND ) + for ( ; sIt.More(); sIt.Next() ) + if ( sIt.Value().ShapeType() == TopAbs_COMPOUND ) + fillAncestorsMap( sIt.Value() ); } }