3#ifndef DUNE_GEOGRID_GRIDVIEW_HH
4#define DUNE_GEOGRID_GRIDVIEW_HH
10#include <dune/grid/common/gridview.hh>
11#include <dune/grid/geometrygrid/datahandle.hh>
12#include <dune/grid/geometrygrid/indexsets.hh>
13#include <dune/grid/geometrygrid/intersection.hh>
14#include <dune/grid/geometrygrid/intersectioniterator.hh>
15#include <dune/grid/geometrygrid/iterator.hh>
26 template<
class HGV,
class CoordFunction,
class Allocator >
34 template<
class HGV,
class CoordFunction,
class Allocator >
37 friend class GridView< HGV, CoordFunction, Allocator >;
39 typedef HGV HostGridView;
41 typedef typename HostGridView::Grid HostGrid;
42 typedef typename HostGridView::Intersection HostIntersection;
43 typedef typename HostGridView::IntersectionIterator HostIntersectionIterator;
46 typedef GridView< HostGridView, CoordFunction, Allocator > GridViewImp;
50 typedef GeoGrid::IndexSet< const Grid, typename HostGridView::IndexSet > IndexSet;
55 <
const Grid, GeoGrid::IntersectionIterator< const Grid, HostIntersectionIterator >, GeoGrid::Intersection< const Grid, HostIntersection > >
58 typedef typename HostGridView::CollectiveCommunication CollectiveCommunication;
63 typedef GeoGrid::Iterator< HostGridView, codim, All_Partition, const Grid > IteratorImp;
66 typedef typename Grid::Traits::template Codim< codim >::Entity Entity;
68 typedef typename Grid::template Codim< codim >::Geometry Geometry;
69 typedef typename Grid::template Codim< codim >::LocalGeometry LocalGeometry;
71 template< PartitionIteratorType pit >
74 typedef GeoGrid::Iterator< HostGridView, codim, pit, const Grid > IteratorImp;
79 static const bool conforming = HostGridView::conforming;
87 template<
class HGV,
class CoordFunction,
class Allocator >
90 typedef GridView< HGV, CoordFunction, Allocator > This;
93 typedef GridViewTraits< HGV, CoordFunction, Allocator > Traits;
95 typedef typename Traits::HostGridView HostGridView;
97 typedef typename Traits::Grid Grid;
99 typedef typename Traits::IndexSet IndexSet;
101 typedef typename Traits::Intersection Intersection;
103 typedef typename Traits::IntersectionIterator IntersectionIterator;
105 typedef typename Traits::CollectiveCommunication CollectiveCommunication;
107 template<
int codim >
109 :
public Traits::template Codim< codim >
112 static const bool conforming = Traits::conforming;
114 GridView (
const Grid &grid,
const HostGridView &hostGridView )
115 : grid_( &grid ), hostGridView_( hostGridView )
118 GridView (
const This &other )
119 : grid_( other.grid_ ), hostGridView_( other.hostGridView_ )
122 GridView ( This &&other )
123 : grid_( other.grid_ ), hostGridView_(
std::move( other.hostGridView_ ) )
126 This &operator= (
const This &other )
129 hostGridView_ = other.hostGridView_;
131 indexSet_.reset( hostGridView().indexSet() );
135 This &operator= ( This &&other )
138 hostGridView_ = std::move( other.hostGridView_ );
140 indexSet_.reset( hostGridView().indexSet() );
144 const Grid &grid ()
const
150 const IndexSet &indexSet ()
const
152 indexSet_.reset( hostGridView().indexSet() );
156 int size (
int codim )
const
158 return hostGridView().size( codim );
161 int size (
const GeometryType &type )
const
163 return hostGridView().size( type );
166 template<
int codim >
167 typename Codim< codim >::Iterator begin ()
const
169 return begin< codim, All_Partition >();
172 template<
int codim, PartitionIteratorType pit >
173 typename Codim< codim >::template Partition< pit >::Iterator begin ()
const
175 return Traits::template Codim< codim >::template Partition< pit >::IteratorImp::begin( grid(), hostGridView() );
178 template<
int codim >
179 typename Codim< codim >::Iterator end ()
const
181 return end< codim, All_Partition >();
184 template<
int codim, PartitionIteratorType pit >
185 typename Codim< codim >::template Partition< pit >::Iterator end ()
const
187 return Traits::template Codim< codim >::template Partition< pit >::IteratorImp::end( grid(), hostGridView() );
190 IntersectionIterator ibegin (
const typename Codim< 0 >::Entity &entity )
const
192 typedef GeoGrid::IntersectionIterator< const Grid, typename HostGridView::IntersectionIterator > IntersectionIteratorImpl;
196 IntersectionIterator iend (
const typename Codim< 0 >::Entity &entity )
const
198 typedef GeoGrid::IntersectionIterator< const Grid, typename HostGridView::IntersectionIterator > IntersectionIteratorImpl;
202 const CollectiveCommunication &comm ()
const
204 return hostGridView().comm();
207 int overlapSize (
int codim )
const
209 return hostGridView().overlapSize( codim );
212 int ghostSize (
int codim )
const
214 return hostGridView().ghostSize( codim );
217 template<
class DataHandle,
class Data >
218 void communicate ( CommDataHandleIF< DataHandle, Data > &dataHandle,
222 typedef CommDataHandleIF< DataHandle, Data > DataHandleIF;
223 typedef GeoGrid::CommDataHandle< Grid, DataHandleIF > WrappedDataHandle;
225 WrappedDataHandle wrappedDataHandle( grid(), dataHandle );
226 hostGridView().communicate( wrappedDataHandle, interface, direction );
229 const HostGridView &hostGridView ()
const {
return hostGridView_; }
233 HostGridView hostGridView_;
234 mutable IndexSet indexSet_;
interface class for an iterator over grid entities
Definition: entityiterator.hh:30
grid wrapper replacing the geometries
Definition: grid.hh:82
static std::conditional< std::is_reference< InterfaceType >::value, typenamestd::add_lvalue_reference< typenameReturnImplementationType< typenamestd::remove_reference< InterfaceType >::type >::ImplementationType >::type, typenamestd::remove_const< typenameReturnImplementationType< typenamestd::remove_reference< InterfaceType >::type >::ImplementationType >::type >::type getRealImplementation(InterfaceType &&i)
return real implementation of interface class
Definition: grid.hh:1026
Mesh entities of codimension 0 ("elements") allow to visit all intersections with "neighboring" eleme...
Definition: intersectioniterator.hh:81
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: intersection.hh:162
A set of traits classes to store static information about grid implementation.
A few common exception classes.
@ conforming
Output conforming data.
Definition: common.hh:70
Dune namespace.
Definition: alignedallocator.hh:10
Traits for type conversions and type information.