3#ifndef DUNE_ALBERTAGRID_GRIDVIEW_HH
4#define DUNE_ALBERTAGRID_GRIDVIEW_HH
12#include <dune/grid/common/gridview.hh>
19 template<
class Gr
idImp >
20 class AlbertaLevelGridView;
22 template<
class Gr
idImp >
23 class AlbertaLeafGridView;
26 template<
class Gr
idImp >
27 struct AlbertaLevelGridViewTraits
29 typedef AlbertaLevelGridView< GridImp > GridViewImp;
32 typedef typename std::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< All_Partition >::LevelIterator Iterator;
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 >
72 template<
class Gr
idImp >
73 class AlbertaLevelGridView
75 typedef AlbertaLevelGridView< GridImp > ThisType;
78 typedef AlbertaLevelGridViewTraits<GridImp> Traits;
81 typedef typename Traits::Grid Grid;
84 typedef typename Traits::IndexSet IndexSet;
87 typedef typename Traits::Intersection Intersection;
90 typedef typename Traits::IntersectionIterator IntersectionIterator;
93 typedef typename Traits::CollectiveCommunication CollectiveCommunication;
99 enum { conforming = Traits::conforming };
102 typedef Alberta::ElementInfo< Grid::dimension > ElementInfo;
104 typedef Dune::AlbertaGridLeafIntersectionIterator< GridImp > IntersectionIteratorImpl;
107 AlbertaLevelGridView (
const Grid &grid,
int level )
109 indexSet_( &(grid.levelIndexSet( level )) ),
115 AlbertaLevelGridView (
const ThisType &other )
116 : grid_( other.grid_ ),
117 indexSet_( other.indexSet_ ),
118 level_( other.level_ )
122 ThisType &operator= (
const ThisType & other)
125 indexSet_ = other.indexSet_;
126 level_ = other.level_;
131 const Grid &grid ()
const
137 const IndexSet &indexSet ()
const
143 int size (
int codim )
const
145 return grid().size( level_, codim );
149 int size (
const GeometryType &type )
const
151 return grid().size( level_, type );
156 typename Codim< cd >::Iterator begin ()
const
158 return grid().template lbegin< cd, All_Partition >( level_ );
162 template<
int cd, PartitionIteratorType pit >
163 typename Codim< cd >::template Partition< pit >::Iterator begin ()
const
165 return grid().template lbegin< cd, pit >( level_ );
170 typename Codim< cd >::Iterator end ()
const
172 return grid().template lend< cd, All_Partition >( level_ );
176 template<
int cd, PartitionIteratorType pit >
177 typename Codim< cd >::template Partition< pit >::Iterator end ()
const
179 return grid().template lend< cd, pit >( level_ );
184 ibegin (
const typename Codim< 0 >::Entity &entity )
const
186 if( grid().maxLevel() == 0)
188 typename IntersectionIteratorImpl::Begin begin;
189 return IntersectionIteratorImpl( entity.impl(), begin );
193 DUNE_THROW( NotImplemented,
"method ibegin not implemented on LevelGridView for AlbertaGrid." );
194 typename IntersectionIteratorImpl::End end;
195 return IntersectionIteratorImpl( entity.impl(), end );
201 iend (
const typename Codim< 0 >::Entity &entity )
const
203 typename IntersectionIteratorImpl::End end;
204 return IntersectionIteratorImpl( entity.impl(), end );
208 const CollectiveCommunication &comm ()
const
210 return grid().comm();
214 int overlapSize ( [[maybe_unused]]
int codim )
const {
return 0; }
217 int ghostSize ( [[maybe_unused]]
int codim )
const {
return 0; }
220 template<
class DataHandleImp,
class DataType >
221 void communicate ( [[maybe_unused]] CommDataHandleIF< DataHandleImp, DataType > &data,
228 const IndexSet *indexSet_;
233 template<
class Gr
idImp >
234 struct AlbertaLeafGridViewTraits
236 typedef AlbertaLeafGridView< GridImp > GridViewImp;
239 typedef typename std::remove_const<GridImp>::type Grid;
242 typedef typename Grid::Traits::LeafIndexSet IndexSet;
245 typedef typename Grid::Traits::LeafIntersection Intersection;
248 typedef typename Grid::Traits::LeafIntersectionIterator
249 IntersectionIterator;
252 typedef typename Grid::Traits::CollectiveCommunication CollectiveCommunication;
257 typedef typename Grid::Traits::template Codim< cd >::template Partition< All_Partition >::LeafIterator
260 typedef typename Grid::Traits::template Codim< cd >::Entity Entity;
262 typedef typename Grid::template Codim< cd >::Geometry Geometry;
263 typedef typename Grid::template Codim< cd >::LocalGeometry
267 template <PartitionIteratorType pit >
280 template<
class Gr
idImp >
281 class AlbertaLeafGridView
283 typedef AlbertaLeafGridView< GridImp > ThisType;
286 typedef AlbertaLeafGridViewTraits<GridImp> Traits;
289 typedef typename Traits::Grid Grid;
292 typedef typename Traits::IndexSet IndexSet;
295 typedef typename Traits::Intersection Intersection;
298 typedef typename Traits::IntersectionIterator IntersectionIterator;
301 typedef typename Traits::CollectiveCommunication CollectiveCommunication;
307 enum { conforming = Traits::conforming };
310 typedef Alberta::ElementInfo< Grid::dimension > ElementInfo;
312 typedef Dune::AlbertaGridLeafIntersectionIterator< GridImp > IntersectionIteratorImpl;
315 AlbertaLeafGridView (
const Grid &grid )
317 indexSet_( &(grid.leafIndexSet()) )
322 AlbertaLeafGridView (
const ThisType &other )
323 : grid_( other.grid_ ),
324 indexSet_( other.indexSet_ )
328 ThisType &operator= (
const ThisType & other)
331 indexSet_ = other.indexSet_;
336 const Grid &grid ()
const
342 const IndexSet &indexSet ()
const
348 int size (
int codim )
const
350 return grid().size( codim );
354 int size (
const GeometryType &type )
const
356 return grid().size( type );
361 typename Codim< cd >::Iterator begin ()
const
363 return grid().template leafbegin< cd, All_Partition >();
367 template<
int cd, PartitionIteratorType pit >
368 typename Codim< cd >::template Partition< pit >::Iterator begin ()
const
370 return grid().template leafbegin< cd, pit >();
375 typename Codim< cd >::Iterator end ()
const
377 return grid().template leafend< cd, All_Partition >();
381 template<
int cd, PartitionIteratorType pit >
382 typename Codim< cd >::template Partition< pit >::Iterator end ()
const
384 return grid().template leafend< cd, pit >();
389 ibegin (
const typename Codim< 0 >::Entity &entity )
const
391 const ElementInfo elementInfo = entity.impl().elementInfo();
392 assert( !!elementInfo );
397 if( elementInfo.elInfo().opp_vertex[ i ] == 127 )
398 DUNE_THROW( NotImplemented,
"AlbertaGrid: Intersections on outside entities are not fully implemented, yet." );
402 typename IntersectionIteratorImpl::Begin begin;
403 return IntersectionIteratorImpl( entity.impl(), begin );
408 iend (
const typename Codim< 0 >::Entity &entity )
const
410 assert( !!entity.impl().elementInfo() );
411 typename IntersectionIteratorImpl::End end;
412 return IntersectionIteratorImpl( entity.impl(), end );
416 const CollectiveCommunication &comm ()
const
418 return grid().comm();
422 int overlapSize ( [[maybe_unused]]
int codim )
const {
return 0; }
425 int ghostSize ( [[maybe_unused]]
int codim )
const {
return 0; }
428 template<
class DataHandleImp,
class DataType >
429 void communicate ( [[maybe_unused]] CommDataHandleIF< DataHandleImp, DataType > &data,
436 const IndexSet *indexSet_;
Implementation of the IntersectionIterator for AlbertaGrid.
Grid abstract base class.
Definition: grid.hh:372
@ dimension
The dimension of the grid.
Definition: grid.hh:386
A set of traits classes to store static information about grid implementation.
A few common exception classes.
Traits for type conversions and type information.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:216
Dune namespace.
Definition: alignedallocator.hh:11
Define types needed to iterate over entities of a given partition type.
Definition: gridview.hh:269
Grid::template Codim< cd >::template Partition< pit >::LeafIterator Iterator
iterator over a given codim and partition type
Definition: gridview.hh:272
Codim Structure.
Definition: gridview.hh:305
Define types needed to iterate over entities of a given partition type.
Definition: gridview.hh:61
Grid::template Codim< cd >::template Partition< pit >::LevelIterator Iterator
iterator over a given codim and partition type
Definition: gridview.hh:64
Codim Structure.
Definition: gridview.hh:97