Workspace 6.21.5
Public Member Functions | List of all members
ElementCriterion Class Referenceabstract

Abstract base class defining an interface for pass/fail criterion for an Element.

#include <Mesh/Geometry/elementcriterion.h>

Inheritance diagram for ElementCriterion:
[legend]

Public Member Functions

 ~ElementCriterion () override=default
 
ElementCriterionclone () const override=0
 
virtual void destroy ()=0
 
virtual bool pass (const Element &element) const =0
 
virtual void postVisits ()
 
virtual bool preVisits (MeshModel &model)
 
- Public Member Functions inherited from Clonable
virtual ~Clonable ()=default
 
virtual Clonableclone () const =0
 
- Public Member Functions inherited from Observable
virtual ~Observable ()
 
void attachObserver (Observer &observer)
 
void destroy ()
 
void detachObserver (Observer &observer)
 
void notifyEvent (const ObservableEvent &event)
 

Additional Inherited Members

- Protected Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 

Constructor & Destructor Documentation

◆ ~ElementCriterion()

~ElementCriterion ( )
overridedefault

Member Function Documentation

◆ clone()

ElementCriterion * clone ( ) const
overridepure virtual
Returns
A clone of this object.
Note
Subclasses would normally return their own type rather than the Clonable type. The C++ language rules allow a more derived type to be returned from a virtual function and the compiler will still treat it as a valid override.

We redeclare this function only so that the more derived return type is available without casting.

Implements Clonable.

Implemented in ElementCriterionAllPass, and ElementCriterionInRegion.

◆ destroy()

virtual void destroy ( )
pure virtual

Destroys the object. This function is usually implemented by calling operator delete on the object.

See also
clone()

Implemented in ElementCriterionAllPass, and ElementCriterionInRegion.

◆ pass()

virtual bool pass ( const Element element) const
pure virtual
Parameters
elementThe element for which the criterion is to be tested.
Precondition
Clients must have called preVisits() at some point before they are allowed to call pass(). The last call to preVisits() must have returned true.

The usual sequence for a client is to first call preVisits() and check that the return value is true. Then, they call pass() for all the elements in a model or for some subset of elements that interests them (eg just one type of element). The client must call postVisits() when they will no longer be calling pass() anymore. The model that was passed to preVisits() must remain valid until postVisits() returns.

Returns
True if element passes the criterion determined by the subclass.

Implemented in ElementCriterionAllPass, and ElementCriterionInRegion.

◆ postVisits()

void postVisits ( )
virtual

Clients who call preVisits() must at some point also call postVisits() if preVisits() returned true. After postVisits() is called, clients are not permitted to call pass() until they have called preVisits() again.

The model that was originally passed to preVisits() can be assumed to still exist up until postVisits() returns. After that time, clients are free to delete the model, after which no further access by a subclass is permitted (not even in its destructor).

The default implementation does nothing.

◆ preVisits()

bool preVisits ( MeshModel model)
virtual
Parameters
modelThe model whose elements will be passed to pass() at some point after preVisits() returns. It will be assumed that the model remains valid until postVisits() is called, so subclasses are allowed to keep a pointer to this model until that time.
Returns
True if the function completed successfully, false if some kind of error occurred. The caller is not permitted to call pass() unless they have called preVisits() and the last call to it returned true. The default implementation does nothing and always returns true.
Note
If this function returns false, postVisits() should not be called.