26#ifndef DUMUX_GEOMETRY_GEOMETRIC_ENTITY_SET_HH
27#define DUMUX_GEOMETRY_GEOMETRIC_ENTITY_SET_HH
30#include <dune/grid/common/mcmgmapper.hh>
31#include <dune/geometry/multilineargeometry.hh>
42template <
class Gr
idView,
int codim = 0,
class Mapper = Dune::MultipleCodimMultipleGeomTypeMapper<Gr
idView>>
47 using Entity =
typename GridView::template Codim<codim>::Entity;
56 , entityMap_(std::make_shared<
EntityMap>(gridView.grid(), mapper_))
61 std::shared_ptr<const EntityMap> entityMap)
64 , entityMap_(entityMap)
75 using ctype =
typename GridView::ctype;
80 decltype(
auto)
size()
const
81 {
return gridView_.size(codim); }
87 {
return entities(gridView_, Dune::Codim<codim>()).begin(); }
92 decltype(
auto)
end()
const
93 {
return entities(gridView_, Dune::Codim<codim>()).end(); }
99 {
return mapper_.index(e); }
105 { assert(index < entityMap_->
size());
return (*entityMap_)[
index]; }
110 std::shared_ptr<const EntityMap> entityMap_;
119template<
class GeoType>
128 using Geometry = GeoType;
133 EntityWrapper(
const Geometry& geo,
const std::size_t
index) : geo_(geo), index_(
index) {}
138 EntityWrapper(Geometry&& geo,
const std::size_t
index) : geo_(std::move(geo)), index_(
index) {}
143 const Geometry& geometry()
const
149 std::size_t
index()
const
165 std::size_t
index = 0;
169 for (
auto&& g : geometries)
170 entities_.emplace_back(g,
index++);
178 std::size_t
index = 0;
179 for (
auto&& g : geometries)
180 entities_.emplace_back(g,
index++);
188 std::size_t
index = 0;
189 for (
auto&& g : geometries)
190 entities_.emplace_back(std::move(g),
index++);
201 using ctype =
typename Entity::Geometry::ctype;
207 {
return entities_.size(); }
213 {
return entities_.begin(); }
218 decltype(
auto)
end()
const
219 {
return entities_.end(); }
224 template<
class Entity>
226 {
return e.index(); }
232 { assert(
index < entities_.size());
return entities_[
index]; }
235 std::vector<Entity> entities_;
A map from indices to entities using grid entity seeds.
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
Definition: deprecated.hh:149
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:44
typename GridView::ctype ctype
the coordinate type
Definition: geometricentityset.hh:75
@ dimensionworld
Definition: geometricentityset.hh:70
GridViewGeometricEntitySet(const GridView &gridView, const Mapper &mapper)
Definition: geometricentityset.hh:53
std::size_t index(const Entity &e) const
get an entities index
Definition: geometricentityset.hh:98
typename GridView::template Codim< codim >::Entity Entity
Definition: geometricentityset.hh:47
decltype(auto) size() const
the number of entities in this set
Definition: geometricentityset.hh:80
GridViewGeometricEntitySet(const GridView &gridView)
Definition: geometricentityset.hh:49
Entity entity(std::size_t index) const
get an entity from an index
Definition: geometricentityset.hh:104
decltype(auto) end() const
end iterator to enable range-based for iteration
Definition: geometricentityset.hh:92
GridViewGeometricEntitySet(const GridView &gridView, const Mapper &mapper, std::shared_ptr< const EntityMap > entityMap)
Definition: geometricentityset.hh:59
decltype(auto) begin() const
begin iterator to enable range-based for iteration
Definition: geometricentityset.hh:86
An interface for a set of geometric entities.
Definition: geometricentityset.hh:121
decltype(auto) end() const
end iterator to enable range-based for iteration
Definition: geometricentityset.hh:218
typename Entity::Geometry::ctype ctype
the coordinate type
Definition: geometricentityset.hh:201
decltype(auto) begin() const
begin iterator to enable range-based for iteration
Definition: geometricentityset.hh:212
decltype(auto) size() const
the number of entities in this set
Definition: geometricentityset.hh:206
const Entity & entity(std::size_t index) const
get an entity from an index
Definition: geometricentityset.hh:231
@ dimensionworld
Definition: geometricentityset.hh:196
EntityWrapper Entity
Definition: geometricentityset.hh:158
std::size_t index(const Entity &e) const
get an entities index
Definition: geometricentityset.hh:225
GeometriesEntitySet(std::initializer_list< typename Entity::Geometry > &&geometries)
Constructor for initializer_list.
Definition: geometricentityset.hh:163
GeometriesEntitySet(const std::vector< typename Entity::Geometry > &geometries)
Constructor for a vector of geometries.
Definition: geometricentityset.hh:176
GeometriesEntitySet(std::vector< typename Entity::Geometry > &&geometries)
Constructor for a vector of geometries.
Definition: geometricentityset.hh:186