//
#include "SMESH_HypoFilter.hxx"
+#include "SMESH_Gen.hxx"
#include "SMESH_Hypothesis.hxx"
+#include "SMESH_MesherHelper.hxx"
#include "SMESH_subMesh.hxx"
#include <TopExp_Explorer.hxx>
//=======================================================================
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 ));
}
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;
}
//=======================================================================
// SMESH SMESH : implementaion of SMESH idl descriptions
// File : SMESH_HypoFilter.hxx
// Module : SMESH
-// $Header$
//
#ifndef SMESH_HypoFilter_HeaderFile
#define SMESH_HypoFilter_HeaderFile
};
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;
};