3 #ifndef DUNE_GRID_ENTITY_HH
4 #define DUNE_GRID_ENTITY_HH
6 #include <dune/common/iteratorrange.hh>
7 #include <dune/common/typetraits.hh>
9 #include <dune/geometry/dimension.hh>
60 template<
int cd,
int dim,
class Gr
idImp,
template<
int,
int,
class>
class EntityImp>
63 #if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
69 GridImp::
dimension, GridImp::dimensionworld,
70 typename GridImp::ctype,
71 typename GridImp::GridFamily> ;
97 typedef typename GridImp::template Codim<cd>::Geometry
Geometry;
100 typedef typename GridImp::template Codim<cd>::EntitySeed
EntitySeed;
125 int level ()
const {
return realEntity.level(); }
142 Geometry
geometry ()
const {
return realEntity.geometry(); }
152 EntitySeed
seed ()
const {
return realEntity.seed(); }
171 template<
typename ItImp>
172 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.")
175 return (*
this) == (*other);
183 template<
typename ItImp>
184 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.")
187 return (*
this) != (*other);
195 : realEntity(other.realEntity)
200 : realEntity(
std::
move(other.realEntity))
213 realEntity =
std::move(other.realEntity);
223 DUNE_DEPRECATED_MSG("This is now an
Entity instead of an
EntityPointer. You do not have to dereference it anymore!")
234 DUNE_DEPRECATED_MSG("This is now an
Entity instead of an
EntityPointer. You do not have to dereference it anymore!")
248 Entity(
const EntityImp<cd,dim,GridImp> & e) : realEntity(e) {}
276 template<
int dim,
class Gr
idImp,
template<
int,
int,
class>
class EntityImp>
279 #if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
285 GridImp::
dimension, GridImp::dimensionworld,
286 typename GridImp::ctype,
287 typename GridImp::GridFamily> ;
313 typedef typename GridImp::template Codim<0>::Geometry
Geometry;
316 typedef typename GridImp::template Codim<0>::EntitySeed
EntitySeed;
363 int level ()
const {
return realEntity.level(); }
369 Geometry
geometry ()
const {
return realEntity.geometry(); }
379 EntitySeed
seed ()
const {
return realEntity.seed(); }
398 template<
typename ItImp>
399 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.")
400 bool operator==(const
Dune::EntityPointer<GridImp,ItImp>& other)
const
402 return (*
this) == (*other);
410 template<
typename ItImp>
411 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.")
412 bool operator!=(const
Dune::EntityPointer<GridImp,ItImp>& other)
const
414 return (*
this) != (*other);
422 : realEntity(other.realEntity)
427 : realEntity(
std::
move(other.realEntity))
440 realEntity =
std::move(other.realEntity);
450 DUNE_DEPRECATED_MSG("This is now an
Entity instead of an EntityPointer. You do not have to dereference it anymore!")
461 DUNE_DEPRECATED_MSG("This is now an
Entity instead of an EntityPointer. You do not have to dereference it anymore!")
482 template<
int codim>
int DUNE_DEPRECATED_MSG(
"Use subEntities(unsigned int) instead!") count ()
const {
return realEntity.template count<codim>(); }
491 return realEntity.subEntities(codim);
503 template <
int codim_>
504 struct subentity_return_info
512 static_cast<Implementation*>(
nullptr)->
template subEntity<codim_>(0)
513 ) implementation_return_type;
518 typedef typename
std::conditional<
520 implementation_return_type,
524 typename Entity::template Codim<codim_>::EntityPointer
540 template<
int codim >
542 typename Codim< codim >::Entity
544 typename subentity_return_info<codim>::type
548 warnOnDeprecatedEntityPointer<typename subentity_return_info<codim>::type>();
549 return realEntity.template subEntity< codim >( i );
565 template<
typename Foo =
void>
566 typename std::conditional<
568 decltype(realEntity.father()),
574 father (
typename std::enable_if<std::is_same<Foo,void>::value,
void*>::type =
nullptr) const
577 warnOnDeprecatedEntityPointer<decltype(realEntity.father())>();
578 return realEntity.father();
586 return realEntity.hasFather();
592 return realEntity.isLeaf();
598 bool isRegular()
const {
return realEntity.isRegular(); }
638 HierarchicIterator
hbegin (
int maxLevel)
const
640 return realEntity.hbegin(maxLevel);
650 HierarchicIterator
hend (
int maxLevel)
const
652 return realEntity.hend(maxLevel);
657 bool isNew ()
const {
return realEntity.isNew(); }
677 Entity(
const EntityImp<0,dim,GridImp> & e) : realEntity(e) {}
696 static typename std::enable_if<
699 typename Codim<E::codimension>::Entity
702 warnOnDeprecatedEntityPointer()
706 DUNE_DEPRECATED_MSG(
"This grid still returns EntityPointers instead of Entities")
707 static typename
std::enable_if<
713 warnOnDeprecatedEntityPointer()
737 template<
int cd,
int dim,
class Gr
idImp,
template<
int,
int,
class>
class EntityImp>
751 typedef typename GridImp::template Codim<cd>::EntitySeed
EntitySeed;
763 EntityImp<cd,dim,GridImp>& asImp ()
765 return static_cast<EntityImp<cd,dim,GridImp>&
>(*this);
767 const EntityImp<cd,dim,GridImp>& asImp ()
const
769 return static_cast<const EntityImp<cd,dim,GridImp>&
>(*this);
784 template<
int dim,
class Gr
idImp,
template<
int,
int,
class>
class EntityImp>
798 typedef typename GridImp::template Codim<0>::EntitySeed
EntitySeed;
815 bool isNew ()
const {
return false; }
829 IntersectionIterator end = asImp().ilevelend();
830 for(IntersectionIterator it = asImp().ilevelbegin(); it != end; ++it)
832 if( it->boundary() )
return true;
838 IntersectionIterator end = asImp().ileafend();
839 for(IntersectionIterator it = asImp().ileafbegin(); it != end; ++it)
841 if( it->boundary() )
return true;
850 EntityImp<0,dim,GridImp>& asImp () {
return static_cast<EntityImp<0,dim,GridImp>&
>(*this); }
851 const EntityImp<0,dim,GridImp>& asImp ()
const {
return static_cast<const EntityImp<0,dim,GridImp>&
>(*this); }
856 #endif // DUNE_GRID_ENTITY_HH
Entity & operator=(Entity &&other)
Move assignment operator from an existing entity.
Definition: common/entity.hh:438
bool isRegular() const
Returns true if element is of regular type in red/green type refinement. In bisection or hanging node...
Definition: common/entity.hh:598
GridImp::template Codim< 0 >::EntitySeed EntitySeed
The corresponding entity seed (for storage of entities)
Definition: common/entity.hh:316
Entity()
Definition: common/entity.hh:190
Entity & operator=(const Entity &other)
Copy assignment operator from an existing entity.
Definition: common/entity.hh:431
Know the grid dimension.
Definition: common/entity.hh:108
Wrapper class for pointers to entities.
Definition: common/entitypointer.hh:112
Definition: common/geometry.hh:24
GridImp::template Codim< 0 >::Geometry Geometry
The geometry type of this entity.
Definition: common/entity.hh:313
bool mightVanish() const
Returns true, if entity might disappear during the next call to adapt()
Definition: common/entity.hh:819
unsigned int subEntities(unsigned int codim) const
Number of subentities with codimension codim.
Definition: common/entity.hh:489
Know your own codimension.
Definition: common/entity.hh:104
GridImp::template Codim< cd >::EntityPointer EntityPointer
The corresponding entity seed (for storage of entities)
Definition: common/entity.hh:754
bool isRegular() const
Returns true if element is of regular type in red/green type refinement. In bisection or hanging node...
Definition: common/entity.hh:806
Entity & operator=(Entity &&other)
Move assignment operator from an existing entity.
Definition: common/entity.hh:211
Mesh entities of codimension 0 ("elements") allow to visit all intersections with "neighboring" eleme...
Definition: common/grid.hh:360
GridImp::template Codim< 0 >::EntityPointer EntityPointer
The codim==0 EntityPointer type.
Definition: common/entity.hh:336
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
EntitySeed seed() const
Return the entity seed which contains sufficient information to generate the entity again and uses as...
Definition: common/entity.hh:152
GeometryType type() const
Return the name of the reference element. The type can be used to access the Dune::ReferenceElement.
Definition: common/entity.hh:374
Default Implementations for EntityImp.
Definition: common/entity.hh:738
Dimensionality of the reference element of the entity.
Definition: common/entity.hh:112
const Entity * operator->() const
Dereference Entity to itself for backwards compatibility with EntityPointer.
Definition: common/entity.hh:233
Include standard header files.
Definition: agrid.hh:59
Implementation & impl()
Return reference to the real implementation.
Definition: common/entity.hh:81
int level() const
The level of this entity.
Definition: common/entity.hh:363
Entity(const EntityImp< cd, dim, GridImp > &e)
Copy constructor from EntityImp.
Definition: common/entity.hh:248
Entity(Entity &&other)
Move constructor from an existing entity.
Definition: common/entity.hh:426
GeometryType type() const
Return the name of the reference element. The type can be used to access the Dune::ReferenceElement.
Definition: common/entity.hh:147
bool mightVanish() const
Returns true, if entity might disappear during the next call to adapt(). If the method returns false...
Definition: common/entity.hh:663
bool operator!=(const Entity &other) const
Compares two entities for inequality.
Definition: common/entity.hh:388
bool hasFather() const
Return true if entity has a father entity which can be accessed using the father() method...
Definition: common/entity.hh:584
static void(*)(*)(*)(*)(*)(*) move(const double *)
Definition: partitiondisplay.cc:122
const Implementation & impl() const
Return const reference to the real implementation.
Definition: common/entity.hh:299
EntityImp< cd, dim, Grid > Implementation
Definition: common/entity.hh:78
Geometry geometry() const
obtain geometric realization of the entity
Definition: common/entity.hh:142
GridImp::template Codim< 0 >::LocalGeometry LocalGeometry
The geometry type of this entity when the geometry is expressed embedded in the father element...
Definition: common/entity.hh:325
GridImp::template Codim< 0 >::EntitySeed EntitySeed
The corresponding entity seed (for storage of entities)
Definition: common/entity.hh:798
PartitionType partitionType() const
Partition type of this entity.
Definition: common/entity.hh:366
Entity(const Entity &other)
Copy constructor from an existing entity.
Definition: common/entity.hh:421
bool hasBoundaryIntersections() const
Returns true, if entity has intersections with boundary, this implementation uses the Level- and Leaf...
Definition: common/entity.hh:825
GridImp::template Codim< 0 >::EntityPointer EntityPointer
The corresponding entity seed (for storage of entities)
Definition: common/entity.hh:801
bool isNew() const
Returns true, if the entity has been created during the last call to adapt()
Definition: common/entity.hh:815
Different resources needed by all grid implementations.
Implementation realEntity
Definition: common/entity.hh:86
GridImp::template Codim< cd >::EntitySeed EntitySeed
The corresponding entity seed (for storage of entities)
Definition: common/entity.hh:751
Codim< codim >::Entity subEntity(int i) const
Obtain a pointer to a subentity.
Definition: common/entity.hh:546
Definition: defaultgridview.hh:16
Entity(const EntityImp< 0, dim, GridImp > &e)
Copy constructor from EntityImp.
Definition: common/entity.hh:677
HierarchicIterator hend(int maxLevel) const
Returns iterator to one past the last son element.
Definition: common/entity.hh:650
Wrapper and interface class for a static iterator (EntityPointer)
GeometryType type() const
Return the name of the reference element. The type can be used to access the Dune::ReferenceElement.
Definition: common/entity.hh:759
Entity & operator=(const Entity &other)
Copy assignment operator from an existing entity.
Definition: common/entity.hh:204
Entity(Entity &&other)
Move constructor from an existing entity.
Definition: common/entity.hh:199
PartitionType partitionType() const
Partition type of this entity.
Definition: common/entity.hh:128
Entity father() const
Inter-level access to father entity on the next-coarser grid. The given entity resulted directly from...
Definition: common/entity.hh:563
bool operator==(const Entity &other) const
Compares two entities for equality.
Definition: common/entity.hh:382
Implementation realEntity
Definition: common/entity.hh:302
bool isNew() const
Returns true, if the entity has been created during the last call to adapt()
Definition: common/entity.hh:657
bool isLeaf() const
Returns true if the entity is contained in the leaf grid.
Definition: common/entity.hh:590
EntitySeed seed() const
Return the entity seed which contains sufficient information to generate the entity again and uses as...
Definition: common/entity.hh:379
GridImp::HierarchicIterator HierarchicIterator
The HierarchicIterator type.
Definition: common/entity.hh:339
const Entity * operator->() const
Dereference Entity to itself for backwards compatibility with EntityPointer.
Definition: common/entity.hh:460
bool hasBoundaryIntersections() const
Returns true, if entity has intersections with boundary.
Definition: common/entity.hh:667
HierarchicIterator hbegin(int maxLevel) const
Inter-level access to elements that resulted from (recursive) subdivision of this element...
Definition: common/entity.hh:638
Geometry geometry() const
obtain geometric realization of the entity
Definition: common/entity.hh:369
Entity(const Entity &other)
Copy constructor from an existing entity.
Definition: common/entity.hh:194
Entity()
Definition: common/entity.hh:417
int level() const
The level of this entity.
Definition: common/entity.hh:125
bool operator!=(const Entity &other) const
Compares two entities for inequality.
Definition: common/entity.hh:161
PartitionType
Attributes used in the generic overlap model.
Definition: gridenums.hh:28
const Entity & operator*() const
Dereference Entity to itself for backwards compatibility with EntityPointer.
Definition: common/entity.hh:449
GridImp::template Codim< cd >::EntityPointer EntityPointer
Definition: common/entity.hh:331
const Implementation & impl() const
Return const reference to the real implementation.
Definition: common/entity.hh:83
Entity(EntityImp< 0, dim, GridImp > &&e)
Move constructor from EntityImp.
Definition: common/entity.hh:680
const Entity & operator*() const
Dereference Entity to itself for backwards compatibility with EntityPointer.
Definition: common/entity.hh:222
Definition: defaultgridview.hh:19
bool operator==(const Entity &other) const
Compares two entities for equality.
Definition: common/entity.hh:155
LocalGeometry geometryInFather() const
Provides information how this element has been subdivided from its father element.
Definition: common/entity.hh:625
GridImp::template Codim< cd >::Entity Entity
Definition: common/entity.hh:332
GridImp::template Codim< cd >::Geometry Geometry
The corresponding geometry type.
Definition: common/entity.hh:97
GeometryType type() const
Return the name of the reference element. The type can be used to access the Dune::ReferenceElement.
Definition: common/entity.hh:811
Entity(EntityImp< cd, dim, GridImp > &&e)
Move constructor from EntityImp.
Definition: common/entity.hh:251
Wrapper class for entities.
Definition: common/entity.hh:61
GridImp::template Codim< cd >::EntitySeed EntitySeed
The corresponding entity seed (for storage of entities)
Definition: common/entity.hh:100