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> 17 #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.") 24 template<
int,
int,
class,
template<
int,
int,
class >
class >
111 template<
class Gr
idImp,
class IteratorImp>
118 #if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS 124 GridImp::
dimension, GridImp::dimensionworld,
125 typename GridImp::ctype,
126 typename GridImp::GridFamily> ;
144 typedef typename IteratorImp::Entity
Entity;
147 typedef typename std::conditional<
148 std::is_lvalue_reference<
149 decltype(realIterator.dereference())
167 template<
class ItImp >
169 : realIterator( ep.realIterator )
184 : realIterator( entity.
impl() )
193 : realIterator( entityImp )
196 template<
class ItImp >
237 DUNE_ENTITYPOINTER_DEPRECATED_MSG
239 return realIterator.dereference();
243 decltype(handle_proxy_member_access(realIterator.dereference()))
245 DUNE_ENTITYPOINTER_DEPRECATED_MSG
247 return handle_proxy_member_access(realIterator.dereference());
254 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!")
255 void trigger_entity_cast_warning()
const 258 template<typename T, typename std::enable_if<std::is_same<T,Entity>::value,
int>
::type = 0>
259 operator const T&()
const 261 static_assert(std::is_same<T,Entity>::value,
"invalid cast");
262 trigger_entity_cast_warning<T>();
263 return realIterator.dereference();
281 template<
class ItImp >
292 template<
class ItImp >
304 DUNE_ENTITYPOINTER_DEPRECATED_MSG
307 return (**
this) == rhs;
315 DUNE_ENTITYPOINTER_DEPRECATED_MSG
318 return (**
this) != rhs;
338 DUNE_ENTITYPOINTER_DEPRECATED_MSG
340 return realIterator.level();
361 template<
class ItImp >
375 typedef typename GridImp::template Codim<codimension>::Geometry
Geometry;
378 typedef typename GridImp::template Codim<codimension>::EntitySeed
EntitySeed;
387 typedef typename GridImp::template Codim<codimension>::LocalGeometry
LocalGeometry;
427 Geometry
geometry ()
const {
return realIterator.dereference().geometry(); }
437 EntitySeed
seed ()
const {
return realIterator.dereference().seed(); }
439 #define CHECK_CODIM0 int ecodim = codimension, typename std::enable_if<ecodim == 0,int>::type = 0 440 #define ONLY_CODIM0 template<int ecodim = codimension, typename std::enable_if<ecodim == 0,int>::type = 0> 442 template<
int codim, CHECK_CODIM0 >
446 return realIterator.dereference().template subEntity< codim >(i);
455 return realIterator.dereference().hasFather();
462 return realIterator.dereference().isLeaf();
469 bool isRegular()
const {
return realIterator.dereference().isRegular(); }
497 LocalGeometry
geometryInFather ()
const {
return realIterator.dereference().geometryInFather(); }
511 HierarchicIterator
hbegin (
int maxLevel)
const 513 return realIterator.dereference().hbegin(maxLevel);
524 HierarchicIterator
hend (
int maxLevel)
const 526 return realIterator.dereference().hend(maxLevel);
532 bool isNew ()
const {
return realIterator.dereference().isNew(); }
539 bool mightVanish ()
const {
return realIterator.dereference().mightVanish(); }
597 template<
int codim,
int dim,
class Gr
id,
template<
int,
int,
class >
class EntityImp >
608 : entity_(
std::
move( entity ) )
612 : entity_(
std::
move( entity ) )
619 return entity_ == rhs.entity_;
622 int level ()
const {
return entity_.level(); }
628 #endif // #ifndef DOXYEN 631 #undef DUNE_ENTITYPOINTER_DEPRECATED_MSG 633 #endif // DUNE_GRID_ENTITYPOINTER_HH GridImp::template Codim< cd >::Entity Entity
Definition: common/entitypointer.hh:394
const Entity * operator->() const DUNE_ENTITYPOINTER_DEPRECATED_MSG
Pointer operator.
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:469
Codim< codim >::Entity subEntity(int i) const
Definition: common/entitypointer.hh:444
Definition: common/entitypointer.hh:595
DUNE_ENTITYPOINTER_DEPRECATED_MSG bool operator==(const Entity &rhs) const
Compares an EntityPointer with an Entity for equality.
Definition: common/entitypointer.hh:305
DefaultEntityPointer(Entity entity)
Definition: common/entitypointer.hh:607
ONLY_CODIM0 HierarchicIterator hend(int maxLevel) const
Returns iterator to one past the last son element.
Definition: common/entitypointer.hh:524
DUNE_ENTITYPOINTER_DEPRECATED_MSG bool operator!=(const Entity &rhs) const
Compares an EntityPointer with an Entity for inequality.
Definition: common/entitypointer.hh:316
Know dimension of the entity.
Definition: common/entitypointer.hh:409
bool equals(const DefaultEntityPointer &rhs) const
Definition: common/entitypointer.hh:617
PartitionType
Attributes used in the generic overlap model.
Definition: gridenums.hh:28
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
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:192
ONLY_CODIM0 bool isLeaf() const
Returns true if the entity is contained in the leaf grid.
Definition: common/entitypointer.hh:460
bool equals(const EntityPointer< GridImp, ItImp > &rhs) const
Forward equality check to realIterator.
Definition: common/entitypointer.hh:362
int level() const
Definition: common/entitypointer.hh:622
const Entity & dereference() const
Definition: common/entitypointer.hh:615
EntityPointer types of the different codimensions.
Definition: common/entitypointer.hh:391
Wrapper class for pointers to entities.
Definition: common/entitypointer.hh:112
Definition: common/geometry.hh:24
DUNE_ENTITYPOINTER_DEPRECATED_MSG EntityPointer & operator=(const EntityPointer< GridImp, ItImp > &ep)
Definition: common/entitypointer.hh:198
IteratorImp::Entity Entity
The Entity that this EntityPointer can point to.
Definition: common/entitypointer.hh:144
Implementation & impl()
return reference to the real implementation
Definition: common/entitypointer.hh:132
GridImp::template Codim< codimension >::EntitySeed EntitySeed
The corresponding entity seed (for storage of entities)
Definition: common/entitypointer.hh:378
EntityPointer(const EntityPointer< GridImp, ItImp > &ep)
Templatized copy constructor from arbitrary IteratorImp. This enables that an EntityPointer can be co...
Definition: common/entitypointer.hh:168
Know the grid's dimension.
Definition: common/entitypointer.hh:405
GridImp::template Codim< codimension >::Geometry Geometry
The geometry type of this entity.
Definition: common/entitypointer.hh:375
GridImp::template Codim< cd >::EntityPointer EntityPointer
Definition: common/entitypointer.hh:393
Implementation realIterator
Definition: common/entitypointer.hh:137
GeometryType type() const
Return the name of the reference element. The type can be used to access the Dune::ReferenceElement.
Definition: common/entitypointer.hh:432
GridImp::HierarchicIterator HierarchicIterator
The codim==0 EntityPointer type.
Definition: common/entitypointer.hh:401
ONLY_CODIM0 bool isNew() const
Returns true, if the entity has been created during the last call to adapt()
Definition: common/entitypointer.hh:532
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:282
Know the grid dimension.
Definition: common/entity.hh:108
int level() const DUNE_ENTITYPOINTER_DEPRECATED_MSG
Ask for level of entity.
Definition: common/entitypointer.hh:337
DefaultEntityPointer()
Definition: common/entitypointer.hh:605
ONLY_CODIM0 bool hasBoundaryIntersections() const
Returns true, if entity has intersections with boundary.
Definition: common/entitypointer.hh:544
IteratorImp Implementation
Definition: common/entitypointer.hh:129
EntityPointer()
Default constructor of an empty (undefined) EntityPointer.
Definition: common/entitypointer.hh:173
static void(*)(*)(*)(*)(*)(*) move(const double *)
Definition: partitiondisplay.cc:122
ONLY_CODIM0 HierarchicIterator hbegin(int maxLevel) const
Inter-level access to elements that resulted from (recursive) subdivision of this element...
Definition: common/entitypointer.hh:511
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:183
Definition: common/entitypointer.hh:141
PartitionType partitionType() const
Partition type of this entity.
Definition: common/entitypointer.hh:413
Geometry geometry() const
obtain geometric realization of the entity
Definition: common/entitypointer.hh:427
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:293
Entity operator*() const DUNE_ENTITYPOINTER_DEPRECATED_MSG
Dereferencing operator.
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:539
const Implementation & impl() const
return reference to the real implementation
Definition: common/entitypointer.hh:134
#define DUNE_ENTITYPOINTER_DEPRECATED_MSG
Definition: common/entitypointer.hh:17
Dune::Entity< codim, dim, Grid, EntityImp > Entity
Definition: common/entitypointer.hh:603
Include standard header files.
Definition: agrid.hh:59
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:153
EntityImp< cd, dim, GridImp > Implementation
Definition: common/entity.hh:78
EntityPointer(const IteratorImp &i)
Copy Constructor from an Iterator implementation.
Definition: common/entitypointer.hh:357
EntitySeed seed() const
Return the entity seed which contains sufficient information to generate the entity again and uses as...
Definition: common/entitypointer.hh:437
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:387
Different resources needed by all grid implementations.
#define ONLY_CODIM0
Definition: common/entitypointer.hh:440
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:453
DefaultEntityPointer(EntityImp< codim, dim, Grid > entity)
Definition: common/entitypointer.hh:611
ONLY_CODIM0 LocalGeometry geometryInFather() const
Provides information how this element has been subdivided from its father element.
Definition: common/entitypointer.hh:497