24#ifndef DUMUX_ENTITY_INDEX_MAP_HH
25#define DUMUX_ENTITY_INDEX_MAP_HH
29#include <dune/geometry/dimension.hh>
37template <
class Gr
idView,
int codim = 0>
41 using Grid =
typename GridView::Traits::Grid;
42 using Entity =
typename Grid::template Codim<codim>::Entity;
43 using EntitySeed =
typename Grid::template Codim<codim>::EntitySeed;
48 , seeds_(std::move(seeds))
52 template<
class Mapper>
60 void update(std::vector<EntitySeed>&& seeds)
61 { seeds_.swap(std::move(seeds)); }
64 template<
class Mapper>
67 const auto& gv = grid_.leafGridView();
68 seeds_.resize(gv.size(codim));
69 for (
const auto& entity : entities(gv, Dune::Codim<codim>()))
70 seeds_[mapper.index(entity)] = entity.seed();
75 {
return grid_.entity(seeds_[i]); }
79 {
return seeds_.size(); }
83 std::vector<EntitySeed> seeds_;
86template<
class Gr
idView>
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
A map from indices to entities using grid entity seeds.
Definition: entitymap.hh:39
typename Grid::template Codim< codim >::EntitySeed EntitySeed
Definition: entitymap.hh:43
typename GridView::Traits::Grid Grid
Definition: entitymap.hh:41
std::size_t size() const
get the size of the map
Definition: entitymap.hh:78
EntityMap(const Grid &grid, std::vector< EntitySeed > &&seeds)
constructor moving a ready seed list in here
Definition: entitymap.hh:46
Entity operator[](std::size_t i) const
get an element from an index i
Definition: entitymap.hh:74
void update(std::vector< EntitySeed > &&seeds)
update the map after the grid changed
Definition: entitymap.hh:60
EntityMap(const Grid &grid, const Mapper &mapper)
constructor with all entities of codim
Definition: entitymap.hh:53
void update(const Mapper &mapper)
update the map after the grid changed
Definition: entitymap.hh:65
typename Grid::template Codim< codim >::Entity Entity
Definition: entitymap.hh:42