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 { assert(index < entityMap_->
size());
return (*entityMap_)[
index]; }
108 std::shared_ptr<const EntityMap> entityMap_;
117template<
class GeoType>
126 using Geometry = GeoType;
131 EntityWrapper(
const Geometry& geo,
const std::size_t
index) : geo_(geo), index_(
index) {}
136 EntityWrapper(Geometry&& geo,
const std::size_t
index) : geo_(std::move(geo)), index_(
index) {}
141 const Geometry& geometry()
const
147 std::size_t
index()
const
163 std::size_t
index = 0;
167 for (
auto&& g : geometries)
168 entities_.emplace_back(g,
index++);
176 std::size_t
index = 0;
177 for (
auto&& g : geometries)
178 entities_.emplace_back(g,
index++);
186 std::size_t
index = 0;
187 for (
auto&& g : geometries)
188 entities_.emplace_back(std::move(g),
index++);
199 using ctype =
typename Entity::Geometry::ctype;
205 {
return entities_.size(); }
211 {
return entities_.begin(); }
216 decltype(
auto)
end()
const
217 {
return entities_.end(); }
222 template<
class Entity>
224 {
return e.index(); }
230 { assert(
index < entities_.size());
return entities_[
index]; }
233 std::vector<Entity> entities_;
A map from indices to entities using grid entity seeds.
Definition: common/pdesolver.hh:36
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: geometricentityset.hh:42
typename GridView::ctype ctype
the coordinate type
Definition: geometricentityset.hh:73
GridViewGeometricEntitySet(const GridView &gridView, const Mapper &mapper)
Definition: geometricentityset.hh:51
std::size_t index(const Entity &e) const
get an entities index
Definition: geometricentityset.hh:96
typename GridView::template Codim< codim >::Entity Entity
Definition: geometricentityset.hh:45
@ dimensionworld
Definition: geometricentityset.hh:68
decltype(auto) size() const
the number of entities in this set
Definition: geometricentityset.hh:78
GridViewGeometricEntitySet(const GridView &gridView)
Definition: geometricentityset.hh:47
Entity entity(std::size_t index) const
get an entity from an index
Definition: geometricentityset.hh:102
decltype(auto) end() const
end iterator to enable range-based for iteration
Definition: geometricentityset.hh:90
GridViewGeometricEntitySet(const GridView &gridView, const Mapper &mapper, std::shared_ptr< const EntityMap > entityMap)
Definition: geometricentityset.hh:57
decltype(auto) begin() const
begin iterator to enable range-based for iteration
Definition: geometricentityset.hh:84
An interface for a set of geometric entities.
Definition: geometricentityset.hh:119
decltype(auto) end() const
end iterator to enable range-based for iteration
Definition: geometricentityset.hh:216
typename Entity::Geometry::ctype ctype
the coordinate type
Definition: geometricentityset.hh:199
decltype(auto) begin() const
begin iterator to enable range-based for iteration
Definition: geometricentityset.hh:210
decltype(auto) size() const
the number of entities in this set
Definition: geometricentityset.hh:204
const Entity & entity(std::size_t index) const
get an entity from an index
Definition: geometricentityset.hh:229
EntityWrapper Entity
Definition: geometricentityset.hh:156
std::size_t index(const Entity &e) const
get an entities index
Definition: geometricentityset.hh:223
GeometriesEntitySet(std::initializer_list< typename Entity::Geometry > &&geometries)
Constructor for initializer_list.
Definition: geometricentityset.hh:161
GeometriesEntitySet(const std::vector< typename Entity::Geometry > &geometries)
Constructor for a vector of geometries.
Definition: geometricentityset.hh:174
GeometriesEntitySet(std::vector< typename Entity::Geometry > &&geometries)
Constructor for a vector of geometries.
Definition: geometricentityset.hh:184
@ dimensionworld
Definition: geometricentityset.hh:194