3#ifndef DUNE_GRID_ENTITYPOINTER_HH
4#define DUNE_GRID_ENTITYPOINTER_HH
8#include <dune/common/proxymemberaccess.hh>
9#include <dune/common/iteratorfacades.hh>
10#include <dune/common/deprecated.hh>
11#include <dune/geometry/type.hh>
18#define DUNE_ENTITYPOINTER_DEPRECATED_MSG DUNE_DEPRECATED_MSG("EntityPointer is deprecated and will be removed after the release of dune-grid-2.4. Instead, you can copy and store entities directly now. Note, this might lead to a decreased performance until all grid implementations properly addressed this interface change.")
25 template<
int,
int,
class,
template<
int,
int,
class >
class >
112 template<
class Gr
idImp,
class IteratorImp>
119#if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
125 GridImp::
dimension, GridImp::dimensionworld,
126 typename GridImp::ctype,
127 typename GridImp::GridFamily> ;
145 typedef typename IteratorImp::Entity
Entity;
148 typedef typename std::conditional<
149 std::is_lvalue_reference<
168 template<
class ItImp >
197 template<
class ItImp >
244 decltype(handle_proxy_member_access(
realIterator.dereference()))
248 return handle_proxy_member_access(
realIterator.dereference());
255 DUNE_DEPRECATED_MSG(
"The implicit cast from EntityPointer to an Entity reference is DANGEROUS. It's mainly there for writing backwards compatible code that doesn't trigger a deprecation warning for ported grids and must ONLY be used if the returned reference is used in an rvalue-like setting!")
256 void trigger_entity_cast_warning()
const
259 template<typename T, typename std::enable_if<std::is_same<T,Entity>::value,
int>
::type = 0>
260 operator const T&()
const
262 static_assert(std::is_same<T,Entity>::value,
"invalid cast");
263 trigger_entity_cast_warning<T>();
282 template<
class ItImp >
293 template<
class ItImp >
308 return (**
this) == rhs;
319 return (**
this) != rhs;
362 template<
class ItImp >
440#define CHECK_CODIM0 int ecodim = codimension, typename std::enable_if<ecodim == 0,int>::type = 0
441#define ONLY_CODIM0 template<int ecodim = codimension, typename std::enable_if<ecodim == 0,int>::type = 0>
443 template<
int codim, CHECK_CODIM0 >
447 return realIterator.dereference().template subEntity< codim >(i);
598 template<
int codim,
int dim,
class Gr
id,
template<
int,
int,
class >
class EntityImp >
602 static const int codimension = codim;
609 : entity_(
std::move( entity ) )
613 : entity_(
std::move( entity ) )
620 return entity_ == rhs.entity_;
623 int level ()
const {
return entity_.level(); }
632#undef DUNE_ENTITYPOINTER_DEPRECATED_MSG
PartitionType
Attributes used in the generic overlap model.
Definition gridenums.hh:28
Include standard header files.
Definition agrid.hh:60
@ dimension
Know the grid dimension.
Definition common/entity.hh:108
EntityImp< cd, dim, GridImp > Implementation
Definition common/entity.hh:78
Wrapper class for pointers to entities.
Definition common/entitypointer.hh:114
ONLY_CODIM0 bool isRegular() const
Returns true if element is of regular type in red/green type refinement. In bisection or hanging node...
Definition common/entitypointer.hh:470
EntitySeed seed() const
Return the entity seed which contains sufficient information to generate the entity again and uses as...
Definition common/entitypointer.hh:438
IteratorImp Implementation
Definition common/entitypointer.hh:130
ONLY_CODIM0 bool hasBoundaryIntersections() const
Returns true, if entity has intersections with boundary.
Definition common/entitypointer.hh:545
std::conditional< std::is_lvalue_reference< decltype(realIterator.dereference())>::value, constEntity &, Entity >::type Reference
Tpy of the reference used when derefencing the Ptr.
Definition common/entitypointer.hh:154
bool operator==(const EntityPointer< GridImp, ItImp > &rhs) const
Checks for equality. Only works for EntityPointers and iterators on the same grid....
Definition common/entitypointer.hh:283
ONLY_CODIM0 HierarchicIterator hend(int maxLevel) const
Returns iterator to one past the last son element.
Definition common/entitypointer.hh:525
Geometry geometry() const
obtain geometric realization of the entity
Definition common/entitypointer.hh:428
EntityPointer()
Default constructor of an empty (undefined) EntityPointer.
Definition common/entitypointer.hh:174
DUNE_ENTITYPOINTER_DEPRECATED_MSG bool operator==(const Entity &rhs) const
Compares an EntityPointer with an Entity for equality.
Definition common/entitypointer.hh:306
GridImp::HierarchicIterator HierarchicIterator
The codim==0 EntityPointer type.
Definition common/entitypointer.hh:402
ONLY_CODIM0 bool mightVanish() const
Returns true, if entity might disappear during the next call to adapt(). If the method returns false,...
Definition common/entitypointer.hh:540
DUNE_ENTITYPOINTER_DEPRECATED_MSG EntityPointer(const Entity &entity)
Templatized constructor from type of entity that this entity pointer points to. This constructor can ...
Definition common/entitypointer.hh:184
ONLY_CODIM0 bool isNew() const
Returns true, if the entity has been created during the last call to adapt()
Definition common/entitypointer.hh:533
DUNE_ENTITYPOINTER_DEPRECATED_MSG bool operator!=(const Entity &rhs) const
Compares an EntityPointer with an Entity for inequality.
Definition common/entitypointer.hh:317
EntityPointer(const IteratorImp &i)
Copy Constructor from an Iterator implementation.
Definition common/entitypointer.hh:358
IteratorImp::Entity Entity
The Entity that this EntityPointer can point to.
Definition common/entitypointer.hh:145
GeometryType type() const
Return the name of the reference element. The type can be used to access the Dune::ReferenceElement.
Definition common/entitypointer.hh:433
EntityPointer(const EntityPointer< GridImp, ItImp > &ep)
Templatized copy constructor from arbitrary IteratorImp. This enables that an EntityPointer can be co...
Definition common/entitypointer.hh:169
GridImp::template Codim< codimension >::EntitySeed EntitySeed
The corresponding entity seed (for storage of entities)
Definition common/entitypointer.hh:379
ONLY_CODIM0 LocalGeometry geometryInFather() const
Provides information how this element has been subdivided from its father element.
Definition common/entitypointer.hh:498
@ dimension
Know the grid's dimension.
Definition common/entitypointer.hh:406
@ codimension
Definition common/entitypointer.hh:142
GridImp::template Codim< codimension >::LocalGeometry LocalGeometry
The geometry type of this entity when the geometry is expressed embedded in the father element.
Definition common/entitypointer.hh:388
GridImp::template Codim< codimension >::Geometry Geometry
The geometry type of this entity.
Definition common/entitypointer.hh:376
Implementation & impl()
return reference to the real implementation
Definition common/entitypointer.hh:133
DUNE_ENTITYPOINTER_DEPRECATED_MSG EntityPointer & operator=(const EntityPointer< GridImp, ItImp > &ep)
Definition common/entitypointer.hh:199
Implementation realIterator
Definition common/entitypointer.hh:138
EntityPointer(const typename Entity::Implementation &entityImp)
Constructor from type of entity implementation that this entity pointer points to....
Definition common/entitypointer.hh:193
bool equals(const EntityPointer< GridImp, ItImp > &rhs) const
Forward equality check to realIterator.
Definition common/entitypointer.hh:363
const Implementation & impl() const
return reference to the real implementation
Definition common/entitypointer.hh:135
Entity operator*() const DUNE_ENTITYPOINTER_DEPRECATED_MSG
Dereferencing operator.
bool operator!=(const EntityPointer< GridImp, ItImp > &rhs) const
Checks for inequality. Only works for EntityPointers and iterators on the same grid....
Definition common/entitypointer.hh:294
ONLY_CODIM0 HierarchicIterator hbegin(int maxLevel) const
Inter-level access to elements that resulted from (recursive) subdivision of this element.
Definition common/entitypointer.hh:512
Codim< codim >::Entity subEntity(int i) const
Definition common/entitypointer.hh:445
PartitionType partitionType() const
Partition type of this entity.
Definition common/entitypointer.hh:414
@ mydimension
Know dimension of the entity.
Definition common/entitypointer.hh:410
int level() const DUNE_ENTITYPOINTER_DEPRECATED_MSG
Ask for level of entity.
Definition common/entitypointer.hh:338
ONLY_CODIM0 bool hasFather() const
Return true if entity has a father entity which can be accessed using the father() method.
Definition common/entitypointer.hh:454
ONLY_CODIM0 bool isLeaf() const
Returns true if the entity is contained in the leaf grid.
Definition common/entitypointer.hh:461
EntityPointer types of the different codimensions.
Definition common/entitypointer.hh:393
GridImp::template Codim< cd >::EntityPointer EntityPointer
Definition common/entitypointer.hh:394
GridImp::template Codim< cd >::Entity Entity
Definition common/entitypointer.hh:395
Definition common/entitypointer.hh:596
DefaultEntityPointer(Entity entity)
Definition common/entitypointer.hh:608
int level() const
Definition common/entitypointer.hh:623
const Entity & dereference() const
Definition common/entitypointer.hh:616
DefaultEntityPointer(EntityImp< codim, dim, Grid > entity)
Definition common/entitypointer.hh:612
DefaultEntityPointer()
Definition common/entitypointer.hh:606
Dune::Entity< codim, dim, Grid, EntityImp > Entity
Definition common/entitypointer.hh:604
bool equals(const DefaultEntityPointer &rhs) const
Definition common/entitypointer.hh:618
Definition common/grid.hh:924
#define ONLY_CODIM0
Definition common/entitypointer.hh:441
#define DUNE_ENTITYPOINTER_DEPRECATED_MSG
Definition common/entitypointer.hh:18