1#ifndef DUNE_PDELAB_COMMON_ELEMENTMAPPER_HH
2#define DUNE_PDELAB_COMMON_ELEMENTMAPPER_HH
19 template<
typename GV,
bool has_single_cell_type>
20 class ElementMapperBase
25 typedef typename GV::template Codim<0>::Entity Element;
26 typedef std::size_t size_type;
30 static const size_type dim = GV::dimension;
31 typedef typename GV::IndexSet IndexSet;
38 std::fill(_gt_offsets.begin(),_gt_offsets.end(),0);
41 for (
auto gt : _index_set.types(0))
47 std::partial_sum(_gt_offsets.begin(),_gt_offsets.end(),_gt_offsets.begin());
50 size_type map(
const Element& e)
const
55 ElementMapperBase(
const GV& gv)
56 : _gt_offsets(LocalGeometryTypeIndex::size(dim) + 1)
57 , _index_set(gv.indexSet())
64 std::vector<size_type> _gt_offsets;
65 const IndexSet& _index_set;
71 class ElementMapperBase<GV,true>
76 typedef typename GV::template Codim<0>::Entity Element;
77 typedef typename GV::IndexSet IndexSet;
78 typedef std::size_t size_type;
83 size_type map(
const Element& e)
const
85 return _index_set.index(e);
88 ElementMapperBase(
const GV& gv)
89 : _index_set(gv.indexSet())
94 const IndexSet& _index_set;
112 template<
typename GV>
114 :
public ElementMapperBase<GV,
115 Dune::Capabilities::hasSingleGeometryType<
121 typedef ElementMapperBase<
155 return BaseT::map(e);
static constexpr std::size_t index(const GeometryType >)
Compute the index for the given geometry type within its dimension.
Definition: typeindex.hh:68
Class providing a consecutive index for codim 0 entities of a GridView.
Definition: elementmapper.hh:119
BaseT::size_type size_type
The type of the returned index.
Definition: elementmapper.hh:131
ElementMapper(const GV &gv)
Construct a CellIndexProvider for the given GridView.
Definition: elementmapper.hh:140
BaseT::Element Element
The type of the codim 0 entities of the GridView.
Definition: elementmapper.hh:134
size_type map(const Element &e) const
Return the index of the given element.
Definition: elementmapper.hh:153
A set of traits classes to store static information about grid implementation.
bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater than second
Definition: float_cmp.cc:156
Dune namespace.
Definition: alignedallocator.hh:14
Specialize with 'true' for if the codimension 0 entity of the grid has only one possible geometry typ...
Definition: capabilities.hh:25
A unique label for each type of element that can occur in a grid.
Helper classes to provide indices for geometrytypes for use in a vector.