Dune Core Modules (2.4.2)

gridview.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_GRIDVIEW_HH
4#define DUNE_GRIDVIEW_HH
5
6#include <dune/common/iteratorrange.hh>
7
9
11#include <dune/grid/common/rangegenerators.hh>
12
13namespace Dune
14{
15
16 template< int, int, class, class >
17 class GridDefaultImplementation;
18
19
20
57 template< class ViewTraits >
59 {
61
62#if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
63 public:
64#else
65 protected:
66#endif
67 // type of underlying implementation, for internal use only
68 typedef typename ViewTraits :: GridViewImp Implementation;
69
70 public:
71 typedef typename ViewTraits :: GridViewImp GridViewImp;
72
74 typedef ViewTraits Traits;
75
77 typedef typename Traits :: Grid Grid;
78
80 typedef typename Traits :: IndexSet IndexSet;
81
83 typedef typename Traits :: Intersection Intersection;
84
86 typedef typename Traits :: IntersectionIterator IntersectionIterator;
87
89 typedef typename Traits :: CollectiveCommunication CollectiveCommunication;
90
94 template< int cd >
95 struct Codim {
97 typedef typename Traits :: template Codim<cd> :: Iterator Iterator;
98
100 typedef typename Traits :: template Codim<cd> :: EntityPointer EntityPointer;
101
103 typedef typename Traits :: template Codim<cd> :: Entity Entity;
104
106 typedef typename Traits :: template Codim<cd> :: Geometry Geometry;
107
109 typedef typename Traits :: template Codim<cd> :: LocalGeometry LocalGeometry;
110
112 template< PartitionIteratorType pit >
114 {
116 typedef typename Traits :: template Codim< cd >
118 };
119 }; //: public Traits :: template Codim<cd> {};
120
121 enum {
123 conforming = Traits :: conforming
124 };
125
127 typedef typename Grid::ctype ctype;
128
129 enum {
131 };
132
133 enum {
135 };
136
137 public:
138
139 //===========================================================
143 //===========================================================
145 GridView ( const Implementation &imp )
146 : impl_( imp )
147 {}
149
151 GridView ( const ThisType &other )
152 : impl_( other.impl_ )
153 {}
154
156 ThisType &operator= ( const ThisType &other )
157 {
158 impl_ = other.impl_;
159 return *this;
160 }
161
162 public:
164 const Grid &grid () const
165 {
166 return impl().grid();
167 }
168
175 const IndexSet &indexSet () const
176 {
177 return impl().indexSet();
178 }
179
181 int size ( int codim ) const
182 {
183 return impl().size( codim );
184 }
185
187 int size ( const GeometryType &type ) const
188 {
189 return impl().size( type );
190 }
191
198 template<class EntityType>
199 bool contains (const EntityType& e) const
200 {
201 return impl().indexSet().contains(e);
202 }
203
205 template< int cd >
206 typename Codim< cd > :: Iterator begin () const
207 {
208 return impl().template begin<cd>();
209 }
210
212 template< int cd >
213 typename Codim< cd > :: Iterator end () const
214 {
215 return impl().template end<cd>();
216 }
217
219 template< int cd , PartitionIteratorType pitype >
220 typename Codim< cd > :: template Partition< pitype > :: Iterator
221 begin () const
222 {
223 return impl().template begin<cd,pitype>();
224 }
225
227 template< int cd, PartitionIteratorType pitype >
228 typename Codim< cd > :: template Partition< pitype > :: Iterator
229 end () const
230 {
231 return impl().template end<cd,pitype>();
232 }
233
236 ibegin ( const typename Codim< 0 > :: Entity &entity ) const
237 {
238 return impl().ibegin(entity);
239 }
240
243 iend ( const typename Codim< 0 > :: Entity &entity ) const
244 {
245 return impl().iend(entity);
246 }
247
250 {
251 return impl().comm();
252 }
253
255 int overlapSize(int codim) const
256 {
257 return impl().overlapSize(codim);
258 }
259
261 int ghostSize(int codim) const
262 {
263 return impl().ghostSize(codim);
264 }
265
267 template< class DataHandleImp, class DataType >
269 InterfaceType iftype,
270 CommunicationDirection dir ) const
271 {
272 impl().communicate(data,iftype,dir);
273 }
274
275#if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
276 public:
277#else
278 protected:
279 // give the GridDefaultImplementation class access to the realImp
280 friend class GridDefaultImplementation< Grid::dimension, Grid::dimensionworld, typename Grid::ctype, typename Grid::GridFamily >;
281#endif
283 Implementation &impl () { return impl_; }
285 const Implementation &impl () const { return impl_; }
286
287 protected:
288 Implementation impl_;
289 };
290
291} // namespace Dune
292
293#endif // #ifndef DUNE_GRIDVIEW_HH
CommDataHandleIF describes the features of a data handle for communication in parallel runs using the...
Definition: datahandleif.hh:73
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:25
Definition: grid.hh:1030
Grid view abstract base class.
Definition: gridview.hh:59
Grid abstract base class.
Definition: grid.hh:388
@ dimensionworld
The dimension of the world the grid lives in.
Definition: grid.hh:408
@ dimension
The dimension of the grid.
Definition: grid.hh:402
ct ctype
Define type used for coordinates in grid module.
Definition: grid.hh:548
Mesh entities of codimension 0 ("elements") allow to visit all intersections with "neighboring" eleme...
Definition: intersectioniterator.hh:84
Describes the parallel communication interface class for MessageBuffers and DataHandles.
const IndexSet & indexSet() const
obtain the index set
Definition: gridview.hh:175
Traits::Grid Grid
type of the grid
Definition: gridview.hh:77
ThisType & operator=(const ThisType &other)
assignment operator
Definition: gridview.hh:156
Codim< cd >::Iterator begin() const
obtain begin iterator for this view
Definition: gridview.hh:206
const Grid & grid() const
obtain a const reference to the underlying hierarchic grid
Definition: gridview.hh:164
Codim< cd >::Iterator end() const
obtain end iterator for this view
Definition: gridview.hh:213
Implementation & impl()
return reference to the real implementation
Definition: gridview.hh:283
Traits::template Codim< cd >::Iterator Iterator
type of iterator returned by the grid view
Definition: gridview.hh:97
const CollectiveCommunication & comm() const
obtain collective communication object
Definition: gridview.hh:249
Traits::template Codim< cd >::template Partition< pit >::Iterator Iterator
iterator over a given codim and partition type
Definition: gridview.hh:117
ViewTraits Traits
Traits class.
Definition: gridview.hh:74
Traits::IntersectionIterator IntersectionIterator
type of the intersection iterator
Definition: gridview.hh:86
const Implementation & impl() const
return reference to the real implementation
Definition: gridview.hh:285
IntersectionIterator ibegin(const typename Codim< 0 > ::Entity &entity) const
obtain begin intersection iterator with respect to this view
Definition: gridview.hh:236
Traits::IndexSet IndexSet
type of the index set
Definition: gridview.hh:80
int overlapSize(int codim) const
Return size of the overlap region for a given codim on the grid view.
Definition: gridview.hh:255
Traits::CollectiveCommunication CollectiveCommunication
type of the collective communication
Definition: gridview.hh:89
int size(const GeometryType &type) const
obtain number of entities with a given geometry type
Definition: gridview.hh:187
Traits::template Codim< cd >::EntityPointer EntityPointer
type of corresponding entity pointer
Definition: gridview.hh:100
int size(int codim) const
obtain number of entities in a given codimension
Definition: gridview.hh:181
void communicate(CommDataHandleIF< DataHandleImp, DataType > &data, InterfaceType iftype, CommunicationDirection dir) const
Communicate data on this view.
Definition: gridview.hh:268
GridView(const Implementation &imp)
constructor (engine concept)
Definition: gridview.hh:145
Codim< cd >::template Partition< pitype >::Iterator begin() const
obtain begin iterator for this view
Definition: gridview.hh:221
Traits::Intersection Intersection
type of the intersection
Definition: gridview.hh:83
IntersectionIterator iend(const typename Codim< 0 > ::Entity &entity) const
obtain end intersection iterator with respect to this view
Definition: gridview.hh:243
Traits::template Codim< cd >::Entity Entity
type of corresponding entity
Definition: gridview.hh:103
Traits::template Codim< cd >::LocalGeometry LocalGeometry
type of the implementation for local geometries
Definition: gridview.hh:109
Grid::ctype ctype
type used for coordinates in grid
Definition: gridview.hh:127
Codim< cd >::template Partition< pitype >::Iterator end() const
obtain end iterator for this view
Definition: gridview.hh:229
bool contains(const EntityType &e) const
Return true if the given entity is contained in this grid view.
Definition: gridview.hh:199
GridView(const ThisType &other)
Copy constructor.
Definition: gridview.hh:151
Traits::template Codim< cd >::Geometry Geometry
type of the geometry implementation
Definition: gridview.hh:106
int ghostSize(int codim) const
Return size of the ghost region for a given codim on the grid view.
Definition: gridview.hh:261
@ conforming
Export if this grid view is conforming.
Definition: gridview.hh:123
@ dimension
The dimension of the grid.
Definition: gridview.hh:130
@ dimensionworld
The dimension of the world the grid lives in.
Definition: gridview.hh:134
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:168
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:84
Dune namespace.
Definition: alignment.hh:10
Define types needed to iterate over entities of a given partition type.
Definition: gridview.hh:114
A struct that collects all associated types of one implementation from the Traits class.
Definition: gridview.hh:95
A unique label for each type of element that can occur in a grid.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 20, 23:31, 2024)