Version: 6.3.1
Data Structures | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

SMESH_HypoFilter Class Reference

#include <SMESH_HypoFilter.hxx>

Inheritance diagram for SMESH_HypoFilter:
Inheritance graph
[legend]

Data Structures

struct  ApplicablePredicate
struct  DimPredicate
struct  InstancePredicate
struct  IsAssignedToPredicate
struct  IsAuxiliaryPredicate
struct  IsMoreLocalThanPredicate
struct  NamePredicate
struct  templPredicate
struct  TypePredicate

Public Member Functions

 SMESH_HypoFilter ()
 SMESH_HypoFilter (SMESH_HypoPredicate *aPredicate, bool notNagate=true)
SMESH_HypoFilterInit (SMESH_HypoPredicate *aPredicate, bool notNagate=true)
SMESH_HypoFilterAnd (SMESH_HypoPredicate *aPredicate)
SMESH_HypoFilterAndNot (SMESH_HypoPredicate *aPredicate)
SMESH_HypoFilterOr (SMESH_HypoPredicate *aPredicate)
SMESH_HypoFilterOrNot (SMESH_HypoPredicate *aPredicate)
bool IsEmpty () const
bool IsOk (const SMESH_Hypothesis *aHyp, const TopoDS_Shape &aShape) const
 check aHyp or/and aShape it is assigned to
bool IsAny () const
 return true if contains no predicates
 ~SMESH_HypoFilter ()

Static Public Member Functions

static SMESH_HypoPredicateIsAlgo ()
static SMESH_HypoPredicateIsAuxiliary ()
static SMESH_HypoPredicateIsApplicableTo (const TopoDS_Shape &theShape)
static SMESH_HypoPredicateIsAssignedTo (const TopoDS_Shape &theShape)
static SMESH_HypoPredicateIs (const SMESH_Hypothesis *theHypo)
static SMESH_HypoPredicateIsGlobal (const TopoDS_Shape &theMainShape)
static SMESH_HypoPredicateIsMoreLocalThan (const TopoDS_Shape &theShape)
static SMESH_HypoPredicateHasName (const std::string &theName)
static SMESH_HypoPredicateHasDim (const int theDim)
static SMESH_HypoPredicateHasType (const int theHypType)

Protected Types

enum  Logical { AND, AND_NOT, OR, OR_NOT }
enum  Comparison { EQUAL, NOT_EQUAL, MORE, LESS }

Protected Member Functions

 SMESH_HypoFilter (const SMESH_HypoFilter &other)
void add (Logical bool_op, SMESH_HypoPredicate *pred)

Protected Attributes

std::list< SMESH_HypoPredicate * > myPredicates

Detailed Description

Definition at line 54 of file SMESH_HypoFilter.hxx.


Member Enumeration Documentation

enum SMESH_HypoFilter::Comparison [protected]
Enumerator:
EQUAL 
NOT_EQUAL 
MORE 
LESS 

Definition at line 103 of file SMESH_HypoFilter.hxx.

enum SMESH_HypoFilter::Logical [protected]
Enumerator:
AND 
AND_NOT 
OR 
OR_NOT 

Definition at line 102 of file SMESH_HypoFilter.hxx.

{ AND, AND_NOT, OR, OR_NOT };

Constructor & Destructor Documentation

SMESH_HypoFilter::SMESH_HypoFilter ( )

Definition at line 152 of file SMESH_HypoFilter.cxx.

{
}
SMESH_HypoFilter::SMESH_HypoFilter ( SMESH_HypoPredicate aPredicate,
bool  notNagate = true 
)

Definition at line 161 of file SMESH_HypoFilter.cxx.

{
  add( notNagate ? AND : AND_NOT, aPredicate );
}
SMESH_HypoFilter::~SMESH_HypoFilter ( )

Definition at line 360 of file SMESH_HypoFilter.cxx.

References batchmode_smesh.Init().

{
  Init(0);
}
SMESH_HypoFilter.SMESH_HypoFilter ( const SMESH_HypoFilter other) [protected]

Definition at line 105 of file SMESH_HypoFilter.hxx.

{}

Member Function Documentation

void SMESH_HypoFilter.add ( Logical  bool_op,
SMESH_HypoPredicate pred 
) [protected]

Definition at line 107 of file SMESH_HypoFilter.hxx.

References SMESH_HypoPredicate._logical_op.

  {
    if ( pred ) {
      pred->_logical_op = bool_op;
      myPredicates.push_back( pred );
    }
  }
SMESH_HypoFilter & SMESH_HypoFilter::And ( SMESH_HypoPredicate aPredicate)

Definition at line 171 of file SMESH_HypoFilter.cxx.

Referenced by SMESH_subMesh.AlgoStateEngine(), SMESH_Gen.GetAlgo(), and SMESH_subMesh.GetSimilarAttached().

{
  add( AND, aPredicate );
  return *this;
}
SMESH_HypoFilter & SMESH_HypoFilter::AndNot ( SMESH_HypoPredicate aPredicate)

Definition at line 182 of file SMESH_HypoFilter.cxx.

Referenced by SMESH_subMesh.AlgoStateEngine(), SMESH_subMesh.GetSimilarAttached(), and SMESH_Algo.InitCompatibleHypoFilter().

{
  add( AND_NOT, aPredicate );
  return *this;
}
SMESH_HypoPredicate * SMESH_HypoFilter::HasDim ( const int  theDim) [static]

Definition at line 276 of file SMESH_HypoFilter.cxx.

Referenced by SMESH_subMesh.GetSimilarAttached().

