Version: 9.12.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< smIdType > GetMeshInfo () const
 Return info on sub-types of elements. More...
 
template<typename IDTYPE >
smIdType GetElementIds (IDTYPE *ids) const
 
virtual smIdType Extent () const
 Returns nb of elements. More...
 
virtual bool IsEmpty ()
 Checks emptyness. More...
 
virtual bool Contains (const smIdType 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 smIdType GetID (const int theIndex)
 Don't use it! More...
 
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

virtual SMDS_ElemIteratorPtr getElements ()
 Return elements before mesh compacting. More...
 
virtual void tmpClear ()
 clear myElements before re-filling after mesh compacting More...
 
virtual void add (const SMDS_MeshElement *element)
 Re-fill myElements after mesh compacting. More...
 
virtual void compact ()
 allow the descendant treat its elements before mesh clearing More...
 
const SMDS_MeshElementfindInMesh (const smIdType 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...
 
virtual void clear ()
 
void beforeCompacting ()
 store vtkIDs of elements More...
 
void restoreElements (const std::vector< smIdType > &idNodessOldToNew, const std::vector< smIdType > &idCellsOldToNew)
 restore pointers to elements More...
 

Private Attributes

SMESH_PredicatePtr myPredicate
 
std::vector< smIdType > myMeshInfo
 
std::vector< const SMDS_MeshElement * > myElements
 
bool myElementsOK
 
size_t myMeshModifTime
 
int myPredicateTic
 
size_t myNbElemToSkip
 
int myID
 
const SMESHDS_MeshmyMesh
 
SMDSAbs_ElementType myType
 
std::string myStoreName
 
Quantity_Color myColor
 
smIdType myCurIndex
 
smIdType myCurID
 
SMDS_ElemIteratorPtr myIterator
 
SMDS_MeshmyMesh
 
std::vector< const SMDS_MeshElement * > myExternalElems
 elements not contained in the mesh More...
 
std::vector< vtkIdType > myVtkIDs
 vtk IDs of elements More...
 
std::vector< bool > myIsNode
 
std::set< SMDS_ElementHolder * >::iterator myPtrInMesh
 

Static Private Attributes

static Quantity_Color myDefaultColor = Quantity_Color( 0.0, 0.0, 0.0, Quantity_TOC_RGB )
 

Detailed Description

Groups whose contents is dynamically updated using the filter.

Constructor & Destructor Documentation

◆ SMESHDS_GroupOnFilter()

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

◆ add()

void SMESHDS_GroupOnFilter::add ( const SMDS_MeshElement element)
protectedvirtual

Re-fill myElements after mesh compacting.

Implements SMDS_ElementHolder.

References myElements.

◆ beforeCompacting()

◆ clear()

virtual void SMDS_ElementHolder::clear ( )
protectedvirtualinherited

◆ compact()

virtual void SMESHDS_GroupOnFilter::compact ( )
protectedvirtual

allow the descendant treat its elements before mesh clearing

Implements SMDS_ElementHolder.

◆ Contains() [1/2]

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.

◆ Contains() [2/2]

bool SMESHDS_GroupOnFilter::Contains ( const smIdType  theID)
virtual

Checks if the element belongs to the group.

Reimplemented from SMESHDS_GroupBase.

References myPredicate.

◆ Extent()

smIdType SMESHDS_GroupOnFilter::Extent ( ) const
virtual

Returns nb of elements.

Reimplemented from SMESHDS_GroupBase.

References myMeshInfo, and update().

Referenced by GetElements(), and IsEmpty().

◆ findInMesh()

◆ GetColor()

◆ GetColorGroup()

int SMESHDS_GroupBase::GetColorGroup ( ) const
inherited

◆ GetElementIds()

template<typename IDTYPE >
smIdType SMESHDS_GroupOnFilter::GetElementIds ( IDTYPE *  ids) const

◆ getElementIds()

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(), myMeshInfo, setChanged(), setNbElemToSkip(), and SMDSEntity_Last.

◆ getElements()

SMDS_ElemIteratorPtr SMESHDS_GroupOnFilter::getElements ( )
protectedvirtual

Return elements before mesh compacting.

Implements SMDS_ElementHolder.

References myElements.

◆ GetElements()

◆ GetID() [1/2]

◆ GetID() [2/2]

smIdType SMESHDS_GroupBase::GetID ( const int  theIndex)
virtualinherited

◆ GetMesh()

◆ GetMeshInfo()

std::vector< smIdType > SMESHDS_GroupOnFilter::GetMeshInfo ( ) const

Return info on sub-types of elements.

References myMeshInfo, and update().

◆ GetPredicate()

SMESH_PredicatePtr SMESHDS_GroupOnFilter::GetPredicate ( ) const

◆ GetStoreName()

◆ GetTic()

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.

◆ GetType()

◆ IsEmpty()

bool SMESHDS_GroupOnFilter::IsEmpty ( )
virtual

Checks emptyness.

Reimplemented from SMESHDS_GroupBase.

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

◆ IsUpToDate()

bool SMESHDS_GroupOnFilter::IsUpToDate ( ) const

◆ resetIterator()

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().

◆ restoreElements()

void SMDS_ElementHolder::restoreElements ( const std::vector< smIdType > &  idNodessOldToNew,
const std::vector< smIdType > &  idCellsOldToNew 
)
privateinherited

◆ setChanged()

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().

◆ SetColor()

void SMESHDS_GroupBase::SetColor ( const Quantity_Color &  theColor)
inherited

◆ SetColorGroup()

void SMESHDS_GroupBase::SetColorGroup ( int  theColorGroup)
inherited

◆ SetDefaultColor()

static void SMESHDS_GroupBase::SetDefaultColor ( const Quantity_Color &  theColor)
staticinherited

Referenced by SMESH_Gen_i::SetOption().

◆ setNbElemToSkip()

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().

◆ SetPredicate()

void SMESHDS_GroupOnFilter::SetPredicate ( const SMESH_PredicatePtr thePredicate)

Sets a new predicate.

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

Referenced by SMESHDS_GroupOnFilter().

◆ SetStoreName()

◆ SetType()

void SMESHDS_GroupBase::SetType ( SMDSAbs_ElementType  theType)
virtualinherited

Reimplemented in SMESHDS_Group.

References SMESHDS_GroupBase::myType.

Referenced by SMESHDS_Group::SetType().

◆ tmpClear()

void SMESHDS_GroupOnFilter::tmpClear ( )
protectedvirtual

clear myElements before re-filling after mesh compacting

Implements SMDS_ElementHolder.

References myElements.

◆ update()

void SMESHDS_GroupOnFilter::update ( ) const
private

◆ updateParallel()

bool SMESHDS_GroupOnFilter::updateParallel ( ) const
private

Updates myElements in parallel.

Referenced by GetElements(), and update().

Field Documentation

◆ myColor

Quantity_Color SMESHDS_GroupBase::myColor
privateinherited

◆ myCurID

smIdType SMESHDS_GroupBase::myCurID
privateinherited

◆ myCurIndex

smIdType SMESHDS_GroupBase::myCurIndex
privateinherited

◆ myDefaultColor

Quantity_Color SMESHDS_GroupBase::myDefaultColor = Quantity_Color( 0.0, 0.0, 0.0, Quantity_TOC_RGB )
staticprivateinherited

◆ myElements

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

◆ myElementsOK

bool SMESHDS_GroupOnFilter::myElementsOK
private

Referenced by GetElements(), and setChanged().

◆ myExternalElems

std::vector<const SMDS_MeshElement*> SMDS_ElementHolder::myExternalElems
privateinherited

elements not contained in the mesh

Referenced by SMDS_ElementHolder::beforeCompacting(), and SMDS_ElementHolder::restoreElements().

◆ myID

int SMESHDS_GroupBase::myID
privateinherited

◆ myIsNode

std::vector< bool > SMDS_ElementHolder::myIsNode
privateinherited

◆ myIterator

SMDS_ElemIteratorPtr SMESHDS_GroupBase::myIterator
privateinherited

◆ myMesh [1/2]

◆ myMesh [2/2]

const SMESHDS_Mesh* SMESHDS_GroupBase::myMesh
privateinherited

◆ myMeshInfo

std::vector< smIdType > SMESHDS_GroupOnFilter::myMeshInfo
private

◆ myMeshModifTime

size_t SMESHDS_GroupOnFilter::myMeshModifTime
private

Referenced by IsUpToDate(), and setChanged().

◆ myNbElemToSkip

size_t SMESHDS_GroupOnFilter::myNbElemToSkip
private

◆ myPredicate

SMESH_PredicatePtr SMESHDS_GroupOnFilter::myPredicate
private

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

◆ myPredicateTic

int SMESHDS_GroupOnFilter::myPredicateTic
private

Referenced by GetTic(), and SetPredicate().

◆ myPtrInMesh

std::set< SMDS_ElementHolder* >::iterator SMDS_ElementHolder::myPtrInMesh
privateinherited

◆ myStoreName

std::string SMESHDS_GroupBase::myStoreName
privateinherited

◆ myType

SMDSAbs_ElementType SMESHDS_GroupBase::myType
privateinherited

◆ myVtkIDs

std::vector< vtkIdType > SMDS_ElementHolder::myVtkIDs
privateinherited