Go to the documentation of this file.
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 >
230 const
Entity* operator->() const
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 >
376 typedef typename GridImp::template Codim<codimension>::Geometry
Geometry;
379 typedef typename GridImp::template Codim<codimension>::EntitySeed
EntitySeed;
388 typedef typename GridImp::template Codim<codimension>::LocalGeometry
LocalGeometry;
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(); }
629 #endif // #ifndef DOXYEN
632 #undef DUNE_ENTITYPOINTER_DEPRECATED_MSG
634 #endif // DUNE_GRID_ENTITYPOINTER_HH
bool equals(const EntityPointer< GridImp, ItImp > &rhs) const
Forward equality check to realIterator.
Definition: common/entitypointer.hh:363
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
const Entity & dereference() const
Definition: common/entitypointer.hh:616
Definition: common/entitypointer.hh:596
Include standard header files.
Definition: agrid.hh:59
ONLY_CODIM0 LocalGeometry geometryInFather() const
Provides information how this element has been subdivided from its father element.
Definition: common/entitypointer.hh:498
ONLY_CODIM0 bool isNew() const
Returns true, if the entity has been created during the last call to adapt()
Definition: common/entitypointer.hh:533
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
ONLY_CODIM0 bool isLeaf() const
Returns true if the entity is contained in the leaf grid.
Definition: common/entitypointer.hh:461
Know dimension of the entity.
Definition: common/entitypointer.hh:410
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
GridImp::template Codim< codimension >::Geometry Geometry
The geometry type of this entity.
Definition: common/entitypointer.hh:376
EntityImp< cd, dim, GridImp > Implementation
Definition: common/entity.hh:78
IteratorImp Implementation
Definition: common/entitypointer.hh:130
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
EntitySeed seed() const
Return the entity seed which contains sufficient information to generate the entity again and uses as...
Definition: common/entitypointer.hh:438
Implementation realIterator
Definition: common/entitypointer.hh:138
DUNE_ENTITYPOINTER_DEPRECATED_MSG bool operator!=(const Entity &rhs) const
Compares an EntityPointer with an Entity for inequality.
Definition: common/entitypointer.hh:317
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
PartitionType
Attributes used in the generic overlap model.
Definition: gridenums.hh:28
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
DefaultEntityPointer(EntityImp< codim, dim, Grid > entity)
Definition: common/entitypointer.hh:612
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
DefaultEntityPointer(Entity entity)
Definition: common/entitypointer.hh:608
Wrapper class for entities.
Definition: common/entity.hh:61
GridImp::template Codim< codimension >::EntitySeed EntitySeed
The corresponding entity seed (for storage of entities)
Definition: common/entitypointer.hh:379
Definition: common/entitypointer.hh:142
Geometry geometry() const
obtain geometric realization of the entity
Definition: common/entitypointer.hh:428
ONLY_CODIM0 HierarchicIterator hend(int maxLevel) const
Returns iterator to one past the last son element.
Definition: common/entitypointer.hh:525
#define DUNE_ENTITYPOINTER_DEPRECATED_MSG
Definition: common/entitypointer.hh:18
ONLY_CODIM0 bool hasBoundaryIntersections() const
Returns true, if entity has intersections with boundary.
Definition: common/entitypointer.hh:545
DefaultEntityPointer()
Definition: common/entitypointer.hh:606
const Implementation & impl() const
return reference to the real implementation
Definition: common/entitypointer.hh:135
GridImp::template Codim< cd >::EntityPointer EntityPointer
Definition: common/entitypointer.hh:394
GridImp::template Codim< cd >::Entity Entity
Definition: common/entitypointer.hh:395
Dune::Entity< codim, dim, Grid, EntityImp > Entity
Definition: common/entitypointer.hh:604
#define ONLY_CODIM0
Definition: common/entitypointer.hh:441
Implementation & impl()
return reference to the real implementation
Definition: common/entitypointer.hh:133
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
int level() const DUNE_ENTITYPOINTER_DEPRECATED_MSG
Ask for level of entity.
Definition: common/entitypointer.hh:338
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
Definition: common/geometry.hh:24
EntityPointer types of the different codimensions.
Definition: common/entitypointer.hh:392
EntityPointer(const typename Entity::Implementation &entityImp)
Constructor from type of entity implementation that this entity pointer points to....
Definition: common/entitypointer.hh:193
GridImp::HierarchicIterator HierarchicIterator
The codim==0 EntityPointer type.
Definition: common/entitypointer.hh:402
int level() const
Definition: common/entitypointer.hh:623
PartitionType partitionType() const
Partition type of this entity.
Definition: common/entitypointer.hh:414
Codim< codim >::Entity subEntity(int i) const
Definition: common/entitypointer.hh:445
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
DUNE_ENTITYPOINTER_DEPRECATED_MSG bool operator==(const Entity &rhs) const
Compares an EntityPointer with an Entity for equality.
Definition: common/entitypointer.hh:306
std::conditional< std::is_lvalue_reference< decltype(realIterator.dereference()) >::value, const Entity &, Entity >::type Reference
Tpy of the reference used when derefencing the Ptr.
Definition: common/entitypointer.hh:154
Entity operator*() const DUNE_ENTITYPOINTER_DEPRECATED_MSG
Dereferencing operator.
EntityPointer(const IteratorImp &i)
Copy Constructor from an Iterator implementation.
Definition: common/entitypointer.hh:358
DUNE_ENTITYPOINTER_DEPRECATED_MSG EntityPointer & operator=(const EntityPointer< GridImp, ItImp > &ep)
Definition: common/entitypointer.hh:199
Know the grid's dimension.
Definition: common/entitypointer.hh:406
bool equals(const DefaultEntityPointer &rhs) const
Definition: common/entitypointer.hh:618
Know the grid dimension.
Definition: common/entity.hh:108
EntityPointer()
Default constructor of an empty (undefined) EntityPointer.
Definition: common/entitypointer.hh:174
IteratorImp::Entity Entity
The Entity that this EntityPointer can point to.
Definition: common/entitypointer.hh:145
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
Wrapper class for pointers to entities.
Definition: common/entitypointer.hh:113