From 9091ead47eb98d954e4667614cb1ec8a8e2d3cd5 Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 13 Oct 2011 05:34:25 +0000 Subject: [PATCH] use helper.GetCommonAncestor() --- src/StdMeshers/StdMeshers_Import_1D2D.cxx | 11 +++-------- src/StdMeshers/StdMeshers_Prism_3D.cxx | 13 +++---------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/StdMeshers/StdMeshers_Import_1D2D.cxx b/src/StdMeshers/StdMeshers_Import_1D2D.cxx index b5486304e..2ecf6c1d7 100644 --- a/src/StdMeshers/StdMeshers_Import_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_Import_1D2D.cxx @@ -429,14 +429,9 @@ bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & if ( bndShapes.back().ShapeType() != TopAbs_EDGE ) { // find geom edge by two vertices - TopoDS_Shape geomEdge; - PShapeIteratorPtr edgeIt = helper.GetAncestors( bndShapes.back(), theMesh, TopAbs_EDGE ); - while ( edgeIt->more() ) - { - geomEdge = *(edgeIt->next()); - if ( !helper.IsSubShape( bndShapes.front(), geomEdge )) - geomEdge.Nullify(); - } + TopoDS_Shape geomEdge = helper.GetCommonAncestor( bndShapes.back(), + bndShapes.front(), + theMesh, TopAbs_EDGE ); if ( geomEdge.IsNull() ) break; // vertices belong to different edges -> error: free internal link bndShapes.push_back( geomEdge ); diff --git a/src/StdMeshers/StdMeshers_Prism_3D.cxx b/src/StdMeshers/StdMeshers_Prism_3D.cxx index af0185cde..0d70042c8 100644 --- a/src/StdMeshers/StdMeshers_Prism_3D.cxx +++ b/src/StdMeshers/StdMeshers_Prism_3D.cxx @@ -2201,16 +2201,9 @@ TopoDS_Edge StdMeshers_PrismAsBlock::TSideFace::GetEdge(const int iEdge) const TopoDS_Shape V2 = myHelper->GetSubShapeByNode( node, meshDS ); if ( V2.ShapeType() == TopAbs_VERTEX && !V2.IsSame( V1 )) { - TopTools_ListIteratorOfListOfShape ancestIt = - myHelper->GetMesh()->GetAncestors( V1 ); - for ( ; ancestIt.More(); ancestIt.Next() ) - { - const TopoDS_Shape & ancestor = ancestIt.Value(); - if ( ancestor.ShapeType() == TopAbs_EDGE ) - for ( TopExp_Explorer e( ancestor, TopAbs_VERTEX ); e.More(); e.Next() ) - if ( V2.IsSame( e.Current() )) - return TopoDS::Edge( ancestor ); - } + TopoDS_Shape ancestor = myHelper->GetCommonAncestor( V1, V2, *myHelper->GetMesh(), TopAbs_EDGE); + if ( !ancestor.IsNull() ) + return TopoDS::Edge( ancestor ); } return TopoDS_Edge(); } -- 2.39.2