dune-alugrid  2.8-git
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/version.hh>
7 #include <dune/common/exceptions.hh>
8 
9 #include <dune/grid/common/capabilities.hh>
10 #include <dune/grid/common/gridview.hh>
11 
12 namespace 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 >
24  {
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
39 
41  typedef typename Grid :: Traits :: CollectiveCommunication CollectiveCommunication;
42 
43  template< int cd >
44  struct Codim
45  {
46  typedef typename Grid::Traits::template Codim< cd >::Twists Twists;
47  typedef typename Twists::Twist Twist;
48 
49  typedef typename Grid :: Traits
50  :: template Codim< cd > :: template Partition< pitype > :: LevelIterator
52 
53  typedef typename Grid :: Traits :: template Codim< cd > :: Entity Entity;
54 
55  typedef typename Grid :: template Codim< cd > :: Geometry Geometry;
56  typedef typename Grid :: template Codim< cd > :: LocalGeometry
58 
60  template< PartitionIteratorType pit >
61  struct Partition
62  {
64  typedef typename Grid :: template Codim< cd >
65  :: template Partition< pit > :: LevelIterator
67  };
68  };
69 
70  enum { conforming = Capabilities :: isLevelwiseConforming< Grid > :: v };
71  };
72 
73 
74  template< class GridImp, PartitionIteratorType pitype >
76  {
78 
79  public:
81 
83  typedef typename Traits::Grid Grid;
84 
86  typedef typename Traits :: IndexSet IndexSet;
87 
90 
93 
96 
98  template< int cd >
99  struct Codim : public Traits :: template Codim<cd> {};
100 
102 
103  ALU3dLevelGridView ( const Grid &grid, int level )
104  : grid_( &grid ),
105  level_( level )
106  {}
107 
109  const Grid &grid () const
110  {
111  assert( grid_ );
112  return *grid_;
113  }
114 
116  const IndexSet &indexSet () const
117  {
118  return grid().levelIndexSet( level_ );
119  }
120 
122  int size ( int codim ) const
123  {
124  return grid().size( level_, codim );
125  }
126 
128  int size ( const GeometryType &type ) const
129  {
130  return grid().size( level_, type );
131  }
132 
134  template< int cd >
135  typename Codim< cd > :: Iterator begin () const
136  {
137  return grid().template lbegin< cd, pitype >( level_ );
138  }
139 
141  template< int cd, PartitionIteratorType pit >
142  typename Codim< cd > :: template Partition< pit > :: Iterator begin () const
143  {
144  return grid().template lbegin< cd, pit >( level_ );
145  }
146 
148  template< int cd >
149  typename Codim< cd > :: Iterator end () const
150  {
151  return grid().template lend< cd, pitype >( level_ );
152  }
153 
155  template< int cd, PartitionIteratorType pit >
156  typename Codim< cd > :: template Partition< pit > :: Iterator end () const
157  {
158  return grid().template lend< cd, pit >( level_ );
159  }
160 
163  ibegin ( const typename Codim< 0 > :: Entity &entity ) const
164  {
165  return grid().ilevelbegin( entity );
166  }
167 
170  iend ( const typename Codim< 0 > :: Entity &entity ) const
171  {
172  return grid().ilevelend( entity );
173  }
174 
177  {
178  return grid().comm();
179  }
180 
182  int overlapSize(int codim) const
183  {
184  return grid().overlapSize(level_, codim);
185  }
186 
188  int ghostSize(int codim) const
189  {
190  return grid().ghostSize(level_, codim);
191  }
192 
194  template< class DataHandle, class Data >
195  typename Grid::LevelCommunication communicate ( CommDataHandleIF< DataHandle, Data > &data,
196  InterfaceType iftype,
197  CommunicationDirection dir ) const
198  {
199  return grid().communicate( data, iftype, dir, level_ );
200  }
201 
202  template< int cd >
203  typename Codim< cd >::Twists twists ( GeometryType type ) const
204  {
205  return grid().template twists< cd >( type );
206  }
207 
208  private:
209  const Grid *grid_;
210  int level_;
211  };
212 
213 
214  template< class GridImp, PartitionIteratorType pitype >
217 
219  typedef typename std::remove_const<GridImp>::type Grid;
220 
222  typedef typename Grid :: Traits :: LeafIndexSet IndexSet;
223 
225  typedef typename Grid :: Traits :: LeafIntersection Intersection;
226 
228  typedef typename Grid :: Traits :: LeafIntersectionIterator
230 
232  typedef typename Grid :: Traits :: CollectiveCommunication CollectiveCommunication;
233 
234  template< int cd >
235  struct Codim
236  {
237  typedef typename Grid::Traits::template Codim< cd >::Twists Twists;
238  typedef typename Twists::Twist Twist;
239 
240  typedef typename Grid :: Traits
241  :: template Codim< cd > :: template Partition< pitype > :: LeafIterator
243 
244  typedef typename Grid :: Traits :: template Codim< cd > :: Entity Entity;
245 
246  typedef typename Grid :: template Codim< cd > :: Geometry Geometry;
247  typedef typename Grid :: template Codim< cd > :: LocalGeometry
249 
251  template <PartitionIteratorType pit >
252  struct Partition
253  {
255  typedef typename Grid :: template Codim< cd >
256  :: template Partition< pit > :: LeafIterator
258  };
259  };
260 
261  enum { conforming = Capabilities :: isLeafwiseConforming< Grid > :: v };
262  };
263 
264 
265  template< class GridImp, PartitionIteratorType pitype >
267  {
269 
270  public:
272 
274  typedef typename Traits::Grid Grid;
275 
277  typedef typename Traits :: IndexSet IndexSet;
278 
281 
284 
287 
289  template< int cd >
290  struct Codim : public Traits :: template Codim<cd> {};
291 
293 
294  public:
296  : grid_( &grid )
297  {}
298 
300  const Grid &grid () const
301  {
302  assert( grid_ );
303  return *grid_;
304  }
305 
307  const IndexSet &indexSet () const
308  {
309  return grid().leafIndexSet();
310  }
311 
313  int size ( int codim ) const
314  {
315  return grid().size( codim );
316  }
317 
319  int size ( const GeometryType &type ) const
320  {
321  return grid().size( type );
322  }
323 
325  template< int cd >
326  typename Codim< cd > :: Iterator begin () const
327  {
328  return grid().template leafbegin< cd, pitype >();
329  }
330 
332  template< int cd, PartitionIteratorType pit >
333  typename Codim< cd > :: template Partition< pit > :: Iterator begin () const
334  {
335  return grid().template leafbegin< cd, pit >();
336  }
337 
339  template< int cd >
340  typename Codim< cd > :: Iterator end () const
341  {
342  return grid().template leafend< cd, pitype >();
343  }
344 
346  template< int cd, PartitionIteratorType pit >
347  typename Codim< cd > :: template Partition< pit > :: Iterator end () const
348  {
349  return grid().template leafend< cd, pit >();
350  }
351 
354  ibegin ( const typename Codim< 0 > :: Entity &entity ) const
355  {
356  return grid().ileafbegin( entity );
357  }
358 
361  iend ( const typename Codim< 0 > :: Entity &entity ) const
362  {
363  return grid().ileafend( entity );
364  }
365 
368  {
369  return grid().comm();
370  }
371 
373  int overlapSize(int codim) const
374  {
375  return grid().overlapSize(codim);
376  }
377 
379  int ghostSize(int codim) const
380  {
381  return grid().ghostSize(codim);
382  }
383 
385  template< class DataHandle, class Data >
386  typename Grid::LeafCommunication communicate ( CommDataHandleIF< DataHandle, Data > &data,
387  InterfaceType iftype,
388  CommunicationDirection dir ) const
389  {
390  return grid().communicate( data, iftype, dir );
391  }
392 
393  template< int cd >
394  typename Codim< cd >::Twists twists ( GeometryType type ) const
395  {
396  return grid().template twists< cd >( type );
397  }
398 
399  private:
400  const Grid *grid_;
401  };
402 
403 } // namespace Dune
404 
405 #endif // #ifndef DUNE_ALUGRID_3D_GRIDVIEW_HH
Definition: alu3dinclude.hh:63
Definition: gridview.hh:76
Codim< cd >::Iterator begin() const
obtain begin iterator for this view
Definition: gridview.hh:135
int size(int codim) const
obtain number of entities in a given codimension
Definition: gridview.hh:122
Traits::Grid Grid
type of the grid
Definition: gridview.hh:83
int overlapSize(int codim) const
Return size of the overlap region for a given codim on the grid view.
Definition: gridview.hh:182
Traits ::CollectiveCommunication CollectiveCommunication
type of the collective communication
Definition: gridview.hh:95
int ghostSize(int codim) const
Return size of the ghost region for a given codim on the grid view.
Definition: gridview.hh:188
IntersectionIterator iend(const typename Codim< 0 > ::Entity &entity) const
obtain end intersection iterator with respect to this view
Definition: gridview.hh:170
Traits ::Intersection Intersection
type of the intersection
Definition: gridview.hh:89
ALU3dLevelGridView(const Grid &grid, int level)
Definition: gridview.hh:103
const CollectiveCommunication & comm() const
obtain collective communication object
Definition: gridview.hh:176
Codim< cd >::template Partition< pit >::Iterator begin() const
obtain begin iterator for this view
Definition: gridview.hh:142
@ conforming
Definition: gridview.hh:101
Codim< cd >::template Partition< pit >::Iterator end() const
obtain end iterator for this view
Definition: gridview.hh:156
ALU3dLevelGridViewTraits< GridImp, pitype > Traits
Definition: gridview.hh:80
Codim< cd >::Iterator end() const
obtain end iterator for this view
Definition: gridview.hh:149
const IndexSet & indexSet() const
obtain the index set
Definition: gridview.hh:116
int size(const GeometryType &type) const
obtain number of entities with a given geometry type
Definition: gridview.hh:128
Codim< cd >::Twists twists(GeometryType type) const
Definition: gridview.hh:203
Traits ::IndexSet IndexSet
type of the index set
Definition: gridview.hh:86
IntersectionIterator ibegin(const typename Codim< 0 > ::Entity &entity) const
obtain begin intersection iterator with respect to this view
Definition: gridview.hh:163
Traits ::IntersectionIterator IntersectionIterator
type of the intersection iterator
Definition: gridview.hh:92
const Grid & grid() const
obtain a const reference to the underlying hierarchic grid
Definition: gridview.hh:109
Grid::LevelCommunication communicate(CommDataHandleIF< DataHandle, Data > &data, InterfaceType iftype, CommunicationDirection dir) const
Definition: gridview.hh:195
Definition: gridview.hh:267
Codim< cd >::template Partition< pit >::Iterator begin() const
obtain begin iterator for this view
Definition: gridview.hh:333
IntersectionIterator ibegin(const typename Codim< 0 > ::Entity &entity) const
obtain begin intersection iterator with respect to this view
Definition: gridview.hh:354
Codim< cd >::Twists twists(GeometryType type) const
Definition: gridview.hh:394
Grid::LeafCommunication communicate(CommDataHandleIF< DataHandle, Data > &data, InterfaceType iftype, CommunicationDirection dir) const
Definition: gridview.hh:386
Traits ::Intersection Intersection
type of the intersection
Definition: gridview.hh:280
Traits::Grid Grid
type of the grid
Definition: gridview.hh:274
Codim< cd >::Iterator end() const
obtain end iterator for this view
Definition: gridview.hh:340
Traits ::IntersectionIterator IntersectionIterator
type of the intersection iterator
Definition: gridview.hh:283
ALU3dLeafGridViewTraits< GridImp, pitype > Traits
Definition: gridview.hh:271
int size(int codim) const
obtain number of entities in a given codimension
Definition: gridview.hh:313
int overlapSize(int codim) const
Return size of the overlap region for a given codim on the grid view.
Definition: gridview.hh:373
Traits ::IndexSet IndexSet
type of the index set
Definition: gridview.hh:277
ALU3dLeafGridView(const Grid &grid)
Definition: gridview.hh:295
IntersectionIterator iend(const typename Codim< 0 > ::Entity &entity) const
obtain end intersection iterator with respect to this view
Definition: gridview.hh:361
int size(const GeometryType &type) const
obtain number of entities with a given geometry type
Definition: gridview.hh:319
const CollectiveCommunication & comm() const
obtain collective communication object
Definition: gridview.hh:367
Codim< cd >::Iterator begin() const
obtain begin iterator for this view
Definition: gridview.hh:326
Traits ::CollectiveCommunication CollectiveCommunication
type of the collective communication
Definition: gridview.hh:286
int ghostSize(int codim) const
Return size of the ghost region for a given codim on the grid view.
Definition: gridview.hh:379
const Grid & grid() const
obtain a const reference to the underlying hierarchic grid
Definition: gridview.hh:300
const IndexSet & indexSet() const
obtain the index set
Definition: gridview.hh:307
@ conforming
Definition: gridview.hh:292
Codim< cd >::template Partition< pit >::Iterator end() const
obtain end iterator for this view
Definition: gridview.hh:347
Definition: gridview.hh:24
Grid ::Traits ::LevelIntersection Intersection
type of the intersection
Definition: gridview.hh:34
std::remove_const< GridImp >::type Grid
type of the grid
Definition: gridview.hh:28
ALU3dLevelGridView< GridImp, pitype > GridViewImp
Definition: gridview.hh:25
Grid ::Traits ::LevelIndexSet IndexSet
type of the index set
Definition: gridview.hh:31
Grid ::Traits ::CollectiveCommunication CollectiveCommunication
type of the collective communication
Definition: gridview.hh:41
Grid ::Traits ::LevelIntersectionIterator IntersectionIterator
type of the intersection iterator
Definition: gridview.hh:38
@ conforming
Definition: gridview.hh:70
Definition: gridview.hh:45
Grid ::Traits ::template Codim< cd >::template Partition< pitype >::LevelIterator Iterator
Definition: gridview.hh:51
Grid ::template Codim< cd >::LocalGeometry LocalGeometry
Definition: gridview.hh:57
Grid::Traits::template Codim< cd >::Twists Twists
Definition: gridview.hh:46
Grid ::Traits ::template Codim< cd >::Entity Entity
Definition: gridview.hh:53
Grid ::template Codim< cd >::Geometry Geometry
Definition: gridview.hh:55
Twists::Twist Twist
Definition: gridview.hh:47
Define types needed to iterate over entities of a given partition type.
Definition: gridview.hh:62
Grid ::template Codim< cd >::template Partition< pit >::LevelIterator Iterator
iterator over a given codim and partition type
Definition: gridview.hh:66
Codim Structure.
Definition: gridview.hh:99
Definition: gridview.hh:215
std::remove_const< GridImp >::type Grid
type of the grid
Definition: gridview.hh:219
Grid ::Traits ::LeafIntersectionIterator IntersectionIterator
type of the intersection iterator
Definition: gridview.hh:229
Grid ::Traits ::CollectiveCommunication CollectiveCommunication
type of the collective communication
Definition: gridview.hh:232
ALU3dLeafGridView< GridImp, pitype > GridViewImp
Definition: gridview.hh:216
Grid ::Traits ::LeafIndexSet IndexSet
type of the index set
Definition: gridview.hh:222
@ conforming
Definition: gridview.hh:261
Grid ::Traits ::LeafIntersection Intersection
type of the intersection
Definition: gridview.hh:225
Definition: gridview.hh:236
Grid::Traits::template Codim< cd >::Twists Twists
Definition: gridview.hh:237
Grid ::Traits ::template Codim< cd >::template Partition< pitype >::LeafIterator Iterator
Definition: gridview.hh:242
Grid ::Traits ::template Codim< cd >::Entity Entity
Definition: gridview.hh:244
Twists::Twist Twist
Definition: gridview.hh:238
Grid ::template Codim< cd >::LocalGeometry LocalGeometry
Definition: gridview.hh:248
Grid ::template Codim< cd >::Geometry Geometry
Definition: gridview.hh:246
Define types needed to iterate over entities of a given partition type.
Definition: gridview.hh:253
Grid ::template Codim< cd >::template Partition< pit >::LeafIterator Iterator
iterator over a given codim and partition type
Definition: gridview.hh:257
Codim Structure.
Definition: gridview.hh:290