From 6223f216fef5045672522e99a9a35592e0494077 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 15 Oct 2010 10:53:29 +0000 Subject: [PATCH] Regeression of the Test Case 3D_submesh/A0 fix IsMoreLocalThanPredicate after the patch for issue 0020963 --- src/SMESH/SMESH_HypoFilter.cxx | 25 ++++++++++++++++--------- src/SMESH/SMESH_HypoFilter.hxx | 5 ++--- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/SMESH/SMESH_HypoFilter.cxx b/src/SMESH/SMESH_HypoFilter.cxx index dd99ac11a..f60a122a9 100644 --- a/src/SMESH/SMESH_HypoFilter.cxx +++ b/src/SMESH/SMESH_HypoFilter.cxx @@ -27,7 +27,9 @@ // #include "SMESH_HypoFilter.hxx" +#include "SMESH_Gen.hxx" #include "SMESH_Hypothesis.hxx" +#include "SMESH_MesherHelper.hxx" #include "SMESH_subMesh.hxx" #include @@ -115,7 +117,7 @@ bool SMESH_HypoFilter::InstancePredicate::IsOk(const SMESH_Hypothesis* aHyp, //======================================================================= bool SMESH_HypoFilter::IsAssignedToPredicate::IsOk(const SMESH_Hypothesis* aHyp, - const TopoDS_Shape& aShape) const + const TopoDS_Shape& aShape) const { return ( !_mainShape.IsNull() && !aShape.IsNull() && _mainShape.IsSame( aShape )); } @@ -128,14 +130,19 @@ bool SMESH_HypoFilter::IsAssignedToPredicate::IsOk(const SMESH_Hypothesis* aHyp, bool SMESH_HypoFilter::IsMoreLocalThanPredicate::IsOk(const SMESH_Hypothesis* aHyp, const TopoDS_Shape& aShape) const { - // issue 0020963 - // if aShape is COMPOUND (i.e. most probably a GEOM group) then - // it is more local if it contains shapes of less dimension than _shapeType - if ( aShape.ShapeType() == TopAbs_COMPOUND ) - for ( int moreLocalType = _shapeType+1; moreLocalType < int(TopAbs_SHAPE); ++moreLocalType ) - if ( TopExp_Explorer( aShape, TopAbs_ShapeEnum(moreLocalType)).More()) - return true; - return ( aShape.ShapeType() > _shapeType ); + if ( SMESH_MesherHelper::IsSubShape( aShape, /*mainShape=*/_shape )) + return true; + + if ( aShape.ShapeType() == TopAbs_COMPOUND && + !SMESH_MesherHelper::IsSubShape( _shape, /*mainShape=*/aShape)) // issue 0020963 + { + for ( int type = TopAbs_SOLID; type < TopAbs_SHAPE; ++type ) + if ( aHyp->GetDim() == SMESH_Gen::GetShapeDim( TopAbs_ShapeEnum( type ))) + for ( TopExp_Explorer exp( aShape, TopAbs_ShapeEnum( type )); exp.More(); exp.Next()) + if ( SMESH_MesherHelper::IsSubShape( exp.Current(), /*mainShape=*/_shape )) + return true; + } + return false; } //======================================================================= diff --git a/src/SMESH/SMESH_HypoFilter.hxx b/src/SMESH/SMESH_HypoFilter.hxx index 0fb043e57..c2ad8b753 100644 --- a/src/SMESH/SMESH_HypoFilter.hxx +++ b/src/SMESH/SMESH_HypoFilter.hxx @@ -23,7 +23,6 @@ // SMESH SMESH : implementaion of SMESH idl descriptions // File : SMESH_HypoFilter.hxx // Module : SMESH -// $Header$ // #ifndef SMESH_HypoFilter_HeaderFile #define SMESH_HypoFilter_HeaderFile @@ -168,8 +167,8 @@ class SMESH_EXPORT SMESH_HypoFilter: public SMESH_HypoPredicate }; struct IsMoreLocalThanPredicate : public SMESH_HypoPredicate { - TopAbs_ShapeEnum _shapeType; - IsMoreLocalThanPredicate( const TopoDS_Shape& shape ):_shapeType(shape.ShapeType()){} + TopoDS_Shape _shape; + IsMoreLocalThanPredicate( const TopoDS_Shape& shape ):_shape(shape){} bool IsOk(const SMESH_Hypothesis* aHyp, const TopoDS_Shape& aShape) const; }; -- 2.39.2