dune-alugrid 3.0.0
gridview.hh
Go to the documentation of this file.
1#ifndef DUNE_ALUGRID_3D_GRIDVIEW_HH
2#define DUNE_ALUGRID_3D_GRIDVIEW_HH
3
4#include <type_traits>
5
6#include <dune/common/exceptions.hh>
7
8#include <dune/grid/common/capabilities.hh>
9#include <dune/grid/common/gridview.hh>
10
11namespace Dune
12{
13
14 template< class GridImp, PartitionIteratorType pitype >
15 class ALU3dLevelGridView;
16
17 template< class GridImp, PartitionIteratorType pitype >
18 class ALU3dLeafGridView;
19
20
21 template< class GridImp, PartitionIteratorType pitype >
23 {
25
27 typedef typename std::remove_const<GridImp>::type Grid;
28
30 typedef typename Grid :: Traits :: LevelIndexSet IndexSet;
31
33 typedef typename Grid :: Traits :: LevelIntersection Intersection;
34
36 typedef typename Grid :: Traits :: LevelIntersectionIterator
38
40 typedef typename Grid :: Traits :: CollectiveCommunication CollectiveCommunication;
41
42 template< int cd >
43 struct Codim
44 {
45 typedef typename Grid::Traits::template Codim< cd >::Twists Twists;
46 typedef typename Twists::Twist Twist;
47
48 typedef typename Grid :: Traits
49 :: template Codim< cd > :: template Partition< pitype > :: LevelIterator
51
52 typedef typename Grid :: Traits :: template Codim< cd > :: Entity Entity;
53 typedef typename Grid :: Traits :: template Codim< cd > :: EntityPointer
55
56 typedef typename Grid :: template Codim< cd > :: Geometry Geometry;
57 typedef typename Grid :: template Codim< cd > :: LocalGeometry
59
61 template< PartitionIteratorType pit >
62 struct Partition
63 {
65 typedef typename Grid :: template Codim< cd >
66 :: template Partition< pit > :: LevelIterator
68 };
69 };
70
71 enum { conforming = Capabilities :: isLevelwiseConforming< Grid > :: v };
72 };
73
74
75 template< class GridImp, PartitionIteratorType pitype >
77 {
79
80 public:
82
84 typedef typename Traits::Grid Grid;
85
87 typedef typename Traits :: IndexSet IndexSet;
88
90 typedef typename Traits :: Intersection Intersection;
91
93 typedef typename Traits :: IntersectionIterator IntersectionIterator;
94
96 typedef typename Traits :: CollectiveCommunication CollectiveCommunication;
97
99 template< int cd >
100 struct Codim : public Traits :: template Codim<cd> {};
101
102 enum { conforming = Traits :: conforming };
103
104 ALU3dLevelGridView ( const Grid &grid, int level )
105 : grid_( &grid ),
106 level_( level )
107 {}
108
110 const Grid &grid () const
111 {
112 assert( grid_ );
113 return *grid_;
114 }
115
117 const IndexSet &indexSet () const
118 {
119 return grid().levelIndexSet( level_ );
120 }
121
123 int size ( int codim ) const
124 {
125 return grid().size( level_, codim );
126 }
127
129 int size ( const GeometryType &type ) const
130 {
131 return grid().size( level_, type );
132 }
133
135 template< int cd >
136 typename Codim< cd > :: Iterator begin () const
137 {
138 return grid().template lbegin< cd, pitype >( level_ );
139 }
140
142 template< int cd, PartitionIteratorType pit >
143 typename Codim< cd > :: template Partition< pit > :: Iterator begin () const
144 {
145 return grid().template lbegin< cd, pit >( level_ );
146 }
147
149 template< int cd >
150 typename Codim< cd > :: Iterator end () const
151 {
152 return grid().template lend< cd, pitype >( level_ );
153 }
154
156 template< int cd, PartitionIteratorType pit >
157 typename Codim< cd > :: template Partition< pit > :: Iterator end () const
158 {
159 return grid().template lend< cd, pit >( level_ );
160 }
161
164 ibegin ( const typename Codim< 0 > :: Entity &entity ) const
165 {
166 return grid().ilevelbegin( entity );
167 }
168
171 iend ( const typename Codim< 0 > :: Entity &entity ) const
172 {
173 return grid().ilevelend( entity );
174 }
175
178 {
179 return grid().comm();
180 }
181
183 int overlapSize(int codim) const
184 {
185 return grid().overlapSize(level_, codim);
186 }
187
189 int ghostSize(int codim) const
190 {
191 return grid().ghostSize(level_, codim);
192 }
193
195 template< class DataHandle, class Data >
196 typename Grid::LevelCommunication communicate ( CommDataHandleIF< DataHandle, Data > &data,
197 InterfaceType iftype,
198 CommunicationDirection dir ) const
199 {
200 return grid().communicate( data, iftype, dir, level_ );
201 }
202
203 template< int cd >
204 typename Codim< cd >::Twists twists ( GeometryType type ) const
205 {
206 return grid().template twists< cd >( type );
207 }
208
209 private:
210 const Grid *grid_;
211 int level_;
212 };
213
214
215 template< class GridImp, PartitionIteratorType pitype >
218
220 typedef typename std::remove_const<GridImp>::type Grid;
221
223 typedef typename Grid :: Traits :: LeafIndexSet IndexSet;
224
226 typedef typename Grid :: Traits :: LeafIntersection Intersection;
227
229 typedef typename Grid :: Traits :: LeafIntersectionIterator
231
233 typedef typename Grid :: Traits :: CollectiveCommunication CollectiveCommunication;
234
235 template< int cd >
236 struct Codim
237 {
238 typedef typename Grid::Traits::template Codim< cd >::Twists Twists;
239 typedef typename Twists::Twist Twist;
240
241 typedef typename Grid :: Traits
242 :: template Codim< cd > :: template Partition< pitype > :: LeafIterator
244
245 typedef typename Grid :: Traits :: template Codim< cd > :: Entity Entity;
246 typedef typename Grid :: Traits :: template Codim< cd > :: EntityPointer
248
249 typedef typename Grid :: template Codim< cd > :: Geometry Geometry;
250 typedef typename Grid :: template Codim< cd > :: LocalGeometry
252
254 template <PartitionIteratorType pit >
256 {
258 typedef typename Grid :: template Codim< cd >
259 :: template Partition< pit > :: LeafIterator
261 };
262 };
263
264 enum { conforming = Capabilities :: isLeafwiseConforming< Grid > :: v };
265 };
266
267
268 template< class GridImp, PartitionIteratorType pitype >
270 {
272
273 public:
275
277 typedef typename Traits::Grid Grid;
278
280 typedef typename Traits :: IndexSet IndexSet;
281
283 typedef typename Traits :: Intersection Intersection;
284
286 typedef typename Traits :: IntersectionIterator IntersectionIterator;
287
289 typedef typename Traits :: CollectiveCommunication CollectiveCommunication;
290
292 template< int cd >
293 struct Codim : public Traits :: template Codim<cd> {};
294
295 enum { conforming = Traits :: conforming };
296
297 public:
299 : grid_( &grid )
300 {}
301
303 const Grid &grid () const
304 {
305 assert( grid_ );
306 return *grid_;
307 }
308
310 const IndexSet &indexSet () const
311 {
312 return grid().leafIndexSet();
313 }
314
316 int size ( int codim ) const
317 {
318 return grid().size( codim );
319 }
320
322 int size ( const GeometryType &type ) const
323 {
324 return grid().size( type );
325 }
326
328 template< int cd >
329 typename Codim< cd > :: Iterator begin () const
330 {
331 return grid().template leafbegin< cd, pitype >();
332 }
333
335 template< int cd, PartitionIteratorType pit >
336 typename Codim< cd > :: template Partition< pit > :: Iterator begin () const
337 {
338 return grid().template leafbegin< cd, pit >();
339 }
340
342 template< int cd >
343 typename Codim< cd > :: Iterator end () const
344 {
345 return grid().template leafend< cd, pitype >();
346 }
347
349 template< int cd, PartitionIteratorType pit >
350 typename Codim< cd > :: template Partition< pit > :: Iterator end () const
351 {
352 return grid().template leafend< cd, pit >();
353 }
354
357 ibegin ( const typename Codim< 0 > :: Entity &entity ) const
358 {
359 return grid().ileafbegin( entity );
360 }
361
364 iend ( const typename Codim< 0 > :: Entity &entity ) const
365 {
366 return grid().ileafend( entity );
367 }
368
371 {
372 return grid().comm();
373 }
374
376 int overlapSize(int codim) const
377 {
378 return grid().overlapSize(codim);
379 }
380
382 int ghostSize(int codim) const
383 {
384 return grid().ghostSize(codim);
385 }
386
388 template< class DataHandle, class Data >
389 typename Grid::LeafCommunication communicate ( CommDataHandleIF< DataHandle, Data > &data,
390 InterfaceType iftype,
391 CommunicationDirection dir ) const
392 {
393 return grid().communicate( data, iftype, dir );
394 }
395
396 template< int cd >
397 typename Codim< cd >::Twists twists ( GeometryType type ) const
398 {
399 return grid().template twists< cd >( type );
400 }
401
402 private:
403 const Grid *grid_;
404 };
405
406} // namespace Dune
407
408#endif // #ifndef DUNE_ALUGRID_3D_GRIDVIEW_HH
Definition alu3dinclude.hh:80
Definition gridview.hh:77
int size(int codim) const
obtain number of entities in a given codimension
Definition gridview.hh:123
Traits::Grid Grid
type of the grid
Definition gridview.hh:84
int overlapSize(int codim) const
Return size of the overlap region for a given codim on the grid view.
Definition gridview.hh:183
int ghostSize(int codim) const
Return size of the ghost region for a given codim on the grid view.
Definition gridview.hh:189
Codim< cd >::Iterator end() const
obtain end iterator for this view
Definition gridview.hh:150
IntersectionIterator iend(const typename Codim< 0 > ::Entity &entity) const
obtain end intersection iterator with respect to this view
Definition gridview.hh:171
ALU3dLevelGridView(const Grid &grid, int level)
Definition gridview.hh:104
Codim< cd >::template Partition< pit >::Iterator end() const
obtain end iterator for this view
Definition gridview.hh:157
const IndexSet & indexSet() const
obtain the index set
Definition gridview.hh:117
@ conforming
Definition gridview.hh:102
Traits::CollectiveCommunication CollectiveCommunication
type of the collective communication
Definition gridview.hh:96
ALU3dLevelGridViewTraits< GridImp, pitype > Traits
Definition gridview.hh:81
Codim< cd >::template Partition< pit >::Iterator begin() const
obtain begin iterator for this view
Definition gridview.hh:143
int size(const GeometryType &type) const
obtain number of entities with a given geometry type
Definition gridview.hh:129
Codim< cd >::Twists twists(GeometryType type) const
Definition gridview.hh:204
Traits::IntersectionIterator IntersectionIterator
type of the intersection iterator
Definition gridview.hh:93
Traits::Intersection Intersection
type of the intersection
Definition gridview.hh:90
IntersectionIterator ibegin(const typename Codim< 0 > ::Entity &entity) const
obtain begin intersection iterator with respect to this view
Definition gridview.hh:164
Codim< cd >::Iterator begin() const
obtain begin iterator for this view
Definition gridview.hh:136
Traits::IndexSet IndexSet
type of the index set
Definition gridview.hh:87
const CollectiveCommunication & comm() const
obtain collective communication object
Definition gridview.hh:177
Grid::LevelCommunication communicate(CommDataHandleIF< DataHandle, Data > &data, InterfaceType iftype, CommunicationDirection dir) const
Definition gridview.hh:196
const Grid & grid() const
obtain a const reference to the underlying hierarchic grid
Definition gridview.hh:110
Definition gridview.hh:270
IntersectionIterator ibegin(const typename Codim< 0 > ::Entity &entity) const
obtain begin intersection iterator with respect to this view
Definition gridview.hh:357
Codim< cd >::Twists twists(GeometryType type) const
Definition gridview.hh:397
Traits::Intersection Intersection
type of the intersection
Definition gridview.hh:283
const IndexSet & indexSet() const
obtain the index set
Definition gridview.hh:310
Grid::LeafCommunication communicate(CommDataHandleIF< DataHandle, Data > &data, InterfaceType iftype, CommunicationDirection dir) const
Definition gridview.hh:389
Traits::Grid Grid
type of the grid
Definition gridview.hh:277
ALU3dLeafGridViewTraits< GridImp, pitype > Traits
Definition gridview.hh:274
int size(int codim) const
obtain number of entities in a given codimension
Definition gridview.hh:316
int overlapSize(int codim) const
Return size of the overlap region for a given codim on the grid view.
Definition gridview.hh:376
Traits::IntersectionIterator IntersectionIterator
type of the intersection iterator
Definition gridview.hh:286
const Grid & grid() const
obtain a const reference to the underlying hierarchic grid
Definition gridview.hh:303
ALU3dLeafGridView(const Grid &grid)
Definition gridview.hh:298
IntersectionIterator iend(const typename Codim< 0 > ::Entity &entity) const
obtain end intersection iterator with respect to this view
Definition gridview.hh:364
int size(const GeometryType &type) const
obtain number of entities with a given geometry type
Definition gridview.hh:322
Codim< cd >::Iterator end() const
obtain end iterator for this view
Definition gridview.hh:343
int ghostSize(int codim) const
Return size of the ghost region for a given codim on the grid view.
Definition gridview.hh:382
Codim< cd >::template Partition< pit >::Iterator end() const
obtain end iterator for this view
Definition gridview.hh:350
Codim< cd >::Iterator begin() const
obtain begin iterator for this view
Definition gridview.hh:329
const CollectiveCommunication & comm() const
obtain collective communication object
Definition gridview.hh:370
@ conforming
Definition gridview.hh:295
Codim< cd >::template Partition< pit >::Iterator begin() const
obtain begin iterator for this view
Definition gridview.hh:336
Traits::CollectiveCommunication CollectiveCommunication
type of the collective communication
Definition gridview.hh:289
Traits::IndexSet IndexSet
type of the index set
Definition gridview.hh:280
Definition gridview.hh:23
std::remove_const< GridImp >::type Grid
type of the grid
Definition gridview.hh:27
ALU3dLevelGridView< GridImp, pitype > GridViewImp
Definition gridview.hh:24
Grid::Traits::LevelIndexSet IndexSet
type of the index set
Definition gridview.hh:30
@ conforming
Definition gridview.hh:71
Grid::Traits::LevelIntersection Intersection
type of the intersection
Definition gridview.hh:33
Grid::Traits::CollectiveCommunication CollectiveCommunication
type of the collective communication
Definition gridview.hh:40
Grid::Traits::LevelIntersectionIterator IntersectionIterator
type of the intersection iterator
Definition gridview.hh:37
Definition gridview.hh:44
Grid::Traits::template Codim< cd >::template Partition< pitype >::LevelIterator Iterator
Definition gridview.hh:50
Grid::template Codim< cd >::LocalGeometry LocalGeometry
Definition gridview.hh:58
Grid::Traits::template Codim< cd >::EntityPointer EntityPointer
Definition gridview.hh:54
Grid::template Codim< cd >::Geometry Geometry
Definition gridview.hh:56
Grid::Traits::template Codim< cd >::Entity Entity
Definition gridview.hh:52
Grid::Traits::template Codim< cd >::Twists Twists
Definition gridview.hh:45
Twists::Twist Twist
Definition gridview.hh:46
Define types needed to iterate over entities of a given partition type.
Definition gridview.hh:63
Grid::template Codim< cd >::template Partition< pit >::LevelIterator Iterator
iterator over a given codim and partition type
Definition gridview.hh:67
Codim Structure.
Definition gridview.hh:100
Definition gridview.hh:216
Grid::Traits::LeafIndexSet IndexSet
type of the index set
Definition gridview.hh:223
std::remove_const< GridImp >::type Grid
type of the grid
Definition gridview.hh:220
Grid::Traits::LeafIntersection Intersection
type of the intersection
Definition gridview.hh:226
Grid::Traits::CollectiveCommunication CollectiveCommunication
type of the collective communication
Definition gridview.hh:233
ALU3dLeafGridView< GridImp, pitype > GridViewImp
Definition gridview.hh:217
Grid::Traits::LeafIntersectionIterator IntersectionIterator
type of the intersection iterator
Definition gridview.hh:230
@ conforming
Definition gridview.hh:264
Definition gridview.hh:237
Grid::Traits::template Codim< cd >::template Partition< pitype >::LeafIterator Iterator
Definition gridview.hh:243
Grid::Traits::template Codim< cd >::Twists Twists
Definition gridview.hh:238
Grid::Traits::template Codim< cd >::EntityPointer EntityPointer
Definition gridview.hh:247
Grid::template Codim< cd >::Geometry Geometry
Definition gridview.hh:249
Twists::Twist Twist
Definition gridview.hh:239
Grid::template Codim< cd >::LocalGeometry LocalGeometry
Definition gridview.hh:251
Grid::Traits::template Codim< cd >::Entity Entity
Definition gridview.hh:245
Define types needed to iterate over entities of a given partition type.
Definition gridview.hh:256
Grid::template Codim< cd >::template Partition< pit >::LeafIterator Iterator
iterator over a given codim and partition type
Definition gridview.hh:260
Codim Structure.
Definition gridview.hh:293