From: mzn Date: Thu, 20 Jan 2005 11:50:07 +0000 (+0000) Subject: Fix for PAL7758(Incorrect work of "Lying on Geom" filter for faces). X-Git-Tag: V2_2_0b2~49 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=3fa31cc01e0e910bf0ade44749f1a843ede69336 Fix for PAL7758(Incorrect work of "Lying on Geom" filter for faces). LyingOnGeom::Contains(...) improved. --- diff --git a/src/SMESH_I/SMESH_Filter_i.cxx b/src/SMESH_I/SMESH_Filter_i.cxx index a5c073f29..95893bc0e 100644 --- a/src/SMESH_I/SMESH_Filter_i.cxx +++ b/src/SMESH_I/SMESH_Filter_i.cxx @@ -268,43 +268,31 @@ bool Controls::LyingOnGeom::Contains( SMESHDS_Mesh* theMeshDS, if (IsContains(theMeshDS, theShape, theElem, theFindShapeEnum, theAvoidShapeEnum)) return true; - if ( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( theShape ) ) - { - SMDS_NodeIteratorPtr aNodeIt = aSubMesh->GetNodes(); - while ( aNodeIt->more() ) - { - const SMDS_MeshNode* aNode = static_cast(aNodeIt->next()); - SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator(); - while ( anElemIt->more() ) - { - const SMDS_MeshElement* anElement = static_cast(anElemIt->next()); - if (anElement == theElem) - return true; - } - } - } + TopTools_IndexedMapOfShape aSubShapes; + TopExp::MapShapes( theShape, aSubShapes ); - TopExp_Explorer anExp( theShape,TopAbs_VERTEX,theAvoidShapeEnum ); - - while( anExp.More() ) - { - const TopoDS_Shape& aShape = anExp.Current(); - if( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( aShape ) ){ - SMDS_NodeIteratorPtr aNodeIt = aSubMesh->GetNodes(); - while ( aNodeIt->more() ) - { - const SMDS_MeshNode* aNode = static_cast(aNodeIt->next()); - SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator(); - while ( anElemIt->more() ) - { - const SMDS_MeshElement* anElement = static_cast(anElemIt->next()); - if (anElement == theElem) - return true; - } - } + for (int i = 1; i <= aSubShapes.Extent(); i++) + { + const TopoDS_Shape& aShape = aSubShapes.FindKey(i); + + if( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( aShape ) ){ + if( aSubMesh->Contains( theElem ) ) + return true; + + SMDS_NodeIteratorPtr aNodeIt = aSubMesh->GetNodes(); + while ( aNodeIt->more() ) + { + const SMDS_MeshNode* aNode = static_cast(aNodeIt->next()); + SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator(); + while ( anElemIt->more() ) + { + const SMDS_MeshElement* anElement = static_cast(anElemIt->next()); + if (anElement == theElem) + return true; + } + } + } } - anExp.Next(); - } return false; }