dune-multidomaingrid 2.8
Loading...
Searching...
No Matches
entity.hh
Go to the documentation of this file.
1#ifndef DUNE_MULTIDOMAINGRID_ENTITY_HH
2#define DUNE_MULTIDOMAINGRID_ENTITY_HH
3
4#include <dune/common/deprecated.hh>
5
6#include <dune/grid/common/entity.hh>
7#include <dune/grid/common/gridenums.hh>
8
9namespace Dune {
10
11namespace mdgrid {
12
13template<int codim, int dim, typename GridImp>
14class EntityWrapper;
15
16template<typename GridImp>
18
19template<typename GridImp>
21
22template<typename GridImp>
24
25template<typename, typename>
27
28template<typename HostGrid, typename MDGridTraits>
29class MultiDomainGrid;
30
31template<typename>
32class LevelGridView;
33
34template<typename>
35class LeafGridView;
36
37
38template<typename HostES>
40{
41
42 typedef HostES HostEntitySeed;
43
44 template<typename, typename>
45 friend class MultiDomainGrid;
46
47 template<int, int, typename>
48 friend class EntityWrapper;
49
50public:
51
52 static const std::size_t codimension = HostEntitySeed::codimension;
53
55 {}
56
57 EntitySeedWrapper(const HostEntitySeed& hostEntitySeed)
59 {}
60
61 const HostEntitySeed& hostEntitySeed() const
62 {
63 return _hostEntitySeed;
64 }
65
66 bool isValid() const
67 {
68 return _hostEntitySeed.isValid();
69 }
70
71 HostEntitySeed _hostEntitySeed;
72
73};
74
75
76template<int codim, int dim, typename GridImp>
78 public EntityDefaultImplementation<codim,dim,GridImp,EntityWrapper>
79{
80
81 template<typename,typename>
82 friend class MultiDomainGrid;
83
84 typedef typename GridImp::HostGrid::Traits::template Codim<codim>::Entity HostEntity;
85
86public:
87
88 typedef typename GridImp::template Codim<codim>::Geometry Geometry;
89
91
93 {}
94
95 explicit EntityWrapperBase(const HostEntity& e)
96 : _hostEntity(e)
97 {}
98
99 explicit EntityWrapperBase(HostEntity&& e)
100 : _hostEntity(std::move(e))
101 {}
102
103 int level() const {
104 return _hostEntity.level();
105 }
106
107 PartitionType partitionType() const {
108 return _hostEntity.partitionType();
109 }
110
111 unsigned int subEntities(unsigned int codimSubEntitiy) const {
112 return _hostEntity.subEntities(codimSubEntitiy);
113 }
114
116 return Geometry(_hostEntity.geometry());
117 }
118
119 EntitySeed seed() const {
120 return EntitySeed(_hostEntity.seed());
121 }
122
123 bool equals(const EntityWrapperBase& other) const
124 {
125 return hostEntity() == other.hostEntity();
126 }
127
128private:
129
130 HostEntity _hostEntity;
131
132protected:
133
134 const HostEntity& hostEntity() const {
135 return _hostEntity;
136 }
137
138};
139
140
141template<int codim, int dim, typename GridImp>
143 public EntityWrapperBase<codim,dim,GridImp>
144{
145
147
148 template<typename,typename>
149 friend class MultiDomainGrid;
150
151public:
152
153 // inherit constructors
154 using Base::Base;
155
156};
157
158template<int dim, typename GridImp>
159class EntityWrapper<0,dim,GridImp> :
160 public EntityWrapperBase<0,dim,GridImp>
161{
162
164
165 template<typename,typename>
166 friend class MultiDomainGrid;
167
168 template<typename>
169 friend class LevelGridView;
170
171 template<typename>
172 friend class LeafGridView;
173
174 using Base::hostEntity;
175
176public:
177
178 using LocalGeometry = typename GridImp::template Codim<0>::LocalGeometry;
179 using LeafIntersectionIterator = typename GridImp::Traits::LeafIntersectionIterator;
180 using LevelIntersectionIterator = typename GridImp::Traits::LevelIntersectionIterator;
181 using HierarchicIterator = typename GridImp::Traits::HierarchicIterator;
182
183 // inherit constructors
184 using Base::Base;
185
186 unsigned int subEntities(unsigned int codim) const {
187 return hostEntity().subEntities(codim);
188 }
189
190 template<int cc>
191 typename GridImp::template Codim<cc>::Entity subEntity(int i) const {
192 return {EntityWrapper<cc,dim,GridImp>(hostEntity().template subEntity<cc>(i))};
193 }
194
195 typename GridImp::template Codim<0>::Entity father() const {
196 return {EntityWrapper(hostEntity().father())};
197 }
198
199 bool hasFather() const {
200 return hostEntity().hasFather();
201 }
202
203 bool isLeaf() const {
204 return hostEntity().isLeaf();
205 }
206
207 bool isRegular() const {
208 return hostEntity().isRegular();
209 }
210
212 return LocalGeometry(hostEntity().geometryInFather());
213 }
214
215 HierarchicIterator hbegin(int maxLevel) const {
216 return HierarchicIteratorWrapper<GridImp>(hostEntity().hbegin(maxLevel));
217 }
218
219 HierarchicIterator hend(int maxLevel) const {
220 return HierarchicIteratorWrapper<GridImp>(hostEntity().hend(maxLevel));
221 }
222
225 GridImp,
226 typename GridImp::HostGrid::LevelGridView::IntersectionIterator
227 >(
228 hostEntity().ilevelbegin()
229 );
230 }
231
234 GridImp,
235 typename GridImp::HostGrid::LevelGridView::IntersectionIterator
236 >(
237 hostEntity().ilevelend()
238 );
239 }
240
243 GridImp,
244 typename GridImp::HostGrid::LeafGridView::IntersectionIterator
245 >(
246 hostEntity().ileafbegin()
247 );
248 }
249
252 GridImp,
253 typename GridImp::HostGrid::LeafGridView::IntersectionIterator
254 >(
255 hostEntity().ileafend()
256 );
257 }
258
259 bool isNew() const {
260 return hostEntity().isNew();
261 }
262
263 bool mightVanish() const {
264 return hostEntity().mightVanish();
265 }
266
268 {
269 return hostEntity().hasBoundaryIntersections();
270 }
271
272};
273
274} // namespace mdgrid
275
276} // namespace Dune
277
278#endif // DUNE_MULTIDOMAINGRID_ENTITY_HH
Definition: multidomaingrid.hh:8
@ other
Definition: multidomaingrid/multidomaingrid.hh:1292
Definition: entity.hh:144
Definition: hierarchiciterator.hh:13
Definition: intersectioniterator.hh:16
A meta grid for dividing an existing DUNE grid into subdomains that can be accessed as a grid in thei...
Definition: multidomaingrid/multidomaingrid.hh:241
Definition: gridview.hh:17
Definition: gridview.hh:63
Definition: entity.hh:40
EntitySeedWrapper(const HostEntitySeed &hostEntitySeed)
Definition: entity.hh:57
EntitySeedWrapper()
Definition: entity.hh:54
bool isValid() const
Definition: entity.hh:66
const HostEntitySeed & hostEntitySeed() const
Definition: entity.hh:61
static const std::size_t codimension
Definition: entity.hh:52
HostEntitySeed _hostEntitySeed
Definition: entity.hh:71
Definition: entity.hh:79
GridImp::template Codim< codim >::Geometry Geometry
Definition: entity.hh:88
EntityWrapperBase(HostEntity &&e)
Definition: entity.hh:99
bool equals(const EntityWrapperBase &other) const
Definition: entity.hh:123
EntityWrapperBase()
Definition: entity.hh:92
const HostEntity & hostEntity() const
Definition: entity.hh:134
EntitySeedWrapper< typename HostEntity::EntitySeed > EntitySeed
Definition: entity.hh:90
PartitionType partitionType() const
Definition: entity.hh:107
Geometry geometry() const
Definition: entity.hh:115
unsigned int subEntities(unsigned int codimSubEntitiy) const
Definition: entity.hh:111
EntitySeed seed() const
Definition: entity.hh:119
int level() const
Definition: entity.hh:103
EntityWrapperBase(const HostEntity &e)
Definition: entity.hh:95
GridImp::template Codim< cc >::Entity subEntity(int i) const
Definition: entity.hh:191
bool isRegular() const
Definition: entity.hh:207
LevelIntersectionIterator ilevelend() const
Definition: entity.hh:232
unsigned int subEntities(unsigned int codim) const
Definition: entity.hh:186
typename GridImp::template Codim< 0 >::LocalGeometry LocalGeometry
Definition: entity.hh:178
bool isNew() const
Definition: entity.hh:259
bool hasBoundaryIntersections() const
Definition: entity.hh:267
LeafIntersectionIterator ileafbegin() const
Definition: entity.hh:241
LevelIntersectionIterator ilevelbegin() const
Definition: entity.hh:223
LocalGeometry geometryInFather() const
Definition: entity.hh:211
typename GridImp::Traits::LeafIntersectionIterator LeafIntersectionIterator
Definition: entity.hh:179
bool mightVanish() const
Definition: entity.hh:263
bool hasFather() const
Definition: entity.hh:199
HierarchicIterator hbegin(int maxLevel) const
Definition: entity.hh:215
typename GridImp::Traits::LevelIntersectionIterator LevelIntersectionIterator
Definition: entity.hh:180
GridImp::template Codim< 0 >::Entity father() const
Definition: entity.hh:195
typename GridImp::Traits::HierarchicIterator HierarchicIterator
Definition: entity.hh:181
bool isLeaf() const
Definition: entity.hh:203
HierarchicIterator hend(int maxLevel) const
Definition: entity.hh:219
LeafIntersectionIterator ileafend() const
Definition: entity.hh:250