Loading [MathJax]/extensions/MathMenu.js

DUNE MultiDomainGrid (unstable)

indexsets.hh
1#ifndef DUNE_MULTIDOMAINGRID_SUBDOMAINGRID_INDEXSETS_HH
2#define DUNE_MULTIDOMAINGRID_SUBDOMAINGRID_INDEXSETS_HH
3
4#include <unordered_map>
5#include <vector>
6#include <array>
7#include <algorithm>
8#include <type_traits>
9#include <tuple>
10
11#include <dune/grid/common/indexidset.hh>
12#include <dune/grid/multidomaingrid/utility.hh>
13
14#include <type_traits>
15
16namespace Dune {
17
18namespace mdgrid {
19
20namespace subdomain {
21
22template<typename MDGrid>
23class SubDomainGrid;
24
25
26template<typename GridImp, typename MDIndexSet>
27class IndexSetWrapper :
28 public Dune::IndexSet<GridImp,IndexSetWrapper<GridImp,MDIndexSet>,
29 typename MDIndexSet::IndexType,
30 typename MDIndexSet::Types>
31{
32
33 template<typename, typename>
34 friend class IndexSetWrapper;
35
36 template<typename MDGrid>
37 friend class SubDomainGrid;
38
39 template<typename, typename, typename>
40 friend class IntersectionWrapper;
41
42 template<typename, typename, int, PartitionIteratorType, typename>
43 friend class IteratorWrapper;
44
45 typedef IndexSetWrapper<GridImp,MDIndexSet> ThisType;
46
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;
50
51public:
52
53 typedef typename MDIndexSet::Types Types;
54
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;
58
59private:
60
61 using Codim0Entity = typename std::remove_const_t<GridImp>::Traits::template Codim<0>::Entity;
62
63public:
64
65 template<int codim>
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));
68 }
69
70 template<typename Entity>
71 IndexType index(const Entity& e) const {
72 return _mdIndexSet.template index<Entity::codimension>(_grid.domain(),_grid.multiDomainEntity(e));
73 }
74
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);
78 }
79
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);
83 }
84
85 Types types(int codim) const {
86 return _mdIndexSet.types(_grid.domain(),codim);
87 }
88
89 IndexType size(GeometryType type) const {
90 return _mdIndexSet.sizeForSubDomain(_grid.domain(),type);
91 }
92
93 IndexType size(int codim) const {
94 return _mdIndexSet.sizeForSubDomain(_grid.domain(),codim);
95 }
96
97 template<typename EntityType>
98 bool contains(const EntityType& e) const {
99 return _mdIndexSet.contains(_grid.domain(),_grid.multiDomainEntity(e));
100 }
101
102 bool operator==(const IndexSetWrapper& rhs) const {
103 return (_grid == rhs._grid && &_mdIndexSet == &rhs._mdIndexSet);
104 }
105
106 IndexSetWrapper(const GridImp& grid, const MDIndexSet& mdIndexSet) :
107 _grid(grid),
108 _mdIndexSet(mdIndexSet)
109 {}
110
111private:
112
113 const GridImp& _grid;
114 const MDIndexSet& _mdIndexSet;
115
116 template<typename EntityType>
117 bool containsHostEntity(const EntityType& he) const {
118 return _mdIndexSet.containsForSubDomain(_grid.domain(),he);
119 }
120
121 template<typename EntityType>
122 bool containsMultiDomainEntity(const EntityType& mde) const {
123 return _mdIndexSet.contains(_grid.domain(),mde);
124 }
125
126};
127
128} // namespace subdomain
129
130} // namespace mdgrid
131
132} // namespace Dune
133
134#endif // DUNE_MULTIDOMAINGRID_SUBDOMAINGRID_INDEXSETS_HH
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (Apr 7, 22:57, 2025)