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> 19 #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.") 26 template<
int,
int,
class,
template<
int,
int,
class >
class >
113 template<
class Gr
idImp,
class IteratorImp>
120 #if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS 126 GridImp::
dimension, GridImp::dimensionworld,
127 typename GridImp::ctype,
128 typename GridImp::GridFamily> ;
146 typedef typename IteratorImp::Entity
Entity;
149 typedef typename std::conditional<
150 std::is_lvalue_reference<
151 decltype(realIterator.dereference())
169 template<
class ItImp >
171 : realIterator( ep.realIterator )
186 : realIterator( entity.
impl() )
195 : realIterator( entityImp )
198 template<
class ItImp >
239 DUNE_ENTITYPOINTER_DEPRECATED_MSG
241 return realIterator.dereference();
245 decltype(handle_proxy_member_access(realIterator.dereference()))
247 DUNE_ENTITYPOINTER_DEPRECATED_MSG
249 return handle_proxy_member_access(realIterator.dereference());
256 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!")
257 void trigger_entity_cast_warning()
const 260 template<typename T, typename std::enable_if<std::is_same<T,Entity>::value,
int>
::type = 0>
261 operator const T&()
const 263 static_assert(std::is_same<T,Entity>::value,
"invalid cast");
264 trigger_entity_cast_warning<T>();
265 return realIterator.dereference();
283 template<
class ItImp >
294 template<
class ItImp >
306 DUNE_ENTITYPOINTER_DEPRECATED_MSG
309 return (**
this) == rhs;
317 DUNE_ENTITYPOINTER_DEPRECATED_MSG
320 return (**
this) != rhs;
340 DUNE_ENTITYPOINTER_DEPRECATED_MSG
342 return realIterator.level();
363 template<
class ItImp >
377 typedef typename GridImp::template Codim<codimension>::Geometry
Geometry;
380 typedef typename GridImp::template Codim<codimension>::EntitySeed
EntitySeed;
389 typedef typename GridImp::template Codim<codimension>::LocalGeometry
LocalGeometry;
429 Geometry
geometry ()
const {
return realIterator.dereference().geometry(); }
439 EntitySeed
seed ()
const {
return realIterator.dereference().seed(); }
441 #define CHECK_CODIM0 int ecodim = codimension, typename std::enable_if<ecodim == 0,int>::type = 0 442 #define ONLY_CODIM0 template<int ecodim = codimension, typename std::enable_if<ecodim == 0,int>::type = 0> 444 template<
int codim, CHECK_CODIM0 >
448 return realIterator.dereference().template subEntity< codim >(i);
457 return realIterator.dereference().hasFather();
464 return realIterator.dereference().isLeaf();
471 bool isRegular()
const {
return realIterator.dereference().isRegular(); }
499 LocalGeometry
geometryInFather ()
const {
return realIterator.dereference().geometryInFather(); }
513 HierarchicIterator
hbegin (
int maxLevel)
const 515 return realIterator.dereference().hbegin(maxLevel);
526 HierarchicIterator
hend (
int maxLevel)
const 528 return realIterator.dereference().hend(maxLevel);
534 bool isNew ()
const {
return realIterator.dereference().isNew(); }
541 bool mightVanish ()
const {
return realIterator.dereference().mightVanish(); }
599 template<
int codim,
int dim,
class Gr
id,
template<
int,
int,
class >
class EntityImp >
610 : entity_(
std::move( entity ) )
614 : entity_(
std::move( entity ) )
621 return entity_ == rhs.entity_;
624 int level ()
const {
return entity_.level(); }
630 #endif // #ifndef DOXYEN 633 #undef DUNE_ENTITYPOINTER_DEPRECATED_MSG 635 #endif // DUNE_GRID_ENTITYPOINTER_HH Implementation realIterator
Definition: common/entitypointer.hh:139
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:471
#define ONLY_CODIM0
Definition: common/entitypointer.hh:442
ONLY_CODIM0 HierarchicIterator hend(int maxLevel) const
Returns iterator to one past the last son element.
Definition: common/entitypointer.hh:526
GridImp::template Codim< cd >::EntityPointer EntityPointer
Definition: common/entitypointer.hh:395
Implementation & impl()
return reference to the real implementation
Definition: common/entitypointer.hh:134
Definition: common/entitypointer.hh:597
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:455
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
PartitionType
Attributes used in the generic overlap model.
Definition: gridenums.hh:28
DUNE_ENTITYPOINTER_DEPRECATED_MSG bool operator==(const Entity &rhs) const
Compares an EntityPointer with an Entity for equality.
Definition: common/entitypointer.hh:307
#define DUNE_ENTITYPOINTER_DEPRECATED_MSG
Definition: common/entitypointer.hh:19
ONLY_CODIM0 bool isNew() const
Returns true, if the entity has been created during the last call to adapt()
Definition: common/entitypointer.hh:534
Definition: common/geometry.hh:24
GridImp::template Codim< codimension >::Geometry Geometry
The geometry type of this entity.
Definition: common/entitypointer.hh:377
bool equals(const DefaultEntityPointer &rhs) const
Definition: common/entitypointer.hh:619
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:185
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:541
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.
Definition: common/entitypointer.hh:295
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:155
ONLY_CODIM0 HierarchicIterator hbegin(int maxLevel) const
Inter-level access to elements that resulted from (recursive) subdivision of this element...
Definition: common/entitypointer.hh:513
const Entity * operator->() const DUNE_ENTITYPOINTER_DEPRECATED_MSG
Pointer operator.
ONLY_CODIM0 bool isLeaf() const
Returns true if the entity is contained in the leaf grid.
Definition: common/entitypointer.hh:462
bool equals(const EntityPointer< GridImp, ItImp > &rhs) const
Forward equality check to realIterator.
Definition: common/entitypointer.hh:364
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:389
const Implementation & impl() const
return reference to the real implementation
Definition: common/entitypointer.hh:136
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.
Definition: common/entitypointer.hh:194
DefaultEntityPointer()
Definition: common/entitypointer.hh:607
Dune::Entity< codim, dim, Grid, EntityImp > Entity
Definition: common/entitypointer.hh:605
Know the grid's dimension.
Definition: common/entitypointer.hh:407
DUNE_ENTITYPOINTER_DEPRECATED_MSG EntityPointer & operator=(const EntityPointer< GridImp, ItImp > &ep)
Definition: common/entitypointer.hh:200
Know the grid dimension.
Definition: common/entity.hh:111
int level() const
Definition: common/entitypointer.hh:624
Know dimension of the entity.
Definition: common/entitypointer.hh:411
GridImp::template Codim< codimension >::EntitySeed EntitySeed
The corresponding entity seed (for storage of entities)
Definition: common/entitypointer.hh:380
IteratorImp::Entity Entity
The Entity that this EntityPointer can point to.
Definition: common/entitypointer.hh:146
GridImp::HierarchicIterator HierarchicIterator
The codim==0 EntityPointer type.
Definition: common/entitypointer.hh:403
IteratorImp Implementation
Definition: common/entitypointer.hh:131
Codim< codim >::Entity subEntity(int i) const
Definition: common/entitypointer.hh:446
const Entity & dereference() const
Definition: common/entitypointer.hh:617
EntitySeed seed() const
Return the entity seed which contains sufficient information to generate the entity again and uses as...
Definition: common/entitypointer.hh:439
Include standard header files.
Definition: agrid.hh:59
EntityPointer(const IteratorImp &i)
Copy Constructor from an Iterator implementation.
Definition: common/entitypointer.hh:359
DefaultEntityPointer(EntityImp< codim, dim, Grid > entity)
Definition: common/entitypointer.hh:613
EntityPointer types of the different codimensions.
Definition: common/entitypointer.hh:393
GridImp::template Codim< cd >::Entity Entity
Definition: common/entitypointer.hh:396
Definition: common/entitypointer.hh:143
Wrapper and interface classes for element geometries.
EntityPointer()
Default constructor of an empty (undefined) EntityPointer.
Definition: common/entitypointer.hh:175
Entity operator*() const DUNE_ENTITYPOINTER_DEPRECATED_MSG
Dereferencing operator.
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.
Definition: common/entitypointer.hh:284
int level() const DUNE_ENTITYPOINTER_DEPRECATED_MSG
Ask for level of entity.
Definition: common/entitypointer.hh:339
DUNE_ENTITYPOINTER_DEPRECATED_MSG bool operator!=(const Entity &rhs) const
Compares an EntityPointer with an Entity for inequality.
Definition: common/entitypointer.hh:318
ONLY_CODIM0 LocalGeometry geometryInFather() const
Provides information how this element has been subdivided from its father element.
Definition: common/entitypointer.hh:499
PartitionType partitionType() const
Partition type of this entity.
Definition: common/entitypointer.hh:415
GeometryType type() const
Return the name of the reference element. The type can be used to access the Dune::ReferenceElement.
Definition: common/entitypointer.hh:434
DefaultEntityPointer(Entity entity)
Definition: common/entitypointer.hh:609
EntityImp< cd, dim, GridImp > Implementation
Definition: common/entity.hh:81
ONLY_CODIM0 bool hasBoundaryIntersections() const
Returns true, if entity has intersections with boundary.
Definition: common/entitypointer.hh:546
EntityPointer(const EntityPointer< GridImp, ItImp > &ep)
Templatized copy constructor from arbitrary IteratorImp. This enables that an EntityPointer can be co...
Definition: common/entitypointer.hh:170
Wrapper class for pointers to entities.
Definition: common/entitypointer.hh:114
Geometry geometry() const
obtain geometric realization of the entity
Definition: common/entitypointer.hh:429