dune-pdelab  2.5-dev
quadraturerules.hh
Go to the documentation of this file.
1 #ifndef DUNE_PDELAB_COMMON_QUADRATURERULES_HH
2 #define DUNE_PDELAB_COMMON_QUADRATURERULES_HH
3 
4 #include <dune/geometry/quadraturerules.hh>
5 
6 namespace Dune {
7  namespace PDELab {
8 
10 
25  template<typename QR>
27  {
28 
29  public:
30 
32  using CoordType = typename QR::CoordType;
33 
35  using size_type = typename QR::size_type;
36 
38  using const_iterator = typename QR::const_iterator;
39 
42 
44  int order() const
45  {
46  return _quadrature_rule->order();
47  }
48 
50  GeometryType type() const
51  {
52  return _quadrature_rule->type();
53  }
54 
56  size_type size() const
57  {
58  return _quadrature_rule->size();
59  }
60 
63  {
64  return _quadrature_rule->begin();
65  }
66 
69  {
70  return _quadrature_rule->end();
71  }
72 
73 #ifndef DOXYGEN
74 
75  QuadratureRuleWrapper(const QR& quadrature_rule)
76  : _quadrature_rule(&quadrature_rule)
77  {}
78 
79 #endif
80 
81  private:
82 
83  const QR* _quadrature_rule;
84 
85  };
86 
88 
110  template<typename Geometry>
112  QuadratureRule<
113  typename Geometry::ctype,
114  Geometry::mydimension
115  >
116  >
117  quadratureRule(const Geometry& geo, std::size_t order, QuadratureType::Enum quadrature_type = QuadratureType::GaussLegendre)
118  {
119  return { QuadratureRules<typename Geometry::ctype,Geometry::mydimension>::rule(geo.type(),order,quadrature_type) };
120  }
121 
122  } // namespace PDELab
123 
124  // inject the function into the Dune namespace to enable ADL.
125  // TODO: Remove this injection once the core modules gain their own version of this function!
127 
128 } // namespace Dune
129 
130 #endif // DUNE_PDELAB_COMMON_QUADRATURERULES_HH
typename QR::CoordType CoordType
The coordinate type of the local coordinates of the rule.
Definition: quadraturerules.hh:32
const_iterator begin() const
Returns an iterator pointing to the first quadrature point.
Definition: quadraturerules.hh:62
size_type size() const
Returns the number of quadrature points.
Definition: quadraturerules.hh:56
typename QR::const_iterator const_iterator
A const iterator over the quadrature points.
Definition: quadraturerules.hh:38
const_iterator end() const
Returns an iterator pointing after the last quadrature point.
Definition: quadraturerules.hh:68
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
Wrapper for Dune::QuadratureRule with value semantics.
Definition: quadraturerules.hh:26
const_iterator iterator
An iterator over the quadrature points (always const, as the container is read-only).
Definition: quadraturerules.hh:41
int order() const
Returns the maximum polynomial order up to which this rule is exact.
Definition: quadraturerules.hh:44
GeometryType type() const
Returns the geometry type that this rule is valid for.
Definition: quadraturerules.hh:50
typename QR::size_type size_type
The size type used by the container.
Definition: quadraturerules.hh:35
QuadratureRuleWrapper< QuadratureRule< typename Geometry::ctype, Geometry::mydimension > > quadratureRule(const Geometry &geo, std::size_t order, QuadratureType::Enum quadrature_type=QuadratureType::GaussLegendre)
Returns a quadrature rule for the given geometry.
Definition: quadraturerules.hh:117