Dune Core Modules (2.3.1)

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/geometry/type.hh>
7 
9 #include <dune/grid/common/gridenums.hh>
10 
11 namespace Dune
12 {
13 
14  template< int, int, class, class >
15  class GridDefaultImplementation;
16 
17 
18 
55  template< class ViewTraits >
56  class GridView
57  {
59 
60  public:
61  typedef typename ViewTraits :: GridViewImp GridViewImp;
62 
64  typedef ViewTraits Traits;
65 
67  typedef typename Traits :: Grid Grid;
68 
70  typedef typename Traits :: IndexSet IndexSet;
71 
73  typedef typename Traits :: Intersection Intersection;
74 
76  typedef typename Traits :: IntersectionIterator IntersectionIterator;
77 
79  typedef typename Traits :: CollectiveCommunication CollectiveCommunication;
80 
84  template< int cd >
85  struct Codim {
87  typedef typename Traits :: template Codim<cd> :: Iterator Iterator;
88 
90  typedef typename Traits :: template Codim<cd> :: EntityPointer EntityPointer;
91 
93  typedef typename Traits :: template Codim<cd> :: Entity Entity;
94 
96  typedef typename Traits :: template Codim<cd> :: Geometry Geometry;
97 
99  typedef typename Traits :: template Codim<cd> :: LocalGeometry LocalGeometry;
100 
102  template< PartitionIteratorType pit >
103  struct Partition
104  {
106  typedef typename Traits :: template Codim< cd >
108  };
109  }; //: public Traits :: template Codim<cd> {};
110 
111  enum {
113  conforming = Traits :: conforming
114  };
115 
117  typedef typename Grid::ctype ctype;
118 
119  enum {
121  };
122 
123  enum {
125  };
126 
127  public:
129  GridView ( const GridViewImp &imp )
130  : impl_( imp )
131  {}
132 
134  GridView ( const ThisType &other )
135  : impl_( other.impl_ )
136  {}
137 
139  ThisType &operator= ( const ThisType &other )
140  {
141  impl_ = other.impl_;
142  return *this;
143  }
144 
145  public:
147  const Grid &grid () const
148  {
149  return impl().grid();
150  }
151 
158  const IndexSet &indexSet () const
159  {
160  return impl().indexSet();
161  }
162 
164  int size ( int codim ) const
165  {
166  return impl().size( codim );
167  }
168 
170  int size ( const GeometryType &type ) const
171  {
172  return impl().size( type );
173  }
174 
181  template<class EntityType>
182  bool contains (const EntityType& e) const
183  {
184  return impl().indexSet().contains(e);
185  }
186 
188  template< int cd >
189  typename Codim< cd > :: Iterator begin () const
190  {
191  return impl().template begin<cd>();
192  }
193 
195  template< int cd >
196  typename Codim< cd > :: Iterator end () const
197  {
198  return impl().template end<cd>();
199  }
200 
202  template< int cd , PartitionIteratorType pitype >
203  typename Codim< cd > :: template Partition< pitype > :: Iterator
204  begin () const
205  {
206  return impl().template begin<cd,pitype>();
207  }
208 
210  template< int cd, PartitionIteratorType pitype >
211  typename Codim< cd > :: template Partition< pitype > :: Iterator
212  end () const
213  {
214  return impl().template end<cd,pitype>();
215  }
216 
219  ibegin ( const typename Codim< 0 > :: Entity &entity ) const
220  {
221  return impl().ibegin(entity);
222  }
223 
226  iend ( const typename Codim< 0 > :: Entity &entity ) const
227  {
228  return impl().iend(entity);
229  }
230 
233  {
234  return impl().comm();
235  }
236 
238  int overlapSize(int codim) const
239  {
240  return impl().overlapSize(codim);
241  }
242 
244  int ghostSize(int codim) const
245  {
246  return impl().ghostSize(codim);
247  }
248 
250  template< class DataHandleImp, class DataType >
252  InterfaceType iftype,
253  CommunicationDirection dir ) const
254  {
255  impl().communicate(data,iftype,dir);
256  }
257 
258 #if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
259  public:
260 #else
261  protected:
262  // give the GridDefaultImplementation class access to the realImp
263  friend class GridDefaultImplementation< Grid::dimension, Grid::dimensionworld, typename Grid::ctype, typename Grid::GridFamily >;
264 #endif
265  // type of underlying implementation, for internal use only
266  typedef GridViewImp Implementation;
267 
269  Implementation &impl () { return impl_; }
271  const Implementation &impl () const { return impl_; }
272 
273  protected:
274  Implementation impl_;
275 
280  GridViewImp& asImp ()
281  DUNE_DEPRECATED_MSG("Use impl() instead.")
282  {
283  return impl_;
284  }
285 
290  const GridViewImp& asImp () const
291  DUNE_DEPRECATED_MSG("Use impl() instead.")
292  {
293  return impl_;
294  }
295  };
296 
297 } // namespace Dune
298 
299 #endif // #ifndef DUNE_GRIDVIEW_HH
CommDataHandleIF describes the features of a data handle for communication in parallel runs using the...
Definition: datahandleif.hh:75
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:25
Definition: grid.hh:1017
Grid view abstract base class.
Definition: gridview.hh:57
const Implementation & impl() const
return reference to the real implementation
Definition: gridview.hh:271
Traits ::IntersectionIterator IntersectionIterator
type of the intersection iterator
Definition: gridview.hh:76
GridViewImp & asImp()
Definition: gridview.hh:280
Traits ::CollectiveCommunication CollectiveCommunication
type of the collective communication
Definition: gridview.hh:79
@ conforming
Export if this grid view is conforming *‍/.
Definition: gridview.hh:113
ViewTraits Traits
Traits class.
Definition: gridview.hh:64
IntersectionIterator ibegin(const typename Codim< 0 > ::Entity &entity) const
obtain begin intersection iterator with respect to this view
Definition: gridview.hh:219
Implementation & impl()
return reference to the real implementation
Definition: gridview.hh:269
int overlapSize(int codim) const
Return size of the overlap region for a given codim on the grid view.
Definition: gridview.hh:238
int size(const GeometryType &type) const
obtain number of entities with a given geometry type
Definition: gridview.hh:170
int size(int codim) const
obtain number of entities in a given codimension
Definition: gridview.hh:164
Traits ::IndexSet IndexSet
type of the index set
Definition: gridview.hh:70
GridView(const GridViewImp &imp)
constructor (engine concept)
Definition: gridview.hh:129
@ dimensionworld
The dimension of the world the grid lives in.
Definition: gridview.hh:124
Codim< cd >::template Partition< pitype >::Iterator begin() const
obtain begin iterator for this view
Definition: gridview.hh:204
Codim< cd >::Iterator begin() const
obtain begin iterator for this view
Definition: gridview.hh:189
Codim< cd >::template Partition< pitype >::Iterator end() const
obtain end iterator for this view
Definition: gridview.hh:212
ThisType & operator=(const ThisType &other)
assignment operator
Definition: gridview.hh:139
void communicate(CommDataHandleIF< DataHandleImp, DataType > &data, InterfaceType iftype, CommunicationDirection dir) const
Definition: gridview.hh:251
const Grid & grid() const
obtain a const reference to the underlying hierarchic grid
Definition: gridview.hh:147
const GridViewImp & asImp() const
Definition: gridview.hh:290
IntersectionIterator iend(const typename Codim< 0 > ::Entity &entity) const
obtain end intersection iterator with respect to this view
Definition: gridview.hh:226
Grid::ctype ctype
type used for coordinates in grid
Definition: gridview.hh:117
bool contains(const EntityType &e) const
Return true if the given entity is contained in this grid view.
Definition: gridview.hh:182
const CollectiveCommunication & comm() const
obtain collective communication object
Definition: gridview.hh:232
Traits ::Intersection Intersection
type of the intersection
Definition: gridview.hh:73
@ dimension
The dimension of the grid.
Definition: gridview.hh:120
Traits ::Grid Grid
type of the grid
Definition: gridview.hh:67
const IndexSet & indexSet() const
obtain the index set
Definition: gridview.hh:158
GridView(const ThisType &other)
Copy constructor.
Definition: gridview.hh:134
Codim< cd >::Iterator end() const
obtain end iterator for this view
Definition: gridview.hh:196
int ghostSize(int codim) const
Return size of the ghost region for a given codim on the grid view.
Definition: gridview.hh:244
Grid abstract base class.
Definition: grid.hh:386
@ dimension
The dimension of the grid.
Definition: grid.hh:400
@ dimensionworld
The dimension of the world the grid lives in.
Definition: grid.hh:406
ct ctype
Define type used for coordinates in grid module.
Definition: grid.hh:546
Mesh entities of codimension 0 ("elements") allow to visit all intersections with "neighboring" eleme...
Definition: intersectioniterator.hh:83
Describes the parallel communication interface class for MessageBuffers and DataHandles.
Dune namespace.
Definition: alignment.hh:14
struct DUNE_DEPRECATED_MSG("Use class StaticPower from file power.hh instead") Power_m_p
Calculates m^p at compile time.
Definition: misc.hh:54
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:164
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:80
Define types needed to iterate over entities of a given partition type.
Definition: gridview.hh:104
Traits ::template Codim< cd >::template Partition< pit >::Iterator Iterator
iterator over a given codim and partition type
Definition: gridview.hh:107
A struct that collects all associated types of one implementation from the Traits class.
Definition: gridview.hh:85
Traits ::template Codim< cd >::Iterator Iterator
type of iterator returned by the grid view
Definition: gridview.hh:87
Traits ::template Codim< cd >::EntityPointer EntityPointer
type of corresponding entity pointer
Definition: gridview.hh:90
Traits ::template Codim< cd >::Geometry Geometry
type of the geometry implementation
Definition: gridview.hh:96
Traits ::template Codim< cd >::Entity Entity
type of corresponding entity
Definition: gridview.hh:93
Traits ::template Codim< cd >::LocalGeometry LocalGeometry
type of the implementation for local geometries
Definition: gridview.hh:99
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 16, 22:29, 2024)