3#ifndef DUNE_ALBERTAGRID_GRIDVIEW_HH
4#define DUNE_ALBERTAGRID_GRIDVIEW_HH
12#include <dune/grid/common/gridview.hh>
19 template<
class Gr
idImp, PartitionIteratorType pitype >
20 class AlbertaLevelGridView;
22 template<
class Gr
idImp, PartitionIteratorType pitype >
23 class AlbertaLeafGridView;
26 template<
class Gr
idImp, PartitionIteratorType pitype >
27 struct AlbertaLevelGridViewTraits
29 typedef AlbertaLevelGridView< GridImp, pitype > GridViewImp;
32 typedef typename remove_const<GridImp>::type Grid;
35 typedef typename Grid::Traits::LevelIndexSet IndexSet;
38 typedef typename Grid::Traits::LevelIntersection Intersection;
41 typedef typename Grid::Traits::LevelIntersectionIterator
45 typedef typename Grid::Traits::CollectiveCommunication CollectiveCommunication;
50 typedef typename Grid::Traits::template Codim< cd >::template Partition< pitype >::LevelIterator
53 typedef typename Grid::Traits::template Codim< cd >::Entity Entity;
54 typedef typename Grid::Traits::template Codim< cd >::EntityPointer
57 typedef typename Grid::template Codim< cd >::Geometry Geometry;
58 typedef typename Grid::template Codim< cd >::LocalGeometry
62 template< PartitionIteratorType pit >
75 template<
class Gr
idImp, PartitionIteratorType pitype >
76 class AlbertaLevelGridView
78 typedef AlbertaLevelGridView< GridImp, pitype > ThisType;
81 typedef AlbertaLevelGridViewTraits<GridImp,pitype> Traits;
84 typedef typename Traits::Grid Grid;
87 typedef typename Traits::IndexSet IndexSet;
90 typedef typename Traits::Intersection Intersection;
93 typedef typename Traits::IntersectionIterator IntersectionIterator;
96 typedef typename Traits::CollectiveCommunication CollectiveCommunication;
102 enum { conforming = Traits::conforming };
105 typedef Alberta::ElementInfo< Grid::dimension > ElementInfo;
107 typedef Dune::AlbertaGridLeafIntersectionIterator< GridImp > IntersectionIteratorImpl;
110 AlbertaLevelGridView (
const Grid &grid,
int level )
112 indexSet_( &(grid.levelIndexSet( level )) ),
118 AlbertaLevelGridView (
const ThisType &other )
119 : grid_( other.grid_ ),
120 indexSet_( other.indexSet_ ),
121 level_( other.level_ )
125 ThisType &operator= (
const ThisType & other)
128 indexSet_ = other.indexSet_;
129 level_ = other.level_;
134 const Grid &grid ()
const
140 const IndexSet &indexSet ()
const
146 int size (
int codim )
const
148 return grid().size( level_, codim );
152 int size (
const GeometryType &type )
const
154 return grid().size( level_, type );
159 typename Codim< cd >::Iterator begin ()
const
161 return grid().template lbegin< cd, pitype >( level_ );
165 template<
int cd, PartitionIteratorType pit >
166 typename Codim< cd >::template Partition< pit >::Iterator begin ()
const
168 return grid().template lbegin< cd, pit >( level_ );
173 typename Codim< cd >::Iterator end ()
const
175 return grid().template lend< cd, pitype >( level_ );
179 template<
int cd, PartitionIteratorType pit >
180 typename Codim< cd >::template Partition< pit >::Iterator end ()
const
182 return grid().template lend< cd, pit >( level_ );
187 ibegin (
const typename Codim< 0 >::Entity &entity )
const
189 if( grid().maxLevel() == 0)
191 typename IntersectionIteratorImpl::Begin begin;
192 return IntersectionIteratorImpl( Grid::getRealImplementation( entity ), begin );
196 DUNE_THROW( NotImplemented,
"method ibegin not implemented on LevelGridView for AlbertaGrid." );
197 typename IntersectionIteratorImpl::End end;
198 return IntersectionIteratorImpl( Grid::getRealImplementation( entity ), end );
204 iend (
const typename Codim< 0 >::Entity &entity )
const
206 typename IntersectionIteratorImpl::End end;
207 return IntersectionIteratorImpl( Grid::getRealImplementation( entity ), end );
211 const CollectiveCommunication &comm ()
const
213 return grid().comm();
217 int overlapSize(
int codim)
const
219 return grid().overlapSize(level_, codim);
223 int ghostSize(
int codim)
const
225 return grid().ghostSize(level_, codim);
229 template<
class DataHandleImp,
class DataType >
230 void communicate ( CommDataHandleIF< DataHandleImp, DataType > &data,
237 const IndexSet *indexSet_;
242 template<
class Gr
idImp, PartitionIteratorType pitype >
243 struct AlbertaLeafGridViewTraits
245 typedef AlbertaLeafGridView< GridImp, pitype > GridViewImp;
248 typedef typename remove_const<GridImp>::type Grid;
251 typedef typename Grid::Traits::LeafIndexSet IndexSet;
254 typedef typename Grid::Traits::LeafIntersection Intersection;
257 typedef typename Grid::Traits::LeafIntersectionIterator
258 IntersectionIterator;
261 typedef typename Grid::Traits::CollectiveCommunication CollectiveCommunication;
266 typedef typename Grid::Traits::template Codim< cd >::template Partition< pitype >::LeafIterator
269 typedef typename Grid::Traits::template Codim< cd >::Entity Entity;
270 typedef typename Grid::Traits::template Codim< cd >::EntityPointer
273 typedef typename Grid::template Codim< cd >::Geometry Geometry;
274 typedef typename Grid::template Codim< cd >::LocalGeometry
278 template <PartitionIteratorType pit >
291 template<
class Gr
idImp, PartitionIteratorType pitype >
292 class AlbertaLeafGridView
294 typedef AlbertaLeafGridView< GridImp, pitype > ThisType;
297 typedef AlbertaLeafGridViewTraits<GridImp,pitype> Traits;
300 typedef typename Traits::Grid Grid;
303 typedef typename Traits::IndexSet IndexSet;
306 typedef typename Traits::Intersection Intersection;
309 typedef typename Traits::IntersectionIterator IntersectionIterator;
312 typedef typename Traits::CollectiveCommunication CollectiveCommunication;
318 enum { conforming = Traits::conforming };
321 typedef Alberta::ElementInfo< Grid::dimension > ElementInfo;
323 typedef Dune::AlbertaGridLeafIntersectionIterator< GridImp > IntersectionIteratorImpl;
326 AlbertaLeafGridView (
const Grid &grid )
328 indexSet_( &(grid.leafIndexSet()) )
333 AlbertaLeafGridView (
const ThisType &other )
334 : grid_( other.grid_ ),
335 indexSet_( other.indexSet_ )
339 ThisType &operator= (
const ThisType & other)
342 indexSet_ = other.indexSet_;
347 const Grid &grid ()
const
353 const IndexSet &indexSet ()
const
359 int size (
int codim )
const
361 return grid().size( codim );
365 int size (
const GeometryType &type )
const
367 return grid().size( type );
372 typename Codim< cd >::Iterator begin ()
const
374 return grid().template leafbegin< cd, pitype >();
378 template<
int cd, PartitionIteratorType pit >
379 typename Codim< cd >::template Partition< pit >::Iterator begin ()
const
381 return grid().template leafbegin< cd, pit >();
386 typename Codim< cd >::Iterator end ()
const
388 return grid().template leafend< cd, pitype >();
392 template<
int cd, PartitionIteratorType pit >
393 typename Codim< cd >::template Partition< pit >::Iterator end ()
const
395 return grid().template leafend< cd, pit >();
400 ibegin (
const typename Codim< 0 >::Entity &entity )
const
402 const ElementInfo elementInfo = Grid::getRealImplementation( entity ).elementInfo();
403 assert( !!elementInfo );
408 if( elementInfo.elInfo().opp_vertex[ i ] == 127 )
409 DUNE_THROW( NotImplemented,
"AlbertaGrid: Intersections on outside entities are not fully implemented, yet." );
413 typename IntersectionIteratorImpl::Begin begin;
414 return IntersectionIteratorImpl( Grid::getRealImplementation( entity ), begin );
419 iend (
const typename Codim< 0 >::Entity &entity )
const
421 assert( !!Grid::getRealImplementation( entity ).elementInfo() );
422 typename IntersectionIteratorImpl::End end;
423 return IntersectionIteratorImpl( Grid::getRealImplementation( entity ), end );
427 const CollectiveCommunication &comm ()
const
429 return grid().comm();
433 int overlapSize(
int codim)
const
435 return grid().overlapSize(codim);
439 int ghostSize(
int codim)
const
441 return grid().ghostSize(codim);
445 template<
class DataHandleImp,
class DataType >
446 void communicate ( CommDataHandleIF< DataHandleImp, DataType > &data,
453 const IndexSet *indexSet_;
Implementation of the IntersectionIterator for AlbertaGrid.
Grid abstract base class.
Definition: grid.hh:388
@ dimension
The dimension of the grid.
Definition: grid.hh:402
A set of traits classes to store static information about grid implementation.
A few common exception classes.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:243
Dune namespace.
Definition: alignment.hh:10
Define types needed to iterate over entities of a given partition type.
Definition: gridview.hh:280
Grid::template Codim< cd >::template Partition< pit >::LeafIterator Iterator
iterator over a given codim and partition type
Definition: gridview.hh:283
Codim Structure.
Definition: gridview.hh:316
Define types needed to iterate over entities of a given partition type.
Definition: gridview.hh:64
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
Traits for type conversions and type information.