Dune Core Modules (2.6.0)

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  public:
69  typedef typename ViewTraits :: GridViewImp Implementation;
70 
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> :: Entity Entity;
101 
103  typedef typename Traits :: template Codim<cd> :: Geometry Geometry;
104 
106  typedef typename Traits :: template Codim<cd> :: LocalGeometry LocalGeometry;
107 
109  template< PartitionIteratorType pit >
110  struct Partition
111  {
113  typedef typename Traits :: template Codim< cd >
115  };
116  }; //: public Traits :: template Codim<cd> {};
117 
118  enum {
120  conforming = Traits :: conforming
121  };
122 
124  typedef typename Grid::ctype ctype;
125 
126  enum {
128  };
129 
130  enum {
132  };
133 
134  public:
135 
136  //===========================================================
140  //===========================================================
142  GridView ( const Implementation &imp )
143  : impl_( imp )
144  {}
146 
148  GridView ( const ThisType &other )
149  : impl_( other.impl_ )
150  {}
151 
153  ThisType &operator= ( const ThisType &other )
154  {
155  impl_ = other.impl_;
156  return *this;
157  }
158 
159  public:
161  const Grid &grid () const
162  {
163  return impl().grid();
164  }
165 
172  const IndexSet &indexSet () const
173  {
174  return impl().indexSet();
175  }
176 
178  int size ( int codim ) const
179  {
180  return impl().size( codim );
181  }
182 
184  int size ( const GeometryType &type ) const
185  {
186  return impl().size( type );
187  }
188 
195  template<class EntityType>
196  bool contains (const EntityType& e) const
197  {
198  return impl().indexSet().contains(e);
199  }
200 
202  template< int cd >
203  typename Codim< cd > :: Iterator begin () const
204  {
205  return impl().template begin<cd>();
206  }
207 
209  template< int cd >
210  typename Codim< cd > :: Iterator end () const
211  {
212  return impl().template end<cd>();
213  }
214 
216  template< int cd , PartitionIteratorType pitype >
217  typename Codim< cd > :: template Partition< pitype > :: Iterator
218  begin () const
219  {
220  return impl().template begin<cd,pitype>();
221  }
222 
224  template< int cd, PartitionIteratorType pitype >
225  typename Codim< cd > :: template Partition< pitype > :: Iterator
226  end () const
227  {
228  return impl().template end<cd,pitype>();
229  }
230 
233  ibegin ( const typename Codim< 0 > :: Entity &entity ) const
234  {
235  return impl().ibegin(entity);
236  }
237 
240  iend ( const typename Codim< 0 > :: Entity &entity ) const
241  {
242  return impl().iend(entity);
243  }
244 
247  {
248  return impl().comm();
249  }
250 
252  int overlapSize(int codim) const
253  {
254  return impl().overlapSize(codim);
255  }
256 
258  int ghostSize(int codim) const
259  {
260  return impl().ghostSize(codim);
261  }
262 
264  template< class DataHandleImp, class DataType >
266  InterfaceType iftype,
267  CommunicationDirection dir ) const
268  {
269  impl().communicate(data,iftype,dir);
270  }
271 
277  Implementation &impl () { return impl_; }
278 
284  const Implementation &impl () const { return impl_; }
285 
286  protected:
287  Implementation impl_;
288  };
289 
290 } // namespace Dune
291 
292 #endif // #ifndef DUNE_GRIDVIEW_HH
CommDataHandleIF describes the features of a data handle for communication in parallel runs using the...
Definition: datahandleif.hh:76
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:277
Grid view abstract base class.
Definition: gridview.hh:60
@ 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
access to the underlying implementation
Definition: gridview.hh:284
Traits ::IntersectionIterator IntersectionIterator
type of the intersection iterator
Definition: gridview.hh:86
Traits ::CollectiveCommunication CollectiveCommunication
type of the collective communication
Definition: gridview.hh:89
ViewTraits Traits
Traits class.
Definition: gridview.hh:74
IntersectionIterator ibegin(const typename Codim< 0 > ::Entity &entity) const
obtain begin intersection iterator with respect to this view
Definition: gridview.hh:233
Implementation & impl()
access to the underlying implementation
Definition: gridview.hh:277
int overlapSize(int codim) const
Return size of the overlap region for a given codim on the grid view.
Definition: gridview.hh:252
int size(const GeometryType &type) const
obtain number of entities with a given geometry type
Definition: gridview.hh:184
int size(int codim) const
obtain number of entities in a given codimension
Definition: gridview.hh:178
Traits ::IndexSet IndexSet
type of the index set
Definition: gridview.hh:80
Traits ::template Codim< cd >::template Partition< pit >::Iterator Iterator
iterator over a given codim and partition type
Definition: gridview.hh:114
ViewTraits ::GridViewImp Implementation
type of underlying implementation
Definition: gridview.hh:69
Traits ::template Codim< cd >::Iterator Iterator
type of iterator returned by the grid view
Definition: gridview.hh:97
Codim< cd >::template Partition< pitype >::Iterator begin() const
obtain begin iterator for this view
Definition: gridview.hh:218
Codim< cd >::Iterator begin() const
obtain begin iterator for this view
Definition: gridview.hh:203
Codim< cd >::template Partition< pitype >::Iterator end() const
obtain end iterator for this view
Definition: gridview.hh:226
Traits ::template Codim< cd >::Geometry Geometry
type of the geometry implementation
Definition: gridview.hh:103
Traits ::template Codim< cd >::Entity Entity
type of corresponding entity
Definition: gridview.hh:100
ThisType & operator=(const ThisType &other)
assignment operator
Definition: gridview.hh:153
void communicate(CommDataHandleIF< DataHandleImp, DataType > &data, InterfaceType iftype, CommunicationDirection dir) const
Communicate data on this view.
Definition: gridview.hh:265
const Grid & grid() const
obtain a const reference to the underlying hierarchic grid
Definition: gridview.hh:161
GridView(const Implementation &imp)
constructor (engine concept)
Definition: gridview.hh:142
IntersectionIterator iend(const typename Codim< 0 > ::Entity &entity) const
obtain end intersection iterator with respect to this view
Definition: gridview.hh:240
Grid::ctype ctype
type used for coordinates in grid
Definition: gridview.hh:124
bool contains(const EntityType &e) const
Return true if the given entity is contained in this grid view.
Definition: gridview.hh:196
Traits ::template Codim< cd >::LocalGeometry LocalGeometry
type of the implementation for local geometries
Definition: gridview.hh:106
const CollectiveCommunication & comm() const
obtain collective communication object
Definition: gridview.hh:246
Traits ::Intersection Intersection
type of the intersection
Definition: gridview.hh:83
Traits ::Grid Grid
type of the grid
Definition: gridview.hh:77
const IndexSet & indexSet() const
obtain the index set
Definition: gridview.hh:172
GridView(const ThisType &other)
Copy constructor.
Definition: gridview.hh:148
Codim< cd >::Iterator end() const
obtain end iterator for this view
Definition: gridview.hh:210
int ghostSize(int codim) const
Return size of the ghost region for a given codim on the grid view.
Definition: gridview.hh:258
@ conforming
Export if this grid view is conforming.
Definition: gridview.hh:120
@ dimensionworld
The dimension of the world the grid lives in.
Definition: gridview.hh:131
@ dimension
The dimension of the grid.
Definition: gridview.hh:127
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: alignedallocator.hh:10
Static tag representing a codimension.
Definition: dimension.hh:22
Define types needed to iterate over entities of a given partition type.
Definition: gridview.hh:111
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.80.0 (May 1, 22:29, 2024)