Version: 8.3.0
SMESHDS_GroupOnFilter Class Reference

Groups whose contents is dynamically updated using the filter. More...

#include <SMESHDS_GroupOnFilter.hxx>

Inheritance diagram for SMESHDS_GroupOnFilter:

Public Member Functions

 SMESHDS_GroupOnFilter (const int theID, const SMESHDS_Mesh *theMesh, const SMDSAbs_ElementType theType, const SMESH_PredicatePtr &thePredicate)
 Creates a group based on thePredicate. More...
 
void SetPredicate (const SMESH_PredicatePtr &thePredicate)
 Sets a new predicate. More...
 
SMESH_PredicatePtr GetPredicate () const
 
std::vector< intGetMeshInfo () const
 Return info on sub-types of elements. More...
 
template<typename IDTYPE >
int GetElementIds (IDTYPE *ids) const
 
virtual int Extent () const
 Returns nb of elements. More...
 
virtual bool IsEmpty ()
 Checks emptyness. More...
 
virtual bool Contains (const int theID)
 Checks if the element belongs to the group. More...
 
virtual bool Contains (const SMDS_MeshElement *elem)
 Checks if the element belongs to the group. More...
 
virtual SMDS_ElemIteratorPtr GetElements () const
 Return iterator on all elements. More...
 
virtual int GetTic () const
 Return a value allowing to find out if a group has changed or not. More...
 
bool IsUpToDate () const
 Return false if update() is needed. More...
 
int GetID () const
 
virtual int GetID (const int theIndex)
 
const SMESHDS_MeshGetMesh () const
 
virtual void SetType (SMDSAbs_ElementType theType)
 
SMDSAbs_ElementType GetType () const
 
void SetStoreName (const char *theName)
 
const char * GetStoreName () const
 
void SetColor (const Quantity_Color &theColor)
 
Quantity_Color GetColor () const
 
void SetColorGroup (int theColorGroup)
 
int GetColorGroup () const
 

Static Public Member Functions

static void SetDefaultColor (const Quantity_Color &theColor)
 

Protected Member Functions

const SMDS_MeshElementfindInMesh (const int theID) const
 
void resetIterator ()
 Internal method: resets cached iterator, should be called by ancestors when they are modified (ex: Add() or Remove() ) More...
 

Private Member Functions

void update () const
 Updates myElements if necessary. More...
 
bool updateParallel () const
 Updates myElements in parallel. More...
 
void setChanged (bool changed=true)
 Sets myMeshModifTime and clear fields according to modification state. More...
 
const SMDS_MeshElementsetNbElemToSkip (SMDS_ElemIteratorPtr &elIt)
 Sets myNbElemToSkip. More...
 
int getElementIds (void *ids, size_t idSize) const
 Fill ids of elements. More...
 

Private Attributes

SMESH_PredicatePtr myPredicate
 
std::vector< intmyMeshInfo
 
std::vector< const
SMDS_MeshElement * > 
myElements
 
bool myElementsOK
 
size_t myMeshModifTime
 
int myPredicateTic
 
size_t myNbElemToSkip
 

Detailed Description

Groups whose contents is dynamically updated using the filter.

Constructor & Destructor Documentation

SMESHDS_GroupOnFilter::SMESHDS_GroupOnFilter ( const int  theID,
const SMESHDS_Mesh theMesh,
const SMDSAbs_ElementType  theType,
const SMESH_PredicatePtr thePredicate 
)

Creates a group based on thePredicate.

References SetPredicate().

Member Function Documentation

bool SMESHDS_GroupOnFilter::Contains ( const int  theID)
virtual

Checks if the element belongs to the group.

Reimplemented from SMESHDS_GroupBase.

References myPredicate.

bool SMESHDS_GroupOnFilter::Contains ( const SMDS_MeshElement elem)
virtual

Checks if the element belongs to the group.

Reimplemented from SMESHDS_GroupBase.

References SMDS_MeshElement::GetID(), and myPredicate.

int SMESHDS_GroupOnFilter::Extent ( ) const
virtual

Returns nb of elements.

Reimplemented from SMESHDS_GroupBase.

References myMeshInfo, and update().

Referenced by GetElements(), and IsEmpty().

int SMESHDS_GroupBase::GetColorGroup ( ) const
inherited
template<typename IDTYPE >
int SMESHDS_GroupOnFilter::GetElementIds ( IDTYPE *  ids) const
int SMESHDS_GroupOnFilter::getElementIds ( void *  ids,
size_t  idSize 
) const
private

Fill ids of elements.