{
  return new DimPredicate( EQUAL, theDim );
}
SMESH_HypoPredicate * SMESH_HypoFilter::HasName ( const std::string &  theName) [static]
SMESH_HypoPredicate * SMESH_HypoFilter::HasType ( const int  theHypType) [static]

Definition at line 306 of file SMESH_HypoFilter.cxx.

Referenced by SMESH_subMesh.AlgoStateEngine(), and SMESH_subMesh.GetSimilarAttached().

{
  return new TypePredicate( EQUAL, theHypType );
}
SMESH_HypoFilter & SMESH_HypoFilter::Init ( SMESH_HypoPredicate aPredicate,
bool  notNagate = true 
)

Definition at line 343 of file SMESH_HypoFilter.cxx.

Referenced by SMESH_subMesh.AlgoStateEngine(), SMESH_subMesh.GetSimilarAttached(), and SMESH_Algo.InitCompatibleHypoFilter().

{
  list<SMESH_HypoPredicate*>::const_iterator pred = myPredicates.begin();
  for ( ; pred != myPredicates.end(); ++pred )
    delete *pred;
  myPredicates.clear();

  add( notNagate ? AND : AND_NOT, aPredicate );
  return *this;
}
SMESH_HypoPredicate * SMESH_HypoFilter::Is ( const SMESH_Hypothesis theHypo) [static]

Definition at line 215 of file SMESH_HypoFilter.cxx.

Referenced by SMESH_subMesh.AlgoStateEngine(), SMESH_subMesh.GetSimilarAttached(), and SMESH_Gen.IsGlobalHypothesis().

{
  return new InstancePredicate( theHypo );
}
SMESH_HypoPredicate * SMESH_HypoFilter::IsAlgo ( ) [static]

Definition at line 225 of file SMESH_HypoFilter.cxx.

References SMESHDS_Hypothesis.PARAM_ALGO.

Referenced by SMESH_subMesh.AlgoStateEngine(), and SMESH_Gen.GetAlgo().

{
  return new TypePredicate( MORE, SMESHDS_Hypothesis::PARAM_ALGO );
}
bool SMESH_HypoFilter.IsAny ( ) const

return true if contains no predicates

Definition at line 90 of file SMESH_HypoFilter.hxx.

{ return myPredicates.empty(); }
SMESH_HypoPredicate * SMESH_HypoFilter::IsApplicableTo ( const TopoDS_Shape &  theShape) [static]

Definition at line 286 of file SMESH_HypoFilter.cxx.

Referenced by SMESH_subMesh.AlgoStateEngine(), SMESH_Gen.GetAlgo(), and SMESH_subMesh.GetSimilarAttached().

{
  return new ApplicablePredicate( theShape );
}
SMESH_HypoPredicate * SMESH_HypoFilter::IsAssignedTo ( const TopoDS_Shape &  theShape) [static]

Definition at line 256 of file SMESH_HypoFilter.cxx.

{
  return new IsAssignedToPredicate( theShape );
}
SMESH_HypoPredicate * SMESH_HypoFilter::IsAuxiliary ( ) [static]

Definition at line 235 of file SMESH_HypoFilter.cxx.

Referenced by SMESH_subMesh.GetSimilarAttached(), and SMESH_Algo.InitCompatibleHypoFilter().

{
  return new IsAuxiliaryPredicate();
}
bool SMESH_HypoFilter.IsEmpty ( ) const

Definition at line 80 of file SMESH_HypoFilter.hxx.

{ return myPredicates.empty(); }
SMESH_HypoPredicate * SMESH_HypoFilter::IsGlobal ( const TopoDS_Shape &  theMainShape) [static]

Definition at line 246 of file SMESH_HypoFilter.cxx.

{
  return new IsAssignedToPredicate( theMainShape );
}
SMESH_HypoPredicate * SMESH_HypoFilter::IsMoreLocalThan ( const TopoDS_Shape &  theShape) [static]

Definition at line 296 of file SMESH_HypoFilter.cxx.

{
  return new IsMoreLocalThanPredicate( theShape );
}
bool SMESH_HypoFilter::IsOk ( const SMESH_Hypothesis aHyp,
const TopoDS_Shape &  aShape 
) const [virtual]

check aHyp or/and aShape it is assigned to

Implements SMESH_HypoPredicate.

Definition at line 316 of file SMESH_HypoFilter.cxx.

Referenced by SMESH_Mesh.GetHypotheses().

{
  if ( myPredicates.empty() )
    return true;

  bool ok = ( myPredicates.front()->_logical_op <= AND_NOT );
  list<SMESH_HypoPredicate*>::const_iterator pred = myPredicates.begin();
  for ( ; pred != myPredicates.end(); ++pred )
  {
    bool ok2 = (*pred)->IsOk( aHyp, aShape );
    switch ( (*pred)->_logical_op ) {
    case AND:     ok = ok && ok2; break;
    case AND_NOT: ok = ok && !ok2; break;
    case OR:      ok = ok || ok2; break;
    case OR_NOT:  ok = ok || !ok2; break;
    default:;
    }
  }
  return ok;
}
SMESH_HypoFilter & SMESH_HypoFilter::Or ( SMESH_HypoPredicate aPredicate)

Definition at line 193 of file SMESH_HypoFilter.cxx.

Referenced by SMESH_subMesh.AlgoStateEngine(), and SMESH_Algo.InitCompatibleHypoFilter().

{
  add( OR, aPredicate );
  return *this;
}
SMESH_HypoFilter & SMESH_HypoFilter::OrNot ( SMESH_HypoPredicate aPredicate)

Definition at line 204 of file SMESH_HypoFilter.cxx.

{
  add( OR_NOT, aPredicate );
  return *this;
}

Field Documentation

Definition at line 98 of file SMESH_HypoFilter.hxx.

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS