5#ifndef DUNE_GRID_COMMON_DEFAULTGRIDVIEW_HH
6#define DUNE_GRID_COMMON_DEFAULTGRIDVIEW_HH
12#include <dune/grid/common/gridview.hh>
17 template<
class Gr
idImp >
18 class DefaultLevelGridView;
20 template<
class Gr
idImp >
21 class DefaultLeafGridView;
24 template<
class Gr
idImp >
25 struct DefaultLevelGridViewTraits
27 typedef DefaultLevelGridView< GridImp > GridViewImp;
30 typedef typename std::remove_const<GridImp>::type Grid;
33 typedef typename Grid :: Traits :: LevelIndexSet IndexSet;
36 typedef typename Grid :: Traits :: LevelIntersection Intersection;
39 typedef typename Grid :: Traits :: LevelIntersectionIterator
43 typedef typename Grid :: Traits :: Communication Communication;
48 typedef typename Grid :: Traits
49 :: template Codim< cd > :: template Partition< All_Partition > :: LevelIterator
52 typedef typename Grid :: Traits :: template Codim< cd > :: Entity Entity;
54 typedef typename Grid :: template Codim< cd > :: Geometry Geometry;
55 typedef typename Grid :: template Codim< cd > :: LocalGeometry
59 template< PartitionIteratorType pit >
63 typedef typename Grid :: template Codim< cd >
69 constexpr static bool conforming = Capabilities :: isLevelwiseConforming< Grid > :: v;
73 template<
class Gr
idImp >
74 class DefaultLevelGridView
76 typedef DefaultLevelGridView< GridImp > ThisType;
79 typedef DefaultLevelGridViewTraits<GridImp> Traits;
82 typedef typename Traits::Grid
Grid;
85 typedef typename Traits :: IndexSet
IndexSet;
94 typedef typename Grid :: Traits :: Communication
Communication;
100 constexpr static bool conforming = Traits :: conforming;
102 DefaultLevelGridView (
const Grid &grid,
int level )
108 const Grid &grid ()
const
115 const IndexSet &indexSet ()
const
117 return grid().levelIndexSet( level_ );
121 bool isConforming()
const {
return bool(Traits::conforming); }
124 int size (
int codim )
const
126 return grid().size( level_, codim );
130 int size (
const GeometryType &type )
const
132 return grid().size( level_, type );
137 typename Codim< cd > :: Iterator begin ()
const
139 return grid().template lbegin< cd, All_Partition >( level_ );
143 template<
int cd, PartitionIteratorType pit >
144 typename Codim< cd > :: template Partition< pit > :: Iterator begin ()
const
146 return grid().template lbegin< cd, pit >( level_ );
151 typename Codim< cd > :: Iterator end ()
const
153 return grid().template lend< cd, All_Partition >( level_ );
157 template<
int cd, PartitionIteratorType pit >
158 typename Codim< cd > :: template Partition< pit > :: Iterator end ()
const
160 return grid().template lend< cd, pit >( level_ );
165 ibegin (
const typename Codim< 0 > :: Entity &entity )
const
167 return grid().ilevelbegin(entity);
172 iend (
const typename Codim< 0 > :: Entity &entity )
const
174 return grid().ilevelend(entity);
178 const Communication &comm ()
const
180 return grid().comm();
184 int overlapSize(
int codim)
const
186 return grid().overlapSize(level_, codim);
190 int ghostSize(
int codim)
const
192 return grid().ghostSize(level_, codim);
196 template<
class DataHandleImp,
class DataType >
197 void communicate ( CommDataHandleIF< DataHandleImp, DataType > &data,
201 return grid().communicate( data, iftype, dir, level_ );
210 template<
class Gr
idImp >
211 struct DefaultLeafGridViewTraits {
212 typedef DefaultLeafGridView< GridImp > GridViewImp;
215 typedef typename std::remove_const<GridImp>::type Grid;
218 typedef typename Grid :: Traits :: LeafIndexSet IndexSet;
221 typedef typename Grid :: Traits :: LeafIntersection Intersection;
224 typedef typename Grid :: Traits :: LeafIntersectionIterator
225 IntersectionIterator;
228 typedef typename Grid :: Traits :: Communication Communication;
233 typedef typename Grid :: Traits
234 :: template Codim< cd > :: template Partition< All_Partition > :: LeafIterator
237 typedef typename Grid :: Traits :: template Codim< cd > :: Entity Entity;
239 typedef typename Grid :: template Codim< cd > :: Geometry Geometry;
240 typedef typename Grid :: template Codim< cd > :: LocalGeometry
244 template <PartitionIteratorType pit >
248 typedef typename Grid :: template Codim< cd >
254 constexpr static bool conforming = Capabilities :: isLeafwiseConforming< Grid > :: v;
258 template<
class Gr
idImp >
259 class DefaultLeafGridView
261 typedef DefaultLeafGridView< GridImp > ThisType;
264 typedef DefaultLeafGridViewTraits<GridImp> Traits;
267 typedef typename Traits::Grid
Grid;
270 typedef typename Traits :: IndexSet
IndexSet;
279 typedef typename Grid :: Traits :: Communication
Communication;
285 constexpr static bool conforming = Traits :: conforming;
288 DefaultLeafGridView (
const Grid &grid )
293 const Grid &grid ()
const
300 const IndexSet &indexSet ()
const
302 return grid().leafIndexSet();
306 bool isConforming()
const {
return bool(Traits::conforming); }
309 int size (
int codim )
const
311 return grid().size( codim );
315 int size (
const GeometryType &type )
const
317 return grid().size( type );
322 typename Codim< cd > :: Iterator begin ()
const
324 return grid().template leafbegin< cd, All_Partition >();
328 template<
int cd, PartitionIteratorType pit >
329 typename Codim< cd > :: template Partition< pit > :: Iterator begin ()
const
331 return grid().template leafbegin< cd, pit >();
336 typename Codim< cd > :: Iterator end ()
const
338 return grid().template leafend< cd, All_Partition >();
342 template<
int cd, PartitionIteratorType pit >
343 typename Codim< cd > :: template Partition< pit > :: Iterator end ()
const
345 return grid().template leafend< cd, pit >();
350 ibegin (
const typename Codim< 0 > :: Entity &entity )
const
352 return grid().ileafbegin(entity);
357 iend (
const typename Codim< 0 > :: Entity &entity )
const
359 return grid().ileafend(entity);
363 const Communication &comm ()
const
365 return grid().comm();
369 int overlapSize(
int codim)
const
371 return grid().overlapSize(codim);
375 int ghostSize(
int codim)
const
377 return grid().ghostSize(codim);
381 template<
class DataHandleImp,
class DataType >
382 void communicate ( CommDataHandleIF< DataHandleImp, DataType > &data,
386 return grid().communicate( data, iftype, dir );
Collective communication interface and sequential default implementation.
Definition: communication.hh:100
Grid abstract base class.
Definition: grid.hh:375
Index Set Interface base class.
Definition: indexidset.hh:78
Mesh entities of codimension 0 ("elements") allow to visit all intersections with "neighboring" eleme...
Definition: intersectioniterator.hh:83
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: intersection.hh:164
A set of traits classes to store static information about grid implementation.
A few common exception classes.
Traits for type conversions and type information.
Dune namespace.
Definition: alignedallocator.hh:13
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75
Define types needed to iterate over entities of a given partition type.
Definition: defaultgridview.hh:246
Grid::template Codim< cd >::template Partition< pit >::LeafIterator Iterator
iterator over a given codim and partition type
Definition: defaultgridview.hh:250
Codim Structure.
Definition: defaultgridview.hh:283
Define types needed to iterate over entities of a given partition type.
Definition: defaultgridview.hh:61
Grid::template Codim< cd >::template Partition< pit >::LevelIterator Iterator
iterator over a given codim and partition type
Definition: defaultgridview.hh:65
Codim Structure.
Definition: defaultgridview.hh:98