24#ifndef DUMUX_GEOMETRY_GEOMETRIC_ENTITY_SET_HH
25#define DUMUX_GEOMETRY_GEOMETRIC_ENTITY_SET_HH
28#include <dune/grid/common/mcmgmapper.hh>
29#include <dune/geometry/multilineargeometry.hh>
40template <
class Gr
idView,
int codim = 0,
class Mapper = Dune::MultipleCodimMultipleGeomTypeMapper<Gr
idView>>
45 using Entity =
typename GridView::template Codim<codim>::Entity;
54 , entityMap_(std::make_shared<
EntityMap>(gridView.grid(), mapper_))
59 std::shared_ptr<const EntityMap> entityMap)
62 , entityMap_(entityMap)
73 using ctype =
typename GridView::ctype;
78 decltype(
auto)
size()
const
79 {
return gridView_.size(codim); }
85 {
return entities(gridView_, Dune::Codim<codim>()).begin(); }
90 decltype(
auto)
end()
const
91 {
return entities(gridView_, Dune::Codim<codim>()).end(); }
97 {
return mapper_.index(e); }
103 {
return (*entityMap_)[
index]; }
108 std::shared_ptr<const EntityMap> entityMap_;
118template<
class GeoType>
127 using Geometry = GeoType;
132 EntityWrapper(
const Geometry& geo,
const std::size_t
index) : geo_(geo), index_(
index) {}
137 EntityWrapper(Geometry&& geo,
const std::size_t
index) : geo_(std::move(geo)), index_(
index) {}
142 const Geometry& geometry()
const
148 std::size_t
index()
const
164 std::size_t
index = 0;
168 for (
auto&& g : geometries)
169 entities_.emplace_back(g,
index++);
177 std::size_t
index = 0;
178 for (
auto&& g : geometries)
179 entities_.emplace_back(g,
index++);
187 std::size_t
index = 0;
188 for (
auto&& g : geometries)
189 entities_.emplace_back(std::move(g),
index++);
200 using ctype =
typename Entity::Geometry::ctype;
206 {
return entities_.size(); }
212 {
return entities_.begin(); }
217 decltype(
auto)
end()
const
218 {
return entities_.end(); }
223 template<
class Entity>
225 {
return e.index(); }
231 {
return entities_[
index]; }
234 std::vector<Entity> entities_;
A map from indices to entities using grid entity seeds.
Definition: common/pdesolver.hh:35
A map from indices to entities using grid entity seeds.
Definition: entitymap.hh:39
An interface for a set of geometric entities based on a GridView.
Definition: geometry/geometricentityset.hh:42
typename GridView::ctype ctype
the coordinate type
Definition: geometry/geometricentityset.hh:73
GridViewGeometricEntitySet(const GridView &gridView, const Mapper &mapper)
Definition: geometry/geometricentityset.hh:51
std::size_t index(const Entity &e) const
get an entities index
Definition: geometry/geometricentityset.hh:96
typename GridView::template Codim< codim >::Entity Entity
Definition: geometry/geometricentityset.hh:45
@ dimensionworld
Definition: geometry/geometricentityset.hh:68
decltype(auto) size() const
the number of entities in this set
Definition: geometry/geometricentityset.hh:78
GridViewGeometricEntitySet(const GridView &gridView)
Definition: geometry/geometricentityset.hh:47
Entity entity(std::size_t index) const
get an entity from an index
Definition: geometry/geometricentityset.hh:102
decltype(auto) end() const
end iterator to enable range-based for iteration
Definition: geometry/geometricentityset.hh:90
GridViewGeometricEntitySet(const GridView &gridView, const Mapper &mapper, std::shared_ptr< const EntityMap > entityMap)
Definition: geometry/geometricentityset.hh:57
decltype(auto) begin() const
begin iterator to enable range-based for iteration
Definition: geometry/geometricentityset.hh:84
An interface for a set of geometric entities.
Definition: geometry/geometricentityset.hh:120
decltype(auto) end() const
end iterator to enable range-based for iteration
Definition: geometry/geometricentityset.hh:217
typename Entity::Geometry::ctype ctype
the coordinate type
Definition: geometry/geometricentityset.hh:200
decltype(auto) begin() const
begin iterator to enable range-based for iteration
Definition: geometry/geometricentityset.hh:211
decltype(auto) size() const
the number of entities in this set
Definition: geometry/geometricentityset.hh:205
@ dimensionworld
Definition: geometry/geometricentityset.hh:195
EntityWrapper Entity
Definition: geometry/geometricentityset.hh:157
std::size_t index(const Entity &e) const
get an entities index
Definition: geometry/geometricentityset.hh:224
GeometriesEntitySet(std::initializer_list< typename Entity::Geometry > &&geometries)
Constructor for initializer_list.
Definition: geometry/geometricentityset.hh:162
Entity entity(std::size_t index) const
get an entity from an index
Definition: geometry/geometricentityset.hh:230
GeometriesEntitySet(const std::vector< typename Entity::Geometry > &geometries)
Constructor for a vector of geometries.
Definition: geometry/geometricentityset.hh:175
GeometriesEntitySet(std::vector< typename Entity::Geometry > &&geometries)
Constructor for a vector of geometries.
Definition: geometry/geometricentityset.hh:185