5#ifndef DUNE_GEOGRID_GRIDVIEW_HH
6#define DUNE_GEOGRID_GRIDVIEW_HH
12#include <dune/grid/common/gridview.hh>
13#include <dune/grid/geometrygrid/datahandle.hh>
14#include <dune/grid/geometrygrid/indexsets.hh>
15#include <dune/grid/geometrygrid/intersection.hh>
16#include <dune/grid/geometrygrid/intersectioniterator.hh>
17#include <dune/grid/geometrygrid/iterator.hh>
28 template<
class HGV,
class CoordFunction,
class Allocator >
36 template<
class HGV,
class CoordFunction,
class Allocator >
39 friend class GridView< HGV, CoordFunction, Allocator >;
41 typedef HGV HostGridView;
43 typedef typename HostGridView::Grid HostGrid;
44 typedef typename HostGridView::Intersection HostIntersection;
45 typedef typename HostGridView::IntersectionIterator HostIntersectionIterator;
48 typedef GridView< HostGridView, CoordFunction, Allocator > GridViewImp;
52 typedef GeoGrid::IndexSet< const Grid, typename HostGridView::IndexSet > IndexSet;
57 <
const Grid, GeoGrid::IntersectionIterator< const Grid, HostIntersectionIterator >, GeoGrid::Intersection< const Grid, HostIntersection > >
60 typedef typename HostGridView::Communication Communication;
65 typedef GeoGrid::Iterator< HostGridView, codim, All_Partition, const Grid > IteratorImp;
68 typedef typename Grid::Traits::template Codim< codim >::Entity Entity;
70 typedef typename Grid::template Codim< codim >::Geometry Geometry;
71 typedef typename Grid::template Codim< codim >::LocalGeometry LocalGeometry;
73 template< PartitionIteratorType pit >
76 typedef GeoGrid::Iterator< HostGridView, codim, pit, const Grid > IteratorImp;
81 static const bool conforming = HostGridView::conforming;
89 template<
class HGV,
class CoordFunction,
class Allocator >
92 typedef GridView< HGV, CoordFunction, Allocator > This;
95 typedef GridViewTraits< HGV, CoordFunction, Allocator > Traits;
97 typedef typename Traits::HostGridView HostGridView;
99 typedef typename Traits::Grid Grid;
101 typedef typename Traits::IndexSet IndexSet;
103 typedef typename Traits::Intersection Intersection;
105 typedef typename Traits::IntersectionIterator IntersectionIterator;
107 typedef typename Traits::Communication Communication;
109 template<
int codim >
111 :
public Traits::template Codim< codim >
114 static const bool conforming = Traits::conforming;
116 GridView (
const Grid &grid,
const HostGridView &hostGridView )
117 : grid_( &grid ), hostGridView_( hostGridView )
120 GridView (
const This &other )
121 : grid_( other.grid_ ), hostGridView_( other.hostGridView_ )
124 GridView ( This &&other )
125 : grid_( other.grid_ ), hostGridView_(
std::move( other.hostGridView_ ) )
128 This &operator= (
const This &other )
131 hostGridView_ = other.hostGridView_;
133 indexSet_.reset( hostGridView().indexSet() );
137 This &operator= ( This &&other )
140 hostGridView_ = std::move( other.hostGridView_ );
142 indexSet_.reset( hostGridView().indexSet() );
146 const Grid &grid ()
const
152 const IndexSet &indexSet ()
const
154 indexSet_.reset( hostGridView().indexSet() );
158 bool isConforming()
const {
return hostGridView().isConforming(); }
160 int size (
int codim )
const
162 return hostGridView().size( codim );
165 int size (
const GeometryType &type )
const
167 return hostGridView().size( type );
170 template<
int codim >
171 typename Codim< codim >::Iterator begin ()
const
173 return begin< codim, All_Partition >();
176 template<
int codim, PartitionIteratorType pit >
177 typename Codim< codim >::template Partition< pit >::Iterator begin ()
const
179 return Traits::template Codim< codim >::template Partition< pit >::IteratorImp::begin( grid(), hostGridView() );
182 template<
int codim >
183 typename Codim< codim >::Iterator end ()
const
185 return end< codim, All_Partition >();
188 template<
int codim, PartitionIteratorType pit >
189 typename Codim< codim >::template Partition< pit >::Iterator end ()
const
191 return Traits::template Codim< codim >::template Partition< pit >::IteratorImp::end( grid(), hostGridView() );
194 IntersectionIterator ibegin (
const typename Codim< 0 >::Entity &entity )
const
196 typedef GeoGrid::IntersectionIterator< const Grid, typename HostGridView::IntersectionIterator > IntersectionIteratorImpl;
197 return IntersectionIteratorImpl( entity, hostGridView().ibegin( entity.impl().hostEntity() ) );
200 IntersectionIterator iend (
const typename Codim< 0 >::Entity &entity )
const
202 typedef GeoGrid::IntersectionIterator< const Grid, typename HostGridView::IntersectionIterator > IntersectionIteratorImpl;
203 return IntersectionIteratorImpl( entity, hostGridView().iend( entity.impl().hostEntity() ) );
206 const Communication &comm ()
const
208 return hostGridView().comm();
211 int overlapSize (
int codim )
const
213 return hostGridView().overlapSize( codim );
216 int ghostSize (
int codim )
const
218 return hostGridView().ghostSize( codim );
221 template<
class DataHandle,
class Data >
222 auto communicate ( CommDataHandleIF< DataHandle, Data > &dataHandle,
226 typedef CommDataHandleIF< DataHandle, Data > DataHandleIF;
227 typedef GeoGrid::CommDataHandle< Grid, DataHandleIF > WrappedDataHandle;
229 WrappedDataHandle wrappedDataHandle( grid(), dataHandle );
230 return hostGridView().communicate( wrappedDataHandle, interface, direction );
233 const HostGridView &hostGridView ()
const {
return hostGridView_; }
237 HostGridView hostGridView_;
238 mutable IndexSet indexSet_;
interface class for an iterator over grid entities
Definition: entityiterator.hh:32
grid wrapper replacing the geometries
Definition: grid.hh:86
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 few common exception classes.
A set of traits classes to store static information about grid implementation.
@ conforming
Output conforming data.
Definition: common.hh:73
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
Traits for type conversions and type information.