Dune Core Modules (2.4.1)
Wrapper class for pointers to entities. More...
#include <dune/grid/common/entitypointer.hh>
Classes | |
struct | Codim |
EntityPointer types of the different codimensions. More... | |
Public Types | |
enum | |
codimension of entity pointer | |
typedef IteratorImp::Entity | Entity |
The Entity that this EntityPointer can point to. | |
typedef std::conditional< std::is_lvalue_reference< decltype(realIterator.dereference())>::value, constEntity &, Entity >::type | Reference |
Tpy of the reference used when derefencing the Ptr. | |
Public Member Functions | |
Constructor & conversion | |
template<class ItImp > | |
EntityPointer (const EntityPointer< GridImp, ItImp > &ep) | |
Templatized copy constructor from arbitrary IteratorImp. This enables that an EntityPointer can be copy-constructed from LevelIterator, LeafIterator and HierarchicIterator (because these are derived from EntityPointer<...> with their corresponding implementation. | |
EntityPointer () | |
Default constructor of an empty (undefined) EntityPointer. | |
DUNE_ENTITYPOINTER_DEPRECATED_MSG | EntityPointer (const Entity &entity) |
Templatized constructor from type of entity that this entity pointer points to. This constructor can be used to create an entity pointer from an entity in order to store an entity. The implementation of EntityPointer has to have a constructor taking a Dune::Entity. | |
EntityPointer (const typename Entity::Implementation &entityImp) | |
Constructor from type of entity implementation that this entity pointer points to. This constructor is only used in the EntityDefaultImplementation to implement the method seed() by default when the type of EntitySeed and EntityPointer coniside. | |
template<class ItImp > | |
DUNE_ENTITYPOINTER_DEPRECATED_MSG EntityPointer & | operator= (const EntityPointer< GridImp, ItImp > &ep) |
Dereferencing | |
Entity | operator* () const DUNE_ENTITYPOINTER_DEPRECATED_MSG |
Dereferencing operator. | |
const Entity * | operator-> () const DUNE_ENTITYPOINTER_DEPRECATED_MSG |
Pointer operator. | |
Compare methods | |
template<class ItImp > | |
bool | operator== (const EntityPointer< GridImp, ItImp > &rhs) const |
Checks for equality. Only works for EntityPointers and iterators on the same grid. Due to the conversion operators one can compare all kinds of iterators and EntityPointer. | |
template<class ItImp > | |
bool | operator!= (const EntityPointer< GridImp, ItImp > &rhs) const |
Checks for inequality. Only works for EntityPointers and iterators on the same grid. Due to the conversion operators one can compare all kinds of iterators and EntityPointer. | |
DUNE_ENTITYPOINTER_DEPRECATED_MSG bool | operator== (const Entity &rhs) const |
Compares an EntityPointer with an Entity for equality. More... | |
DUNE_ENTITYPOINTER_DEPRECATED_MSG bool | operator!= (const Entity &rhs) const |
Compares an EntityPointer with an Entity for inequality. More... | |
Query methods | |
int | level () const DUNE_ENTITYPOINTER_DEPRECATED_MSG |
Ask for level of entity. More... | |
Implementor interface | |
EntityPointer (const IteratorImp &i) | |
Copy Constructor from an Iterator implementation. More... | |
template<class ItImp > | |
bool | equals (const EntityPointer< GridImp, ItImp > &rhs) const |
Forward equality check to realIterator. | |
Protected Member Functions | |
Implementation & | impl () |
return reference to the real implementation | |
const Implementation & | impl () const |
return reference to the real implementation | |
Methods and Types of the Entity interface. These are here just for transition purpose | |
enum | { dimension =Entity::dimension } |
enum | { mydimension =Entity::dimension } |
typedef GridImp::template Codim< codimension >::Geometry | Geometry |
The geometry type of this entity. | |
typedef GridImp::template Codim< codimension >::EntitySeed | EntitySeed |
The corresponding entity seed (for storage of entities) | |
typedef GridImp::template Codim< codimension >::LocalGeometry | LocalGeometry |
The geometry type of this entity when the geometry is expressed embedded in the father element. More... | |
typedef GridImp::HierarchicIterator | HierarchicIterator |
The codim==0 EntityPointer type. More... | |
PartitionType | partitionType () const |
Partition type of this entity. | |
Geometry | geometry () const |
obtain geometric realization of the entity More... | |
GeometryType | type () const |
Return the name of the reference element. The type can be used to access the Dune::ReferenceElement. | |
EntitySeed | seed () const |
Return the entity seed which contains sufficient information to generate the entity again and uses as little memory as possible. | |
template<int codim, CHECK_CODIM0 > | |
Codim< codim >::Entity | subEntity (int i) const |
ONLY_CODIM0 bool | hasFather () const |
Return true if entity has a father entity which can be accessed using the father() method. | |
ONLY_CODIM0 bool | isLeaf () const |
Returns true if the entity is contained in the leaf grid. | |
ONLY_CODIM0 bool | isRegular () const |
Returns true if element is of regular type in red/green type refinement. In bisection or hanging node refinement this is always true. | |
ONLY_CODIM0 LocalGeometry | geometryInFather () const |
Provides information how this element has been subdivided from its father element. More... | |
ONLY_CODIM0 HierarchicIterator | hbegin (int maxLevel) const |
Inter-level access to elements that resulted from (recursive) subdivision of this element. More... | |
ONLY_CODIM0 HierarchicIterator | hend (int maxLevel) const |
Returns iterator to one past the last son element. More... | |
ONLY_CODIM0 bool | isNew () const |
Returns true, if the entity has been created during the last call to adapt() | |
ONLY_CODIM0 bool | mightVanish () const |
Returns true, if entity might disappear during the next call to adapt(). If the method returns false, the entity is guaranteed to still be present after adaptation. | |
ONLY_CODIM0 bool | hasBoundaryIntersections () const |
Returns true, if entity has intersections with boundary. | |
Detailed Description
class Dune::EntityPointer< GridImp, IteratorImp >
Wrapper class for pointers to entities.
Template parameters are:
GridImp
Type that is a model of Dune::GridIteratorImp
Class template that is a model of Dune::EntityPointer
Engine Concept
The EntityPointer class template wraps an object of type IteratorImp and forwards all member function calls to corresponding members of this class. In that sense EntityPointer defines the interface and IteratorImp supplies the implementation.
Relation of EntityPointer and Iterators
The EntityPointer can be used like a static iterator. It points to a Dune::Entity and can be dereferenced, compared and it knows the Entity's level.
You should be able to initialize and interpret every Dune::EntityIterator as a Dune::EntityPointer. Therefore we need an inheritance hierarchy of the Iterator wrappers:
This hierarchy must be mimicked in the implementation (e.g. SGrid):
Please note that dereference(...), equals(...) and level() are only implemented in SEntityPointer – SLevelIterator inherits these methods. And it is not possible to specialize these, because EntityPointer always uses the base class.
This leads to a hierarchy where Dune::LevelIterator<..., SLevelIterator> inherits Dune::EntityPointer<..., SLevelIterator> and Dune::HierarchicIterator<..., SHierarchicIterator> inherits Dune::EntityPointer<..., SHierarchicIterator>. And virtualy all Dune::EntityPointer<..., SXxxIterator> are descendents of Dune::EntityPointer<..., SEntityPointer>.
Now you can compare Dune::LevelIterator with Dune::EntityPointer and Dune::LeafIterator with Dune::HierarchicIterator. And you can assign Dune::EntityPointer from any Dune::XxxIterator class.
The compiler takes care that you only assign/compare Iterators from the same Grid.
The downside (or advantage) of this inheritance is that you cannot use different comparison operators and different dereference operators for the different Iterators in one Grid. On the first sight it is a downside because one might consider it a good idea to have special treatment for different iterators. On the other hand it's very confusing for the user if different Iterators show different behavior in the same situation. So now they are forced to show the same behavior.
- Deprecated:
- The EntityPointer is deprecated and will be removed after the release of dune-grid-2.4. It is not needed anymore because starting with dune-grid-2.4, you can now simply copy and store entities directly. If you need to store many entities for an extended time, use EntitySeed instead. Please note that due to the effort required by this change, those grids that are deprecated in dune-grid-2.4 will not have copyable entities, so if you are forced to use one of those grids, you will have to continue using EntityPointer as well.
Member Typedef Documentation
◆ HierarchicIterator
typedef GridImp::HierarchicIterator Dune::EntityPointer< GridImp, IteratorImp >::HierarchicIterator |
The codim==0 EntityPointer type.
The HierarchicIterator type
◆ LocalGeometry
typedef GridImp::template Codim<codimension>::LocalGeometry Dune::EntityPointer< GridImp, IteratorImp >::LocalGeometry |
The geometry type of this entity when the geometry is expressed embedded in the father element.
This differs from Geometry in particular when dim != dimworld, but even when dim == dimworld the implementation may choose to use a different type here.
Member Enumeration Documentation
◆ anonymous enum
anonymous enum |
◆ anonymous enum
anonymous enum |
Constructor & Destructor Documentation
◆ EntityPointer()
|
inline |
Copy Constructor from an Iterator implementation.
You can supply LeafIterator, LevelIterator, HierarchicIterator or EntityPointer.
Member Function Documentation
◆ geometry()
|
inline |
obtain geometric realization of the entity
Each entity provides an object of type Dune::Geometry< dimension-codimension, dimensionworld, ... > that represents the map from a reference element to world coordinates.
- Note
- Previously, the geometry was encapsulated in the entity object and a const reference was returned.
- The returned geometry object is guaranteed to remain valid until the grid is modified (or deleted).
◆ geometryInFather()
|
inline |
Provides information how this element has been subdivided from its father element.
The returned LocalGeometry is a model of Dune::Geometry<dimension,dimension,...>, mapping the reference element of the given entity to the reference element of its father.
This information is sufficient to interpolate all degrees of freedom in the conforming case. Nonconforming may require access to neighbors of the father and calculations with local coordinates. The on-the-fly case is somewhat inefficient since degrees of freedom may be visited several times. If we store interpolation matrices, this is tolerable. We assume that on-the-fly implementation of interpolation is only done for simple discretizations.
- Note
- For ghost entities, this method is not guaranteed to be implemented.
- Previously, the geometry was encapsulated in the entity object and a const reference was returned.
- The returned geometry object is guaranteed to remain valid until the grid is modified (or deleted).
◆ hbegin()
|
inline |
Inter-level access to elements that resulted from (recursive) subdivision of this element.
- Parameters
-
[in] maxlevel Iterator does not stop at elements with level greater than maxlevel.
- Returns
- Iterator to the first son (level is not greater than maxlevel)
- Note
- If the partitionType of the Entity is GhostEntity, it is not guaranteed that this method is working or implemented in general. For some grids it might be available, though.
◆ hend()
|
inline |
Returns iterator to one past the last son element.
- Note
- If the partitionType of the Entity is GhostEntity, it is not guaranteed that this method is working or implemented in general. For some grids it might be available, though.
◆ level()
|
inline |
Ask for level of entity.
This method is redundant and is only there for efficiency reasons. It allows an implementation to return the level without actually constructing the entity.
- Deprecated:
- Will be removed after the release of dune-grid-2.4. Use the method level() from the dereferenced Entity instead.
◆ operator!=()
|
inline |
Compares an EntityPointer with an Entity for inequality.
- Deprecated:
- This method only exists for backwards compatibility during the 2.4 release cycle and will be removed after dune-grid-2.4 is released.
◆ operator==()
|
inline |
Compares an EntityPointer with an Entity for equality.
- Deprecated:
- This method only exists for backwards compatibility during the 2.4 release cycle and will be removed after dune-grid-2.4 is released.
The documentation for this class was generated from the following file:
- dune/grid/common/entitypointer.hh