And return their number. ids must be pre-allocated using nb of elements of type == GetType()

References GetElements(), SMDS_MeshElement::GetEntityType(), SMDS_MeshElement::GetID(), IsUpToDate(), me, myMeshInfo, setChanged(), setNbElemToSkip(), and SMDSEntity_Last.

int SMESHDS_GroupBase::GetID ( const int  theIndex)
virtualinherited
std::vector< int > SMESHDS_GroupOnFilter::GetMeshInfo ( ) const

Return info on sub-types of elements.

References myMeshInfo, and update().

SMESH_PredicatePtr SMESHDS_GroupOnFilter::GetPredicate ( ) const
int SMESHDS_GroupOnFilter::GetTic ( ) const
virtual

Return a value allowing to find out if a group has changed or not.

Implements SMESHDS_GroupBase.

References SMESHDS_GroupBase::GetMesh(), SMDS_Mesh::GetMTime(), and myPredicateTic.

bool SMESHDS_GroupOnFilter::IsEmpty ( )
virtual

Checks emptyness.

Reimplemented from SMESHDS_GroupBase.

References Extent(), GetElements(), IsUpToDate(), and setChanged().

bool SMESHDS_GroupOnFilter::IsUpToDate ( ) const
void SMESHDS_GroupBase::resetIterator ( )
protectedinherited

Internal method: resets cached iterator, should be called by ancestors when they are modified (ex: Add() or Remove() )

References SMESHDS_GroupBase::myCurID, and SMESHDS_GroupBase::myCurIndex.

Referenced by SMESHDS_Group::Add(), SMESHDS_Group::Clear(), and SMESHDS_Group::Remove().

void SMESHDS_GroupOnFilter::setChanged ( bool  changed = true)
private

Sets myMeshModifTime and clear fields according to modification state.

References SMESHDS_GroupBase::GetMesh(), SMDS_Mesh::GetMTime(), myElements, myElementsOK, myMeshInfo, myMeshModifTime, myNbElemToSkip, and SMDSEntity_Last.

Referenced by getElementIds(), IsEmpty(), SetPredicate(), and update().

void SMESHDS_GroupBase::SetColor ( const Quantity_Color &  theColor)
inherited
void SMESHDS_GroupBase::SetColorGroup ( int  theColorGroup)
inherited
static void SMESHDS_GroupBase::SetDefaultColor ( const Quantity_Color &  theColor)
staticinherited

Referenced by SMESH_Gen_i::SetOption().

const SMDS_MeshElement * SMESHDS_GroupOnFilter::setNbElemToSkip ( SMDS_ElemIteratorPtr okElemIt)
private

Sets myNbElemToSkip.

Parameters
okElemIt- iterator on OK elements
Return values
constSMDS_MeshElement* - the first OK element

References SMDS_Mesh::elementsIterator(), SMESHDS_GroupBase::GetMesh(), SMESHDS_GroupBase::GetType(), and myNbElemToSkip.

Referenced by getElementIds(), and update().

void SMESHDS_GroupOnFilter::SetPredicate ( const SMESH_PredicatePtr thePredicate)

Sets a new predicate.

References SMESHDS_GroupBase::GetMesh(), myPredicate, myPredicateTic, and setChanged().

Referenced by SMESHDS_GroupOnFilter().

void SMESHDS_GroupBase::SetType ( SMDSAbs_ElementType  theType)
virtualinherited

Reimplemented in SMESHDS_Group.

References SMESHDS_GroupBase::myType.

Referenced by SMESHDS_Group::SetType().

void SMESHDS_GroupOnFilter::update ( ) const
private
bool SMESHDS_GroupOnFilter::updateParallel ( ) const
private

Updates myElements in parallel.

Referenced by GetElements(), and update().

Field Documentation

std::vector< const SMDS_MeshElement*> SMESHDS_GroupOnFilter::myElements
private

Referenced by GetElements(), and setChanged().

bool SMESHDS_GroupOnFilter::myElementsOK
private

Referenced by GetElements(), and setChanged().

std::vector< int > SMESHDS_GroupOnFilter::myMeshInfo
private
size_t SMESHDS_GroupOnFilter::myMeshModifTime
private

Referenced by IsUpToDate(), and setChanged().

size_t SMESHDS_GroupOnFilter::myNbElemToSkip
private
SMESH_PredicatePtr SMESHDS_GroupOnFilter::myPredicate
private

Referenced by Contains(), GetElements(), and SetPredicate().

int SMESHDS_GroupOnFilter::myPredicateTic
private

Referenced by GetTic(), and SetPredicate().