dune-functions  2.7.1
gridviewentityset.hh
Go to the documentation of this file.
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_FUNCTIONS_GRIDFUNCTIONS_GRIDVIEWENTITYSET_HH
4 #define DUNE_FUNCTIONS_GRIDFUNCTIONS_GRIDVIEWENTITYSET_HH
5 
6 #include <memory>
7 
8 
9 namespace Dune {
10 
11 namespace Functions {
12 
13 
21 template<class GV, int cd>
23 {
24 public:
25 
26  typedef GV GridView;
27  enum {
28  codim = cd
29  };
30 
32  typedef typename GridView::template Codim<codim>::Entity Element;
33 
35  typedef typename Element::Geometry::LocalCoordinate LocalCoordinate;
36  typedef typename Element::Geometry::GlobalCoordinate GlobalCoordinate;
37 
39 
41  typedef typename GridView::template Codim<codim>::Iterator const_iterator;
42 
45 
51  gv_(gv)
52  {}
53 
55  bool contains(const Element& e) const
56  {
57  return gv_.contains(e);
58  }
59 
61  size_t size() const
62  {
63  return gv_.size(codim);
64  }
65 
68  {
69  return gv_.template begin<codim>();
70  }
71 
74  {
75  return gv_.template end<codim>();
76  }
77 
78  const GridView& gridView() const
79  {
80  return gv_;
81  }
82 
83 private:
84  GridView gv_;
85 };
86 
87 
88 } // end of namespace Dune::Functions
89 } // end of namespace Dune
90 
91 #endif // DUNE_FUNCTIONS_GRIDFUNCTIONS_GRIDVIEWENTITYSET_HH
Definition: polynomial.hh:10
An entity set for all entities of given codim in a grid view.
Definition: gridviewentityset.hh:23
GridViewEntitySet(const GridView &gv)
Construct GridViewEntitySet for a GridView.
Definition: gridviewentityset.hh:50
GV GridView
Definition: gridviewentityset.hh:26
GridView::template Codim< codim >::Entity Element
Type of Elements contained in this EntitySet.
Definition: gridviewentityset.hh:32
const_iterator end() const
Create an end iterator.
Definition: gridviewentityset.hh:73
Element value_type
Definition: gridviewentityset.hh:38
const_iterator begin() const
Create a begin iterator.
Definition: gridviewentityset.hh:67
GridView::template Codim< codim >::Iterator const_iterator
A forward iterator.
Definition: gridviewentityset.hh:41
Element::Geometry::LocalCoordinate LocalCoordinate
Type of local coordinates with respect to the Element.
Definition: gridviewentityset.hh:35
size_t size() const
Number of Elements visited by an iterator.
Definition: gridviewentityset.hh:61
@ codim
Definition: gridviewentityset.hh:28
Element::Geometry::GlobalCoordinate GlobalCoordinate
Definition: gridviewentityset.hh:36
const GridView & gridView() const
Definition: gridviewentityset.hh:78
bool contains(const Element &e) const
Returns true if e is contained in the EntitySet.
Definition: gridviewentityset.hh:55
const_iterator iterator
Same as const_iterator.
Definition: gridviewentityset.hh:44