5#ifndef DUNE_ALBERTAGRID_GRIDVIEW_HH
6#define DUNE_ALBERTAGRID_GRIDVIEW_HH
14#include <dune/grid/common/gridview.hh>
21 template<
class Gr
idImp >
22 class AlbertaLevelGridView;
24 template<
class Gr
idImp >
25 class AlbertaLeafGridView;
28 template<
class Gr
idImp >
29 struct AlbertaLevelGridViewTraits
31 typedef AlbertaLevelGridView< GridImp > GridViewImp;
34 typedef typename std::remove_const<GridImp>::type Grid;
37 typedef typename Grid::Traits::LevelIndexSet IndexSet;
40 typedef typename Grid::Traits::LevelIntersection Intersection;
43 typedef typename Grid::Traits::LevelIntersectionIterator
47 typedef typename Grid::Traits::Communication Communication;
50 [[deprecated(
"Use Communication instead!")]]
56 typedef typename Grid::Traits::template Codim< cd >::template Partition< All_Partition >::LevelIterator Iterator;
58 typedef typename Grid::Traits::template Codim< cd >::Entity Entity;
60 typedef typename Grid::template Codim< cd >::Geometry Geometry;
61 typedef typename Grid::template Codim< cd >::LocalGeometry
65 template< PartitionIteratorType pit >
78 template<
class Gr
idImp >
79 class AlbertaLevelGridView
81 typedef AlbertaLevelGridView< GridImp > ThisType;
84 typedef AlbertaLevelGridViewTraits<GridImp> Traits;
87 typedef typename Traits::Grid
Grid;
90 typedef typename Traits::IndexSet
IndexSet;
102 [[deprecated(
"Use Communication instead!")]]
109 constexpr static bool conforming = Traits::conforming;
112 typedef Alberta::ElementInfo< Grid::dimension > ElementInfo;
114 typedef Dune::AlbertaGridLeafIntersectionIterator< GridImp > IntersectionIteratorImpl;
117 AlbertaLevelGridView (
const Grid &grid,
int level )
119 indexSet_( &(grid.levelIndexSet( level )) ),
125 AlbertaLevelGridView (
const ThisType &other )
126 : grid_( other.grid_ ),
127 indexSet_( other.indexSet_ ),
128 level_( other.level_ )
132 ThisType &operator= (
const ThisType & other)
135 indexSet_ = other.indexSet_;
136 level_ = other.level_;
141 const Grid &grid ()
const
147 const IndexSet &indexSet ()
const
153 bool isConforming()
const {
return bool(conforming); }
156 int size (
int codim )
const
158 return grid().size( level_, codim );
162 int size (
const GeometryType &type )
const
164 return grid().size( level_, type );
169 typename Codim< cd >::Iterator begin ()
const
171 return grid().template lbegin< cd, All_Partition >( level_ );
175 template<
int cd, PartitionIteratorType pit >
176 typename Codim< cd >::template Partition< pit >::Iterator begin ()
const
178 return grid().template lbegin< cd, pit >( level_ );
183 typename Codim< cd >::Iterator end ()
const
185 return grid().template lend< cd, All_Partition >( level_ );
189 template<
int cd, PartitionIteratorType pit >
190 typename Codim< cd >::template Partition< pit >::Iterator end ()
const
192 return grid().template lend< cd, pit >( level_ );
197 ibegin (
const typename Codim< 0 >::Entity &entity )
const
199 if( grid().maxLevel() == 0)
201 typename IntersectionIteratorImpl::Begin begin;
202 return IntersectionIteratorImpl( entity.impl(), begin );
206 DUNE_THROW( NotImplemented,
"method ibegin not implemented on LevelGridView for AlbertaGrid." );
207 typename IntersectionIteratorImpl::End end;
208 return IntersectionIteratorImpl( entity.impl(), end );
214 iend (
const typename Codim< 0 >::Entity &entity )
const
216 typename IntersectionIteratorImpl::End end;
217 return IntersectionIteratorImpl( entity.impl(), end );
221 const Communication &comm ()
const
223 return grid().comm();
227 int overlapSize ( [[maybe_unused]]
int codim )
const {
return 0; }
230 int ghostSize ( [[maybe_unused]]
int codim )
const {
return 0; }
233 template<
class DataHandleImp,
class DataType >
234 void communicate ( [[maybe_unused]] CommDataHandleIF< DataHandleImp, DataType > &data,
241 const IndexSet *indexSet_;
246 template<
class Gr
idImp >
247 struct AlbertaLeafGridViewTraits
249 typedef AlbertaLeafGridView< GridImp > GridViewImp;
252 typedef typename std::remove_const<GridImp>::type Grid;
255 typedef typename Grid::Traits::LeafIndexSet IndexSet;
258 typedef typename Grid::Traits::LeafIntersection Intersection;
261 typedef typename Grid::Traits::LeafIntersectionIterator
262 IntersectionIterator;
265 typedef typename Grid::Traits::Communication Communication;
268 [[deprecated(
"Use Communication instead!")]]
274 typedef typename Grid::Traits::template Codim< cd >::template Partition< All_Partition >::LeafIterator
277 typedef typename Grid::Traits::template Codim< cd >::Entity Entity;
279 typedef typename Grid::template Codim< cd >::Geometry Geometry;
280 typedef typename Grid::template Codim< cd >::LocalGeometry
284 template <PartitionIteratorType pit >
297 template<
class Gr
idImp >
298 class AlbertaLeafGridView
300 typedef AlbertaLeafGridView< GridImp > ThisType;
303 typedef AlbertaLeafGridViewTraits<GridImp> Traits;
306 typedef typename Traits::Grid
Grid;
309 typedef typename Traits::IndexSet
IndexSet;
321 [[deprecated(
"Use Communication instead!")]]
328 constexpr static bool conforming = Traits::conforming;
331 typedef Alberta::ElementInfo< Grid::dimension > ElementInfo;
333 typedef Dune::AlbertaGridLeafIntersectionIterator< GridImp > IntersectionIteratorImpl;
336 AlbertaLeafGridView (
const Grid &grid )
338 indexSet_( &(grid.leafIndexSet()) )
343 AlbertaLeafGridView (
const ThisType &other )
344 : grid_( other.grid_ ),
345 indexSet_( other.indexSet_ )
349 ThisType &operator= (
const ThisType & other)
352 indexSet_ = other.indexSet_;
357 const Grid &grid ()
const
363 const IndexSet &indexSet ()
const
369 bool isConforming()
const {
return bool(conforming); }
372 int size (
int codim )
const
374 return grid().size( codim );
378 int size (
const GeometryType &type )
const
380 return grid().size( type );
385 typename Codim< cd >::Iterator begin ()
const
387 return grid().template leafbegin< cd, All_Partition >();
391 template<
int cd, PartitionIteratorType pit >
392 typename Codim< cd >::template Partition< pit >::Iterator begin ()
const
394 return grid().template leafbegin< cd, pit >();
399 typename Codim< cd >::Iterator end ()
const
401 return grid().template leafend< cd, All_Partition >();
405 template<
int cd, PartitionIteratorType pit >
406 typename Codim< cd >::template Partition< pit >::Iterator end ()
const
408 return grid().template leafend< cd, pit >();
413 ibegin (
const typename Codim< 0 >::Entity &entity )
const
415 const ElementInfo elementInfo = entity.impl().elementInfo();
416 assert( !!elementInfo );
421 if( elementInfo.elInfo().opp_vertex[ i ] == 127 )
422 DUNE_THROW( NotImplemented,
"AlbertaGrid: Intersections on outside entities are not fully implemented, yet." );
426 typename IntersectionIteratorImpl::Begin begin;
427 return IntersectionIteratorImpl( entity.impl(), begin );
432 iend (
const typename Codim< 0 >::Entity &entity )
const
434 assert( !!entity.impl().elementInfo() );
435 typename IntersectionIteratorImpl::End end;
436 return IntersectionIteratorImpl( entity.impl(), end );
440 const Communication &comm ()
const
442 return grid().comm();
446 int overlapSize ( [[maybe_unused]]
int codim )
const {
return 0; }
449 int ghostSize ( [[maybe_unused]]
int codim )
const {
return 0; }
452 template<
class DataHandleImp,
class DataType >
453 void communicate ( [[maybe_unused]] CommDataHandleIF< DataHandleImp, DataType > &data,
460 const IndexSet *indexSet_;
Implementation of the IntersectionIterator for AlbertaGrid.
Collective communication interface and sequential default implementation.
Definition: communication.hh:100
Grid abstract base class.
Definition: grid.hh:375
static constexpr int dimension
The dimension of the grid.
Definition: grid.hh:387
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.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
Dune namespace.
Definition: alignedallocator.hh:13
Communication< T > CollectiveCommunication
Definition: communication.hh:541
Define types needed to iterate over entities of a given partition type.
Definition: gridview.hh:286
Grid::template Codim< cd >::template Partition< pit >::LeafIterator Iterator
iterator over a given codim and partition type
Definition: gridview.hh:289
Codim Structure.
Definition: gridview.hh:326
Define types needed to iterate over entities of a given partition type.
Definition: gridview.hh:67
Grid::template Codim< cd >::template Partition< pit >::LevelIterator Iterator
iterator over a given codim and partition type
Definition: gridview.hh:70
Codim Structure.
Definition: gridview.hh:107
Traits for type conversions and type information.