Dune Core Modules (2.9.0)

gridview.hh
1#ifndef DUNE_ALUGRID_3D_GRIDVIEW_HH
2#define DUNE_ALUGRID_3D_GRIDVIEW_HH
3
4#include <type_traits>
5
8
10#include <dune/grid/common/gridview.hh>
11
12namespace Dune
13{
14
15 template< class GridImp, PartitionIteratorType pitype >
16 class ALU3dLevelGridView;
17
18 template< class GridImp, PartitionIteratorType pitype >
19 class ALU3dLeafGridView;
20
21
22 template< class GridImp, PartitionIteratorType pitype >
23 struct ALU3dLevelGridViewTraits
24 {
25 typedef ALU3dLevelGridView< GridImp, pitype > GridViewImp;
26
28 typedef typename std::remove_const<GridImp>::type Grid;
29
31 typedef typename Grid :: Traits :: LevelIndexSet IndexSet;
32
34 typedef typename Grid :: Traits :: LevelIntersection Intersection;
35
37 typedef typename Grid :: Traits :: LevelIntersectionIterator
38 IntersectionIterator;
39
41 typedef typename Grid :: Traits :: Communication Communication;
42 typedef Communication CollectiveCommunication;
43
44 template< int cd >
45 struct Codim
46 {
47 typedef typename Grid::Traits::template Codim< cd >::Twists Twists;
48 typedef typename Twists::Twist Twist;
49
50 typedef typename Grid :: Traits
51 :: template Codim< cd > :: template Partition< pitype > :: LevelIterator
52 Iterator;
53
54 typedef typename Grid :: Traits :: template Codim< cd > :: Entity Entity;
55
56 typedef typename Grid :: template Codim< cd > :: Geometry Geometry;
57 typedef typename Grid :: template Codim< cd > :: LocalGeometry
58 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 >
76 class ALU3dLevelGridView
77 {
78 typedef ALU3dLevelGridView< GridImp, pitype > ThisType;
79
80 public:
81 typedef ALU3dLevelGridViewTraits<GridImp,pitype> Traits;
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 :: Communication Communication;
97 typedef Communication CollectiveCommunication;
98
100 template< int cd >
101 struct Codim : public Traits :: template Codim<cd> {};
102
103 enum { conforming = Traits :: conforming };
104
105 ALU3dLevelGridView ( const Grid &grid, int level )
106 : grid_( &grid ),
107 level_( level )
108 {}
109
111 const Grid &grid () const
112 {
113 assert( grid_ );
114 return *grid_;
115 }
116
118 const IndexSet &indexSet () const
119 {
120 return grid().levelIndexSet( level_ );
121 }
122
124 bool isConforming() const
125 {
126 // macro level is always conforming, otherwise the level view is
127 // conforming if non-conforming refinement is used
128 return level_ == 0 ? true : ! grid().conformingRefinement();
129 }
130
132 int size ( int codim ) const
133 {
134 return grid().size( level_, codim );
135 }
136
138 int size ( const GeometryType &type ) const
139 {
140 return grid().size( level_, type );
141 }
142
144 template< int cd >
145 typename Codim< cd > :: Iterator begin () const
146 {
147 return grid().template lbegin< cd, pitype >( level_ );
148 }
149
151 template< int cd, PartitionIteratorType pit >
152 typename Codim< cd > :: template Partition< pit > :: Iterator begin () const
153 {
154 return grid().template lbegin< cd, pit >( level_ );
155 }
156
158 template< int cd >
159 typename Codim< cd > :: Iterator end () const
160 {
161 return grid().template lend< cd, pitype >( level_ );
162 }
163
165 template< int cd, PartitionIteratorType pit >
166 typename Codim< cd > :: template Partition< pit > :: Iterator end () const
167 {
168 return grid().template lend< cd, pit >( level_ );
169 }
170
172 IntersectionIterator
173 ibegin ( const typename Codim< 0 > :: Entity &entity ) const
174 {
175 return grid().ilevelbegin( entity );
176 }
177
179 IntersectionIterator
180 iend ( const typename Codim< 0 > :: Entity &entity ) const
181 {
182 return grid().ilevelend( entity );
183 }
184
186 const Communication &comm () const
187 {
188 return grid().comm();
189 }
190
192 int overlapSize(int codim) const
193 {
194 return grid().overlapSize(level_, codim);
195 }
196
198 int ghostSize(int codim) const
199 {
200 return grid().ghostSize(level_, codim);
201 }
202
204 template< class DataHandle, class Data >
205 typename Grid::LevelCommunication communicate ( CommDataHandleIF< DataHandle, Data > &data,
206 InterfaceType iftype,
207 CommunicationDirection dir ) const
208 {
209 return grid().communicate( data, iftype, dir, level_ );
210 }
211
212 template< int cd >
213 typename Codim< cd >::Twists twists ( GeometryType type ) const
214 {
215 return grid().template twists< cd >( type );
216 }
217
218 private:
219 const Grid *grid_;
220 int level_;
221 };
222
223
224 template< class GridImp, PartitionIteratorType pitype >
225 struct ALU3dLeafGridViewTraits {
226 typedef ALU3dLeafGridView< GridImp, pitype > GridViewImp;
227
229 typedef typename std::remove_const<GridImp>::type Grid;
230
232 typedef typename Grid :: Traits :: LeafIndexSet IndexSet;
233
235 typedef typename Grid :: Traits :: LeafIntersection Intersection;
236
238 typedef typename Grid :: Traits :: LeafIntersectionIterator
239 IntersectionIterator;
240
242 typedef typename Grid :: Traits :: Communication Communication;
243 typedef Communication CollectiveCommunication;
244
245 template< int cd >
246 struct Codim
247 {
248 typedef typename Grid::Traits::template Codim< cd >::Twists Twists;
249 typedef typename Twists::Twist Twist;
250
251 typedef typename Grid :: Traits
252 :: template Codim< cd > :: template Partition< pitype > :: LeafIterator
253 Iterator;
254
255 typedef typename Grid :: Traits :: template Codim< cd > :: Entity Entity;
256
257 typedef typename Grid :: template Codim< cd > :: Geometry Geometry;
258 typedef typename Grid :: template Codim< cd > :: LocalGeometry
259 LocalGeometry;
260
262 template <PartitionIteratorType pit >
264 {
266 typedef typename Grid :: template Codim< cd >
267 :: template Partition< pit > :: LeafIterator
269 };
270 };
271
272 enum { conforming = Capabilities :: isLeafwiseConforming< Grid > :: v };
273 };
274
275
276 template< class GridImp, PartitionIteratorType pitype >
277 class ALU3dLeafGridView
278 {
279 typedef ALU3dLeafGridView< GridImp, pitype > ThisType;
280
281 public:
282 typedef ALU3dLeafGridViewTraits<GridImp,pitype> Traits;
283
285 typedef typename Traits::Grid Grid;
286
288 typedef typename Traits :: IndexSet IndexSet;
289
291 typedef typename Traits :: Intersection Intersection;
292
294 typedef typename Traits :: IntersectionIterator IntersectionIterator;
295
297 typedef typename Traits :: Communication Communication;
298 typedef Communication CollectiveCommunication;
299
301 template< int cd >
302 struct Codim : public Traits :: template Codim<cd> {};
303
304 enum { conforming = Traits :: conforming };
305
306 public:
307 ALU3dLeafGridView ( const Grid &grid )
308 : grid_( &grid )
309 {}
310
312 const Grid &grid () const
313 {
314 assert( grid_ );
315 return *grid_;
316 }
317
319 const IndexSet &indexSet () const
320 {
321 return grid().leafIndexSet();
322 }
323
325 bool isConforming() const { return grid().conformingRefinement(); }
326
328 int size ( int codim ) const
329 {
330 return grid().size( codim );
331 }
332
334 int size ( const GeometryType &type ) const
335 {
336 return grid().size( type );
337 }
338
340 template< int cd >
341 typename Codim< cd > :: Iterator begin () const
342 {
343 return grid().template leafbegin< cd, pitype >();
344 }
345
347 template< int cd, PartitionIteratorType pit >
348 typename Codim< cd > :: template Partition< pit > :: Iterator begin () const
349 {
350 return grid().template leafbegin< cd, pit >();
351 }
352
354 template< int cd >
355 typename Codim< cd > :: Iterator end () const
356 {
357 return grid().template leafend< cd, pitype >();
358 }
359
361 template< int cd, PartitionIteratorType pit >
362 typename Codim< cd > :: template Partition< pit > :: Iterator end () const
363 {
364 return grid().template leafend< cd, pit >();
365 }
366
368 IntersectionIterator
369 ibegin ( const typename Codim< 0 > :: Entity &entity ) const
370 {
371 return grid().ileafbegin( entity );
372 }
373
375 IntersectionIterator
376 iend ( const typename Codim< 0 > :: Entity &entity ) const
377 {
378 return grid().ileafend( entity );
379 }
380
382 const Communication &comm () const
383 {
384 return grid().comm();
385 }
386
388 int overlapSize(int codim) const
389 {
390 return grid().overlapSize(codim);
391 }
392
394 int ghostSize(int codim) const
395 {
396 return grid().ghostSize(codim);
397 }
398
400 template< class DataHandle, class Data >
401 typename Grid::LeafCommunication communicate ( CommDataHandleIF< DataHandle, Data > &data,
402 InterfaceType iftype,
403 CommunicationDirection dir ) const
404 {
405 return grid().communicate( data, iftype, dir );
406 }
407
408 template< int cd >
409 typename Codim< cd >::Twists twists ( GeometryType type ) const
410 {
411 return grid().template twists< cd >( type );
412 }
413
414 private:
415 const Grid *grid_;
416 };
417
418} // namespace Dune
419
420#endif // #ifndef DUNE_ALUGRID_3D_GRIDVIEW_HH
Grid abstract base class.
Definition: grid.hh:375
A few common exception classes.
A set of traits classes to store static information about grid implementation.
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:170
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:86
Dune namespace.
Definition: alignedallocator.hh:13
Communication< T > CollectiveCommunication
Definition: communication.hh:541
@ conforming
use only conforming bisection refinement
Definition: declaration.hh:25
Define types needed to iterate over entities of a given partition type.
Definition: gridview.hh:264
Grid::template Codim< cd >::template Partition< pit >::LeafIterator Iterator
iterator over a given codim and partition type
Definition: gridview.hh:268
Codim Structure.
Definition: gridview.hh:302
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:101
Various macros to work with Dune module version numbers.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)