1#ifndef DUNE_MULTIDOMAINGRID_SUBDOMAINGRID_INDEXSETS_HH
2#define DUNE_MULTIDOMAINGRID_SUBDOMAINGRID_INDEXSETS_HH
4#include <unordered_map>
11#include <dune/grid/common/indexidset.hh>
12#include <dune/grid/multidomaingrid/utility.hh>
22template<
typename MDGr
id>
26template<
typename Gr
idImp,
typename MDIndexSet>
27class IndexSetWrapper :
28 public Dune::IndexSet<GridImp,IndexSetWrapper<GridImp,MDIndexSet>,
29 typename MDIndexSet::IndexType,
30 typename MDIndexSet::Types>
33 template<
typename,
typename>
34 friend class IndexSetWrapper;
36 template<
typename MDGr
id>
37 friend class SubDomainGrid;
39 template<
typename,
typename,
typename>
40 friend class IntersectionWrapper;
42 template<
typename,
typename,
int, PartitionIteratorType,
typename>
43 friend class IteratorWrapper;
45 typedef IndexSetWrapper<GridImp,MDIndexSet> ThisType;
47 using HostGrid =
typename std::remove_const_t<GridImp>::HostGrid;
48 using MDGrid =
typename std::remove_const_t<GridImp>::MultiDomainGrid;
49 using ctype =
typename std::remove_const_t<GridImp>::ctype;
53 typedef typename MDIndexSet::Types Types;
55 using SubDomainIndex =
typename std::remove_const_t<GridImp>::SubDomainIndex;
56 typedef typename MDIndexSet::IndexType IndexType;
57 static const int dimension = std::remove_const_t<GridImp>::dimension;
61 using Codim0Entity =
typename std::remove_const_t<GridImp>::Traits::template Codim<0>::Entity;
66 IndexType index(
const typename std::remove_const_t<GridImp>::Traits::template Codim<codim>::Entity& e)
const {
67 return _mdIndexSet.template index<codim>(_grid.domain(),_grid.multiDomainEntity(e));
70 template<
typename Entity>
71 IndexType index(
const Entity& e)
const {
72 return _mdIndexSet.template index<Entity::codimension>(_grid.domain(),_grid.multiDomainEntity(e));
75 template<
int cc,
typename Entity>
76 IndexType subIndex(
const Entity& e,
int i,
unsigned int codim)
const {
77 return _mdIndexSet.template subIndex<cc>(_grid.domain(),_grid.multiDomainEntity(e),i,codim);
80 template<
typename Entity>
81 IndexType subIndex(
const Entity& e,
int i,
unsigned int codim)
const {
82 return _mdIndexSet.subIndex(_grid.domain(),_grid.multiDomainEntity(e),i,codim);
85 Types types(
int codim)
const {
86 return _mdIndexSet.types(_grid.domain(),codim);
89 IndexType size(GeometryType type)
const {
90 return _mdIndexSet.sizeForSubDomain(_grid.domain(),type);
93 IndexType size(
int codim)
const {
94 return _mdIndexSet.sizeForSubDomain(_grid.domain(),codim);
97 template<
typename EntityType>
98 bool contains(
const EntityType& e)
const {
99 return _mdIndexSet.contains(_grid.domain(),_grid.multiDomainEntity(e));
102 bool operator==(
const IndexSetWrapper& rhs)
const {
103 return (_grid == rhs._grid && &_mdIndexSet == &rhs._mdIndexSet);
106 IndexSetWrapper(
const GridImp& grid,
const MDIndexSet& mdIndexSet) :
108 _mdIndexSet(mdIndexSet)
113 const GridImp& _grid;
114 const MDIndexSet& _mdIndexSet;
116 template<
typename EntityType>
117 bool containsHostEntity(
const EntityType& he)
const {
118 return _mdIndexSet.containsForSubDomain(_grid.domain(),he);
121 template<
typename EntityType>
122 bool containsMultiDomainEntity(
const EntityType& mde)
const {
123 return _mdIndexSet.contains(_grid.domain(),mde);