dune-pdelab  2.5-dev
referenceelements.hh
Go to the documentation of this file.
1 #ifndef DUNE_PDELAB_COMMON_REFERENCEELEMENTS_HH
2 #define DUNE_PDELAB_COMMON_REFERENCEELEMENTS_HH
3 
4 #include <dune/geometry/quadraturerules.hh>
5 #include <dune/geometry/referenceelements.hh>
6 
7 namespace Dune {
8  namespace PDELab {
9 
11 
33  template<typename RE>
35  {
36 
37  public:
38 
39  template<int codim>
40  using Codim = typename RE::template Codim<codim>;
41 
43  using ctype = typename Codim<0>::Geometry::ctype;
46 
48  static const std::size_t dimension = Codim<0>::Geometry::coorddimension;
49 
51  using Coordinate = FieldVector<CoordinateField,dimension>;
52 
53  int size(int c) const
54  {
55  return _ref_el->size(c);
56  }
57 
58  int size(int i, int c, int cc) const
59  {
60  return _ref_el->size(i,c,cc);
61  }
62 
63  int subEntity(int i, int c, int ii, int cc) const
64  {
65  return _ref_el->subEntity(i,c,ii,cc);
66  }
67 
68  GeometryType type(int i, int c) const
69  {
70  return _ref_el->type(i,c);
71  }
72 
73  GeometryType type() const
74  {
75  return _ref_el->type();
76  }
77 
78  const Coordinate& position(int i, int c) const
79  {
80  return _ref_el->position(i,c);
81  }
82 
83  bool checkInside(const Coordinate& local) const
84  {
85  return _ref_el->checkInside(local);
86  }
87 
88  template<int codim>
89  typename Codim<codim>::Geometry geometry(int i) const
90  {
91  return _ref_el->geometry(i);
92  }
93 
95  {
96  return _ref_el->volume();
97  }
98 
99  const Coordinate& integrationOuterNormal(int face) const
100  {
101  return _ref_el->integrationOuterNormal(face);
102  }
103 
104 #ifndef DOXYGEN
105 
106  ReferenceElementWrapper(const RE& ref_el)
107  : _ref_el(&ref_el)
108  {}
109 
110 #endif // DOXYGEN
111 
112  private:
113 
114  const RE* _ref_el;
115 
116  };
117 
118 
120 
137  template<typename Geometry>
139  ReferenceElement<
140  typename Geometry::ctype,
141  Geometry::mydimension
142  >
143  >
144  referenceElement(const Geometry& geo)
145  {
146  return { ReferenceElements<typename Geometry::ctype,Geometry::mydimension>::general(geo.type()) };
147  }
148 
149  } // namespace PDELab
150 
151  // inject the function into the Dune namespace to enable ADL.
152  // TODO: Remove this injection once the core modules gain their own version of this function!
154 
155 } // namespace Dune
156 
157 #endif // DUNE_PDELAB_COMMON_REFERENCEELEMENTS_HH
const Coordinate & position(int i, int c) const
Definition: referenceelements.hh:78
CoordinateField volume() const
Definition: referenceelements.hh:94
bool checkInside(const Coordinate &local) const
Definition: referenceelements.hh:83
typename Codim< 0 >::Geometry::ctype ctype
The coordinate field type.
Definition: referenceelements.hh:43
const Coordinate & integrationOuterNormal(int face) const
Definition: referenceelements.hh:99
int size(int i, int c, int cc) const
Definition: referenceelements.hh:58
int size(int c) const
Definition: referenceelements.hh:53
static const std::size_t dimension
The dimension of the reference element.
Definition: referenceelements.hh:48
ctype CoordinateField
The coordinate field type.
Definition: referenceelements.hh:45
Codim< codim >::Geometry geometry(int i) const
Definition: referenceelements.hh:89
GeometryType type(int i, int c) const
Definition: referenceelements.hh:68
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
GeometryType type() const
Definition: referenceelements.hh:73
Wrapper for Dune::ReferenceElement with value semantics.
Definition: referenceelements.hh:34
typename RE::template Codim< codim > Codim
Definition: referenceelements.hh:40
ReferenceElementWrapper< ReferenceElement< typename Geometry::ctype, Geometry::mydimension > > referenceElement(const Geometry &geo)
Returns the reference element for the given geometry.
Definition: referenceelements.hh:144
FieldVector< CoordinateField, dimension > Coordinate
The coordinate type of the reference element.
Definition: referenceelements.hh:51
int subEntity(int i, int c, int ii, int cc) const
Definition: referenceelements.hh:63