Dune Core Modules (2.5.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 
8 #include <dune/geometry/type.hh>
9 
11 #include <dune/grid/common/rangegenerators.hh>
12 
13 namespace Dune
14 {
15 
16  template< int, int, class, class >
17  class GridDefaultImplementation;
18 
19 
20 
58  template< class ViewTraits >
59  class GridView
60  {
62 
63 #if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
64  public:
65 #else
66  protected:
67 #endif
68  // type of underlying implementation, for internal use only
69  typedef typename ViewTraits :: GridViewImp Implementation;
70 
71  public:
72  typedef typename ViewTraits :: GridViewImp GridViewImp;
73 
75  typedef ViewTraits Traits;
76 
78  typedef typename Traits :: Grid Grid;
79 
81  typedef typename Traits :: IndexSet IndexSet;
82 
84  typedef typename Traits :: Intersection Intersection;
85 
87  typedef typename Traits :: IntersectionIterator IntersectionIterator;
88 
90  typedef typename Traits :: CollectiveCommunication CollectiveCommunication;
91 
95  template< int cd >
96  struct Codim {
98  typedef typename Traits :: template Codim<cd> :: Iterator Iterator;
99 
101  typedef typename Traits :: template Codim<cd> :: Entity Entity;
102 
104  typedef typename Traits :: template Codim<cd> :: Geometry Geometry;
105 
107  typedef typename Traits :: template Codim<cd> :: LocalGeometry LocalGeometry;
108 
110  template< PartitionIteratorType pit >
111  struct Partition
112  {
114  typedef typename Traits :: template Codim< cd >
116  };
117  }; //: public Traits :: template Codim<cd> {};
118 
119  enum {
121  conforming = Traits :: conforming
122  };
123 
125  typedef typename Grid::ctype ctype;
126 
127  enum {
129  };
130 
131  enum {
133  };
134 
135  public:
136 
137  //===========================================================
141  //===========================================================
143  GridView ( const Implementation &imp )
144  : impl_( imp )
145  {}
147 
149  GridView ( const ThisType &other )
150  : impl_( other.impl_ )
151  {}
152 
154  ThisType &operator= ( const ThisType &other )
155  {
156  impl_ = other.impl_;
157  return *this;
158  }
159 
160  public:
162  const Grid &grid () const
163  {
164  return impl().grid();
165  }
166 
173  const IndexSet &indexSet () const
174  {
175  return impl().indexSet();
176  }
177 
179  int size ( int codim ) const
180  {
181  return impl().size( codim );
182  }
183 
185  int size ( const GeometryType &type ) const
186  {
187  return impl().size( type );
188  }
189 
196  template<class EntityType>
197  bool contains (const EntityType& e) const
198  {
199  return impl().indexSet().contains(e);
200  }
201 
203  template< int cd >
204  typename Codim< cd > :: Iterator begin () const
205  {
206  return impl().template begin<cd>();
207  }
208 
210  template< int cd >
211  typename Codim< cd > :: Iterator end () const
212  {
213  return impl().template end<cd>();
214  }
215 
217  template< int cd , PartitionIteratorType pitype >
218  typename Codim< cd > :: template Partition< pitype > :: Iterator
219  begin () const
220  {
221  return impl().template begin<cd,pitype>();
222  }
223 
225  template< int cd, PartitionIteratorType pitype >
226  typename Codim< cd > :: template Partition< pitype > :: Iterator
227  end () const
228  {
229  return impl().template end<cd,pitype>();
230  }
231 
234  ibegin ( const typename Codim< 0 > :: Entity &entity ) const
235  {
236  return impl().ibegin(entity);
237  }
238 
241  iend ( const typename Codim< 0 > :: Entity &entity ) const
242  {
243  return impl().iend(entity);
244  }
245 
248  {
249  return impl().comm();
250  }
251 
253  int overlapSize(int codim) const
254  {
255  return impl().overlapSize(codim);
256  }
257 
259  int ghostSize(int codim) const
260  {
261  return impl().ghostSize(codim);
262  }
263 
265  template< class DataHandleImp, class DataType >
267  InterfaceType iftype,
268  CommunicationDirection dir ) const
269  {
270  impl().communicate(data,iftype,dir);
271  }
272 
273 #if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
274  public:
275 #else
276  protected:
277  // give the GridDefaultImplementation class access to the realImp
278  friend class GridDefaultImplementation< Grid::dimension, Grid::dimensionworld, typename Grid::ctype, typename Grid::GridFamily >;
279 #endif
281  Implementation &impl () { return impl_; }
283  const Implementation &impl () const { return impl_; }
284 
285  protected:
286  Implementation impl_;
287  };
288 
289 } // namespace Dune
290 
291 #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:268
Definition: grid.hh:920
Grid view abstract base class.
Definition: gridview.hh:60
Grid abstract base class.
Definition: grid.hh:373
@ dimensionworld
The dimension of the world the grid lives in.
Definition: grid.hh:393
@ dimension
The dimension of the grid.
Definition: grid.hh:387
ct ctype
Define type used for coordinates in grid module.
Definition: grid.hh:522
Mesh entities of codimension 0 ("elements") allow to visit all intersections with "neighboring" eleme...
Definition: intersectioniterator.hh:81
Describes the parallel communication interface class for MessageBuffers and DataHandles.
const Implementation & impl() const
return reference to the real implementation
Definition: gridview.hh:283
Traits ::IntersectionIterator IntersectionIterator
type of the intersection iterator
Definition: gridview.hh:87
Traits ::CollectiveCommunication CollectiveCommunication
type of the collective communication
Definition: gridview.hh:90
ViewTraits Traits
Traits class.
Definition: gridview.hh:75
IntersectionIterator ibegin(const typename Codim< 0 > ::Entity &entity) const
obtain begin intersection iterator with respect to this view
Definition: gridview.hh:234
Implementation & impl()
return reference to the real implementation
Definition: gridview.hh:281
int overlapSize(int codim) const
Return size of the overlap region for a given codim on the grid view.
Definition: gridview.hh:253
int size(const GeometryType &type) const
obtain number of entities with a given geometry type
Definition: gridview.hh:185
int size(int codim) const
obtain number of entities in a given codimension
Definition: gridview.hh:179
Traits ::IndexSet IndexSet
type of the index set
Definition: gridview.hh:81
Traits ::template Codim< cd >::template Partition< pit >::Iterator Iterator
iterator over a given codim and partition type
Definition: gridview.hh:115
Traits ::template Codim< cd >::Iterator Iterator
type of iterator returned by the grid view
Definition: gridview.hh:98
Codim< cd >::template Partition< pitype >::Iterator begin() const
obtain begin iterator for this view
Definition: gridview.hh:219
Codim< cd >::Iterator begin() const
obtain begin iterator for this view
Definition: gridview.hh:204
Codim< cd >::template Partition< pitype >::Iterator end() const
obtain end iterator for this view
Definition: gridview.hh:227
Traits ::template Codim< cd >::Geometry Geometry
type of the geometry implementation
Definition: gridview.hh:104
Traits ::template Codim< cd >::Entity Entity
type of corresponding entity
Definition: gridview.hh:101
ThisType & operator=(const ThisType &other)
assignment operator
Definition: gridview.hh:154
void communicate(CommDataHandleIF< DataHandleImp, DataType > &data, InterfaceType iftype, CommunicationDirection dir) const
Communicate data on this view.
Definition: gridview.hh:266
const Grid & grid() const
obtain a const reference to the underlying hierarchic grid
Definition: gridview.hh:162
GridView(const Implementation &imp)
constructor (engine concept)
Definition: gridview.hh:143
IntersectionIterator iend(const typename Codim< 0 > ::Entity &entity) const
obtain end intersection iterator with respect to this view
Definition: gridview.hh:241
Grid::ctype ctype
type used for coordinates in grid
Definition: gridview.hh:125
bool contains(const EntityType &e) const
Return true if the given entity is contained in this grid view.
Definition: gridview.hh:197
Traits ::template Codim< cd >::LocalGeometry LocalGeometry
type of the implementation for local geometries
Definition: gridview.hh:107
const CollectiveCommunication & comm() const
obtain collective communication object
Definition: gridview.hh:247
Traits ::Intersection Intersection
type of the intersection
Definition: gridview.hh:84
Traits ::Grid Grid
type of the grid
Definition: gridview.hh:78
const IndexSet & indexSet() const
obtain the index set
Definition: gridview.hh:173
GridView(const ThisType &other)
Copy constructor.
Definition: gridview.hh:149
Codim< cd >::Iterator end() const
obtain end iterator for this view
Definition: gridview.hh:211
int ghostSize(int codim) const
Return size of the ghost region for a given codim on the grid view.
Definition: gridview.hh:259
@ conforming
Export if this grid view is conforming.
Definition: gridview.hh:121
@ dimensionworld
The dimension of the world the grid lives in.
Definition: gridview.hh:132
@ dimension
The dimension of the grid.
Definition: gridview.hh:128
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:11
Static tag representing a codimension.
Definition: dimension.hh:22
Define types needed to iterate over entities of a given partition type.
Definition: gridview.hh:112
A struct that collects all associated types of one implementation from the Traits class.
Definition: gridview.hh:96
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.80.0 (May 7, 22:32, 2024)