3#ifndef DUNE_DEFAULTGRIDVIEW_HH
4#define DUNE_DEFAULTGRIDVIEW_HH
10#include <dune/grid/common/gridview.hh>
15 template<
class Gr
idImp, PartitionIteratorType pitype >
16 class DefaultLevelGridView;
18 template<
class Gr
idImp, PartitionIteratorType pitype >
19 class DefaultLeafGridView;
22 template<
class Gr
idImp, PartitionIteratorType pitype >
23 struct DefaultLevelGridViewTraits
25 typedef DefaultLevelGridView< GridImp, pitype > GridViewImp;
28 typedef typename remove_const<GridImp>::type Grid;
31 typedef typename Grid :: Traits :: LevelIndexSet IndexSet;
34 typedef typename Grid :: Traits :: LevelIntersection Intersection;
37 typedef typename Grid :: Traits :: LevelIntersectionIterator
41 typedef typename Grid :: Traits :: CollectiveCommunication CollectiveCommunication;
46 typedef typename Grid :: Traits
47 :: template Codim< cd > :: template Partition< pitype > :: LevelIterator
50 typedef typename Grid :: Traits :: template Codim< cd > :: Entity Entity;
51 typedef typename Grid :: Traits :: template Codim< cd > :: EntityPointer
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 enum { conforming = Capabilities :: isLevelwiseConforming< Grid > :: v };
73 template<
class Gr
idImp, PartitionIteratorType pitype >
74 class DefaultLevelGridView
76 typedef DefaultLevelGridView< GridImp, pitype > ThisType;
79 typedef DefaultLevelGridViewTraits<GridImp,pitype> Traits;
82 typedef typename Traits::Grid Grid;
85 typedef typename Traits :: IndexSet IndexSet;
88 typedef typename Traits :: Intersection Intersection;
91 typedef typename Traits :: IntersectionIterator IntersectionIterator;
94 typedef typename Traits :: CollectiveCommunication CollectiveCommunication;
100 enum { conforming = Traits :: conforming };
102 DefaultLevelGridView (
const Grid &grid,
int level )
109 DefaultLevelGridView (
const ThisType &other )
110 : grid_( other.grid_ ),
111 level_( other.level_ )
115 ThisType &operator= (
const ThisType & other)
118 level_ = other.level_;
123 const Grid &grid ()
const
130 const IndexSet &indexSet ()
const
132 return grid().levelIndexSet( level_ );
136 int size (
int codim )
const
138 return grid().size( level_, codim );
142 int size (
const GeometryType &type )
const
144 return grid().size( level_, type );
149 typename Codim< cd > :: Iterator begin ()
const
151 return grid().template lbegin< cd, pitype >( level_ );
155 template<
int cd, PartitionIteratorType pit >
156 typename Codim< cd > :: template Partition< pit > :: Iterator begin ()
const
158 return grid().template lbegin< cd, pit >( level_ );
163 typename Codim< cd > :: Iterator end ()
const
165 return grid().template lend< cd, pitype >( level_ );
169 template<
int cd, PartitionIteratorType pit >
170 typename Codim< cd > :: template Partition< pit > :: Iterator end ()
const
172 return grid().template lend< cd, pit >( level_ );
177 ibegin (
const typename Codim< 0 > :: Entity &entity )
const
179 return entity.impl().ilevelbegin();
184 iend (
const typename Codim< 0 > :: Entity &entity )
const
186 return entity.impl().ilevelend();
190 const CollectiveCommunication &comm ()
const
192 return grid().comm();
196 int overlapSize(
int codim)
const
198 return grid().overlapSize(level_, codim);
202 int ghostSize(
int codim)
const
204 return grid().ghostSize(level_, codim);
208 template<
class DataHandleImp,
class DataType >
209 void communicate ( CommDataHandleIF< DataHandleImp, DataType > &data,
213 return grid().communicate( data, iftype, dir, level_ );
222 template<
class Gr
idImp, PartitionIteratorType pitype >
223 struct DefaultLeafGridViewTraits {
224 typedef DefaultLeafGridView< GridImp, pitype > GridViewImp;
227 typedef typename remove_const<GridImp>::type Grid;
230 typedef typename Grid :: Traits :: LeafIndexSet IndexSet;
233 typedef typename Grid :: Traits :: LeafIntersection Intersection;
236 typedef typename Grid :: Traits :: LeafIntersectionIterator
237 IntersectionIterator;
240 typedef typename Grid :: Traits :: CollectiveCommunication CollectiveCommunication;
245 typedef typename Grid :: Traits
246 :: template Codim< cd > :: template Partition< pitype > :: LeafIterator
249 typedef typename Grid :: Traits :: template Codim< cd > :: Entity Entity;
250 typedef typename Grid :: Traits :: template Codim< cd > :: EntityPointer
253 typedef typename Grid :: template Codim< cd > :: Geometry Geometry;
254 typedef typename Grid :: template Codim< cd > :: LocalGeometry
258 template <PartitionIteratorType pit >
262 typedef typename Grid :: template Codim< cd >
268 enum { conforming = Capabilities :: isLeafwiseConforming< Grid > :: v };
272 template<
class Gr
idImp, PartitionIteratorType pitype >
273 class DefaultLeafGridView
275 typedef DefaultLeafGridView< GridImp, pitype > ThisType;
278 typedef DefaultLeafGridViewTraits<GridImp,pitype> Traits;
281 typedef typename Traits::Grid Grid;
284 typedef typename Traits :: IndexSet IndexSet;
287 typedef typename Traits :: Intersection Intersection;
290 typedef typename Traits :: IntersectionIterator IntersectionIterator;
293 typedef typename Traits :: CollectiveCommunication CollectiveCommunication;
299 enum { conforming = Traits :: conforming };
302 DefaultLeafGridView (
const Grid &grid )
307 const Grid &grid ()
const
314 const IndexSet &indexSet ()
const
316 return grid().leafIndexSet();
320 int size (
int codim )
const
322 return grid().size( codim );
326 int size (
const GeometryType &type )
const
328 return grid().size( type );
333 typename Codim< cd > :: Iterator begin ()
const
335 return grid().template leafbegin< cd, pitype >();
339 template<
int cd, PartitionIteratorType pit >
340 typename Codim< cd > :: template Partition< pit > :: Iterator begin ()
const
342 return grid().template leafbegin< cd, pit >();
347 typename Codim< cd > :: Iterator end ()
const
349 return grid().template leafend< cd, pitype >();
353 template<
int cd, PartitionIteratorType pit >
354 typename Codim< cd > :: template Partition< pit > :: Iterator end ()
const
356 return grid().template leafend< cd, pit >();
361 ibegin (
const typename Codim< 0 > :: Entity &entity )
const
363 return entity.impl().ileafbegin();
368 iend (
const typename Codim< 0 > :: Entity &entity )
const
370 return entity.impl().ileafend();
374 const CollectiveCommunication &comm ()
const
376 return grid().comm();
380 int overlapSize(
int codim)
const
382 return grid().overlapSize(codim);
386 int ghostSize(
int codim)
const
388 return grid().ghostSize(codim);
392 template<
class DataHandleImp,
class DataType >
393 void communicate ( CommDataHandleIF< DataHandleImp, DataType > &data,
397 return grid().communicate( data, iftype, dir );
Grid abstract base class.
Definition: grid.hh:386
A set of traits classes to store static information about grid implementation.
A few common exception classes.
Dune namespace.
Definition: alignment.hh:14
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:164
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:80
Define types needed to iterate over entities of a given partition type.
Definition: defaultgridview.hh:260
Grid::template Codim< cd >::template Partition< pit >::LeafIterator Iterator
iterator over a given codim and partition type
Definition: defaultgridview.hh:264
Codim Structure.
Definition: defaultgridview.hh:297
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
Traits for type conversions and type information.