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;
 
   52      typedef typename Grid::Traits::template Codim< cd >::template Partition< All_Partition >::LevelIterator Iterator;
 
   54      typedef typename Grid::Traits::template Codim< cd >::Entity Entity;
 
   56      typedef typename Grid::template Codim< cd >::Geometry Geometry;
 
   57      typedef typename Grid::template Codim< cd >::LocalGeometry
 
   61      template< PartitionIteratorType pit >
 
   74  template< 
class Gr
idImp >
 
   75  class AlbertaLevelGridView
 
   77    typedef AlbertaLevelGridView< GridImp > ThisType;
 
   80    typedef AlbertaLevelGridViewTraits<GridImp> Traits;
 
   83    typedef typename Traits::Grid 
Grid;
 
   86    typedef typename Traits::IndexSet 
IndexSet;
 
  101    constexpr static bool conforming = Traits::conforming;
 
  104    typedef Alberta::ElementInfo< Grid::dimension > ElementInfo;
 
  106    typedef Dune::AlbertaGridLeafIntersectionIterator< GridImp > IntersectionIteratorImpl;
 
  109    AlbertaLevelGridView ( 
const Grid &grid, 
int level )
 
  111        indexSet_( &(grid.levelIndexSet( level )) ),
 
  117    AlbertaLevelGridView ( 
const ThisType &other )
 
  118      : grid_( other.grid_ ),
 
  119        indexSet_( other.indexSet_ ),
 
  120        level_( other.level_ )
 
  124    ThisType &operator= ( 
const ThisType & other)
 
  127      indexSet_ = other.indexSet_;
 
  128      level_ = other.level_;
 
  133    const Grid &grid ()
 const 
  139    const IndexSet &indexSet ()
 const 
  145    bool isConforming()
 const { 
return bool(conforming); }
 
  148    int size ( 
int codim )
 const 
  150      return grid().size( level_, codim );
 
  154    int size ( 
const GeometryType &type )
 const 
  156      return grid().size( level_, type );
 
  161    typename Codim< cd >::Iterator begin ()
 const 
  163      return grid().template lbegin< cd, All_Partition >( level_ );
 
  167    template< 
int cd, PartitionIteratorType pit >
 
  168    typename Codim< cd >::template Partition< pit >::Iterator begin ()
 const 
  170      return grid().template lbegin< cd, pit >( level_ );
 
  175    typename Codim< cd >::Iterator end ()
 const 
  177      return grid().template lend< cd, All_Partition >( level_ );
 
  181    template< 
int cd, PartitionIteratorType pit >
 
  182    typename Codim< cd >::template Partition< pit >::Iterator end ()
 const 
  184      return grid().template lend< cd, pit >( level_ );
 
  189    ibegin ( 
const typename Codim< 0 >::Entity &entity )
 const 
  191      if( grid().maxLevel() == 0)
 
  193        typename IntersectionIteratorImpl::Begin begin;
 
  194        return IntersectionIteratorImpl( entity.impl(), begin );
 
  198        DUNE_THROW( NotImplemented, 
"method ibegin not implemented on LevelGridView for AlbertaGrid." );
 
  199        typename IntersectionIteratorImpl::End end;
 
  200        return IntersectionIteratorImpl( entity.impl(), end );
 
  206    iend ( 
const typename Codim< 0 >::Entity &entity )
 const 
  208      typename IntersectionIteratorImpl::End end;
 
  209      return IntersectionIteratorImpl( entity.impl(), end );
 
  213    const Communication &comm ()
 const 
  215      return grid().comm();
 
  219    int overlapSize ( [[maybe_unused]] 
int codim )
 const { 
return 0; }
 
  222    int ghostSize ( [[maybe_unused]] 
int codim )
 const { 
return 0; }
 
  225    template< 
