mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-26 15:20:33 +05:00
PAL9874. Fix error in SMESH_HypoFilter::IsGlobalPredicate; add possibility to add all predicates in one statement.
This commit is contained in:
parent
287d1c4720
commit
3291e2c4e1
@ -97,11 +97,11 @@ bool SMESH_HypoFilter::InstancePredicate::IsOk(const SMESH_Hypothesis* aHyp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : IsGlobalPredicate::IsOk
|
//function : IsAssignedToPredicate::IsOk
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
bool SMESH_HypoFilter::IsGlobalPredicate::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 ));
|
return ( !_mainShape.IsNull() && !aShape.IsNull() && _mainShape.IsSame( aShape ));
|
||||||
@ -131,9 +131,10 @@ SMESH_HypoFilter::SMESH_HypoFilter( SMESH_HypoPredicate* aPredicate, bool notNag
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void SMESH_HypoFilter::And( SMESH_HypoPredicate* aPredicate )
|
SMESH_HypoFilter & SMESH_HypoFilter::And( SMESH_HypoPredicate* aPredicate )
|
||||||
{
|
{
|
||||||
add( AND, aPredicate );
|
add( AND, aPredicate );
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -141,9 +142,10 @@ void SMESH_HypoFilter::And( SMESH_HypoPredicate* aPredicate )
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void SMESH_HypoFilter::AndNot( SMESH_HypoPredicate* aPredicate )
|
SMESH_HypoFilter & SMESH_HypoFilter::AndNot( SMESH_HypoPredicate* aPredicate )
|
||||||
{
|
{
|
||||||
add( AND_NOT, aPredicate );
|
add( AND_NOT, aPredicate );
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -151,9 +153,10 @@ void SMESH_HypoFilter::AndNot( SMESH_HypoPredicate* aPredicate )
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void SMESH_HypoFilter::Or( SMESH_HypoPredicate* aPredicate )
|
SMESH_HypoFilter & SMESH_HypoFilter::Or( SMESH_HypoPredicate* aPredicate )
|
||||||
{
|
{
|
||||||
add( OR, aPredicate );
|
add( OR, aPredicate );
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -161,9 +164,10 @@ void SMESH_HypoFilter::Or( SMESH_HypoPredicate* aPredicate )
|
|||||||
//purpose : Return predicates
|
//purpose : Return predicates
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void SMESH_HypoFilter::OrNot( SMESH_HypoPredicate* aPredicate )
|
SMESH_HypoFilter & SMESH_HypoFilter::OrNot( SMESH_HypoPredicate* aPredicate )
|
||||||
{
|
{
|
||||||
add( OR_NOT, aPredicate );
|
add( OR_NOT, aPredicate );
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -193,7 +197,17 @@ SMESH_HypoPredicate* SMESH_HypoFilter::IsAlgo()
|
|||||||
|
|
||||||
SMESH_HypoPredicate* SMESH_HypoFilter::IsGlobal(const TopoDS_Shape& theMainShape)
|
SMESH_HypoPredicate* SMESH_HypoFilter::IsGlobal(const TopoDS_Shape& theMainShape)
|
||||||
{
|
{
|
||||||
return new IsGlobalPredicate( theMainShape );
|
return new IsAssignedToPredicate( theMainShape );
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : IsAssignedTo
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
SMESH_HypoPredicate* SMESH_HypoFilter::IsAssignedTo(const TopoDS_Shape& theShape)
|
||||||
|
{
|
||||||
|
return new IsAssignedToPredicate( theShape );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -268,13 +282,14 @@ bool SMESH_HypoFilter::IsOk (const SMESH_Hypothesis* aHyp,
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void SMESH_HypoFilter::Init ( SMESH_HypoPredicate* aPredicate, bool notNagate )
|
SMESH_HypoFilter & SMESH_HypoFilter::Init ( SMESH_HypoPredicate* aPredicate, bool notNagate )
|
||||||
{
|
{
|
||||||
list<SMESH_HypoPredicate*>::const_iterator pred = myPredicates.begin();
|
list<SMESH_HypoPredicate*>::const_iterator pred = myPredicates.begin();
|
||||||
for ( ; pred != myPredicates.end(); ++pred )
|
for ( ; pred != myPredicates.end(); ++pred )
|
||||||
delete *pred;
|
delete *pred;
|
||||||
|
|
||||||
add( notNagate ? AND : AND_NOT, aPredicate );
|
add( notNagate ? AND : AND_NOT, aPredicate );
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,10 +35,10 @@
|
|||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
|
||||||
class SMESH_HypoFilter;
|
class SMESH_HypoFilter;
|
||||||
class SMESH_Hypothesis;
|
class SMESH_Hypothesis;
|
||||||
class TopoDS_Shape;
|
|
||||||
|
|
||||||
class SMESH_HypoPredicate {
|
class SMESH_HypoPredicate {
|
||||||
public:
|
public:
|
||||||
@ -59,15 +59,16 @@ class SMESH_HypoFilter: public SMESH_HypoPredicate
|
|||||||
SMESH_HypoFilter();
|
SMESH_HypoFilter();
|
||||||
SMESH_HypoFilter( SMESH_HypoPredicate* aPredicate, bool notNagate = true );
|
SMESH_HypoFilter( SMESH_HypoPredicate* aPredicate, bool notNagate = true );
|
||||||
// notNagate==false means !aPredicate->IsOk()
|
// notNagate==false means !aPredicate->IsOk()
|
||||||
void Init ( SMESH_HypoPredicate* aPredicate, bool notNagate = true );
|
SMESH_HypoFilter & Init ( SMESH_HypoPredicate* aPredicate, bool notNagate = true );
|
||||||
void And ( SMESH_HypoPredicate* aPredicate );
|
SMESH_HypoFilter & And ( SMESH_HypoPredicate* aPredicate );
|
||||||
void AndNot( SMESH_HypoPredicate* aPredicate );
|
SMESH_HypoFilter & AndNot( SMESH_HypoPredicate* aPredicate );
|
||||||
void Or ( SMESH_HypoPredicate* aPredicate );
|
SMESH_HypoFilter & Or ( SMESH_HypoPredicate* aPredicate );
|
||||||
void OrNot ( SMESH_HypoPredicate* aPredicate );
|
SMESH_HypoFilter & OrNot ( SMESH_HypoPredicate* aPredicate );
|
||||||
|
|
||||||
// Create predicates
|
// Create predicates
|
||||||
static SMESH_HypoPredicate* IsAlgo();
|
static SMESH_HypoPredicate* IsAlgo();
|
||||||
static SMESH_HypoPredicate* IsApplicableTo(const TopoDS_Shape& theMainShape);
|
static SMESH_HypoPredicate* IsApplicableTo(const TopoDS_Shape& theShape);
|
||||||
|
static SMESH_HypoPredicate* IsAssignedTo(const TopoDS_Shape& theShape);
|
||||||
static SMESH_HypoPredicate* Is(const SMESH_Hypothesis* theHypo);
|
static SMESH_HypoPredicate* Is(const SMESH_Hypothesis* theHypo);
|
||||||
static SMESH_HypoPredicate* IsGlobal(const TopoDS_Shape& theMainShape);
|
static SMESH_HypoPredicate* IsGlobal(const TopoDS_Shape& theMainShape);
|
||||||
static SMESH_HypoPredicate* HasName(const std::string & theName);
|
static SMESH_HypoPredicate* HasName(const std::string & theName);
|
||||||
@ -150,9 +151,9 @@ class SMESH_HypoFilter: public SMESH_HypoPredicate
|
|||||||
const TopoDS_Shape& aShape) const;
|
const TopoDS_Shape& aShape) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IsGlobalPredicate : public SMESH_HypoPredicate {
|
struct IsAssignedToPredicate : public SMESH_HypoPredicate {
|
||||||
const TopoDS_Shape& _mainShape;
|
TopoDS_Shape _mainShape;
|
||||||
IsGlobalPredicate( const TopoDS_Shape& mainShape ):_mainShape(mainShape){}
|
IsAssignedToPredicate( const TopoDS_Shape& mainShape ):_mainShape(mainShape){}
|
||||||
bool IsOk(const SMESH_Hypothesis* aHyp,
|
bool IsOk(const SMESH_Hypothesis* aHyp,
|
||||||
const TopoDS_Shape& aShape) const;
|
const TopoDS_Shape& aShape) const;
|
||||||
};
|
};
|
||||||
|
@ -1080,11 +1080,10 @@ void SMESH_Mesh::RemoveGroup (const int theGroupID)
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
const SMESH_Hypothesis* SMESH_Mesh::IsLocal1DHypothesis (const TopoDS_Shape& theEdge)
|
const SMESH_Hypothesis* SMESH_Mesh::IsLocal1DHypothesis (const TopoDS_Shape& theEdge)
|
||||||
{
|
{
|
||||||
SMESH_HypoFilter filter( SMESH_HypoFilter::HasDim( 1 ));
|
SMESH_HypoFilter hypo ( SMESH_HypoFilter::HasDim( 1 ));
|
||||||
filter.AndNot( SMESH_HypoFilter::IsAlgo() );
|
hypo.AndNot( hypo.IsAlgo() ).AndNot( hypo.IsAssignedTo( GetMeshDS()->ShapeToMesh() ));
|
||||||
filter.AndNot( SMESH_HypoFilter::IsGlobal( GetMeshDS()->ShapeToMesh() ));
|
|
||||||
|
|
||||||
return GetHypothesis( theEdge, filter, true );
|
return GetHypothesis( theEdge, hypo, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -1426,4 +1425,4 @@ ostream& SMESH_Mesh::Dump(ostream& save)
|
|||||||
SMDSAbs_ElementType SMESH_Mesh::GetElementType( const int id, const bool iselem )
|
SMDSAbs_ElementType SMESH_Mesh::GetElementType( const int id, const bool iselem )
|
||||||
{
|
{
|
||||||
return _myMeshDS->GetElementType( id, iselem );
|
return _myMeshDS->GetElementType( id, iselem );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user