class DataHandleImp, 
class DataType >
 
  226    void communicate ( [[maybe_unused]] CommDataHandleIF< DataHandleImp, DataType > &data,
 
  233    const IndexSet *indexSet_;
 
  238  template< 
class Gr
idImp >
 
  239  struct AlbertaLeafGridViewTraits
 
  241    typedef AlbertaLeafGridView< GridImp > GridViewImp;
 
  244    typedef typename std::remove_const<GridImp>::type Grid;
 
  247    typedef typename Grid::Traits::LeafIndexSet IndexSet;
 
  250    typedef typename Grid::Traits::LeafIntersection Intersection;
 
  253    typedef typename Grid::Traits::LeafIntersectionIterator
 
  254    IntersectionIterator;
 
  257    typedef typename Grid::Traits::Communication Communication;
 
  262      typedef typename Grid::Traits::template Codim< cd >::template Partition< All_Partition >::LeafIterator
 
  265      typedef typename Grid::Traits::template Codim< cd >::Entity Entity;
 
  267      typedef typename Grid::template Codim< cd >::Geometry Geometry;
 
  268      typedef typename Grid::template Codim< cd >::LocalGeometry
 
  272      template <PartitionIteratorType pit >
 
  285  template< 
class Gr
idImp >
 
  286  class AlbertaLeafGridView
 
  288    typedef AlbertaLeafGridView< GridImp > ThisType;
 
  291    typedef AlbertaLeafGridViewTraits<GridImp> Traits;
 
  294    typedef typename Traits::Grid 
Grid;
 
  297    typedef typename Traits::IndexSet 
IndexSet;
 
  312    constexpr static bool conforming = Traits::conforming;
 
  315    typedef Alberta::ElementInfo< Grid::dimension > ElementInfo;
 
  317    typedef Dune::AlbertaGridLeafIntersectionIterator< GridImp > IntersectionIteratorImpl;
 
  320    AlbertaLeafGridView ( 
const Grid &grid )
 
  322        indexSet_( &(grid.leafIndexSet()) )
 
  327    AlbertaLeafGridView ( 
const ThisType &other )
 
  328      : grid_( other.grid_ ),
 
  329        indexSet_( other.indexSet_ )
 
  333    ThisType &operator= ( 
const ThisType & other)
 
  336      indexSet_ = other.indexSet_;
 
  341    const Grid &grid ()
 const 
  347    const IndexSet &indexSet ()
 const 
  353    bool isConforming()
 const { 
return bool(conforming); }
 
  356    int size ( 
int codim )
 const 
  358      return grid().size( codim );
 
  362    int size ( 
const GeometryType &type )
 const 
  364      return grid().size( type );
 
  369    typename Codim< cd >::Iterator begin ()
 const 
  371      return grid().template leafbegin< cd, All_Partition >();
 
  375    template< 
int cd, PartitionIteratorType pit >
 
  376    typename Codim< cd >::template Partition< pit >::Iterator begin ()
 const 
  378      return grid().template leafbegin< cd, pit >();
 
  383    typename Codim< cd >::Iterator end ()
 const 
  385      return grid().template leafend< cd, All_Partition >();
 
  389    template< 
int cd, PartitionIteratorType pit >
 
  390    typename Codim< cd >::template Partition< pit >::Iterator end ()
 const 
  392      return grid().template leafend< cd, pit >();
 
  397    ibegin ( 
const typename Codim< 0 >::Entity &entity )
 const 
  399      const ElementInfo elementInfo = entity.impl().elementInfo();
 
  400      assert( !!elementInfo );
 
  405        if( elementInfo.elInfo().opp_vertex[ i ] == 127 )
 
  406          DUNE_THROW( NotImplemented, 
"AlbertaGrid: Intersections on outside entities are not fully implemented, yet." );
 
  410      typename IntersectionIteratorImpl::Begin begin;
 
  411      return IntersectionIteratorImpl( entity.impl(), begin );
 
  416    iend ( 
const typename Codim< 0 >::Entity &entity )
 const 
  418      assert( !!entity.impl().elementInfo() );
 
  419      typename IntersectionIteratorImpl::End end;
 
  420      return IntersectionIteratorImpl( entity.impl(), end );
 
  424    const Communication &comm ()
 const 
  426      return grid().comm();
 
  430    int overlapSize ( [[maybe_unused]] 
int codim )
 const { 
return 0; }
 
  433    int ghostSize ( [[maybe_unused]] 
int codim )
 const { 
return 0; }
 
  436    template< 
class DataHandleImp, 
class DataType >
 
  437    void communicate ( [[maybe_unused]] CommDataHandleIF< DataHandleImp, DataType > &data,
 
  444    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,...)
Definition: exceptions.hh:314
 
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: gridview.hh:274
 
Grid::template Codim< cd >::template Partition< pit >::LeafIterator Iterator
iterator over a given codim and partition type
Definition: gridview.hh:277
 
Codim Structure.
Definition: gridview.hh:310
 
Define types needed to iterate over entities of a given partition type.
Definition: gridview.hh:63
 
Grid::template Codim< cd >::template Partition< pit >::LevelIterator Iterator
iterator over a given codim and partition type
Definition: gridview.hh:66
 
Codim Structure.
Definition: gridview.hh:99
 
Traits for type conversions and type information.