dune-fem  2.8-git
femquadratures.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_FEMQUADRATURES_HH
2 #define DUNE_FEM_FEMQUADRATURES_HH
3 
4 #include <dune/geometry/type.hh>
5 
7 
8 // quadrature storage classes
9 #include "gausspoints.hh"
10 #include "pyramidpoints.hh"
12 
13 namespace Dune
14 {
15 
16  namespace Fem
17  {
18 
20  {
21  // uses implementation from parDG
22  enum { maxOrder1 = 39, maxOrder2 = 13, maxOrder3 = 12 };
23 
24  static int maxOrder( const int dim )
25  {
26  if( dim == 1 )
27  return maxOrder1 ;
28  else if( dim == 2 )
29  return maxOrder2 ;
30  else if( dim == 3 )
31  return maxOrder3 ;
32  else
33  {
34  DUNE_THROW(NotImplemented,"SimplexMaxOrder::maxOrder: wrong dimension");
35  return -1;
36  }
37  }
38 
39  };
40 
41  /* \class SimplexQuadrature
42  * \ingroup Quadrature
43  * \brief generic quadrature class for simplices
44  *
45  * SimplexQuadrature implements the geometry-specific part of the quadrature
46  * and initialises the vector quadrature points and weights.
47  *
48  * \note The UG quadrature rules are used here.
49  */
50  template< class FieldImp, int dim >
52  : public QuadratureImp< FieldImp, dim >
53  {
54  public:
55  typedef FieldImp FieldType;
56 
57  private:
60 
61  public:
64 
65  protected:
66  int order_;
67 
68  public:
75  SimplexQuadrature( const GeometryType& geometry, int order, size_t id );
76 
79  virtual GeometryType geometryType () const
80  {
81  return Dune::GeometryTypes::simplex(dim);
82  }
83 
86  virtual int order () const
87  {
88  return order_;
89  }
90 
92  static size_t maxOrder ()
93  {
94  if( dim == 1 )
96  if( dim == 2 )
98  if( dim == 3 )
100  DUNE_THROW( NotImplemented, "SimplexQuadratures from dim > 3 not implemented." );
101  }
102  };
103 
104 
105 
106  /* \class CubeQuadrature
107  * \ingroup Quadrature
108  * \brief generic quadrature class for cubes
109  *
110  * CubeQuadrature implements the geometry-specific part of the quadrature
111  * and initialises the vector quadrature points and weights.
112  *
113  * \note The quadrature uses the 1d gauss points (and their tensorial
114  * product) as quadrature points
115  */
116  template< class FieldImp, int dim >
118  : public QuadratureImp< FieldImp, dim >
119  {
120  public:
121  typedef FieldImp FieldType;
122 
123  private:
126 
127  public:
130 
131  protected:
132  int order_;
133 
134  public:
141  CubeQuadrature( const GeometryType &geometry, int order, size_t id );
142 
144  virtual GeometryType geometryType () const
145  {
146  return Dune::GeometryTypes::cube(dim);
147  }
148 
150  virtual int order () const
151  {
152  return order_;
153  }
154 
156  static size_t maxOrder ()
157  {
159  }
160  };
161 
162 
163 
164  /* \class PrismQuadrature
165  * \ingroup Quadrature
166  * \brief quadrature class for prisms
167  *
168  * PrismQuadrature implements the geometry-specific part of the quadrature
169  * and initialises the vector quadrature points and weights.
170  *
171  * \note The HD stuff is used here, but needs some rework since only one
172  * rule is provided.
173  */
174  template< class FieldImp >
176  : public QuadratureImp< FieldImp, 3 >
177  {
178  public:
179  typedef FieldImp FieldType;
180 
181  private:
184 
185  public:
188 
189  private:
190  int order_;
191 
192  public:
199  PrismQuadrature( const GeometryType &geometry, int order, size_t id );
200 
202  virtual GeometryType geometryType () const
203  {
204  return Dune::GeometryTypes::prism;
205  }
206 
208  virtual int order () const
209  {
210  return order_;
211  }
212 
214  static size_t maxOrder ()
215  {
217  }
218  };
219 
220 
221 
222  /* \class PyramidQuadrature
223  * \ingroup Quadrature
224  * \brief quadrature class for pyramids
225  *
226  * PyramidQuadrature implements the geometry-specific part of the quadrature
227  * and initialises the vector quadrature points and weights.
228  *
229  * \note The HD stuff is used here, but needs some rework since only one
230  * rule is provided.
231  */
232  template< class FieldImp >
234  : public QuadratureImp< FieldImp, 3 >
235  {
236  public:
237  typedef FieldImp FieldType;
238 
239  private:
242 
243  public:
246 
247  private:
248  int order_;
249 
250  public:
257  PyramidQuadrature( const GeometryType &geometry, int order, size_t id );
258 
260  virtual GeometryType geometryType () const
261  {
262  return Dune::GeometryTypes::pyramid;
263  }
264 
266  virtual int order () const
267  {
268  return order_;
269  }
270 
272  static size_t maxOrder ()
273  {
275  }
276  };
277 
278 
279  /* \class PolygonQuadrature
280  * \ingroup Quadrature
281  * \brief quadrature class for polygons
282  *
283  */
284  template< class FieldImp, int dim >
286  : public QuadratureImp< FieldImp, dim >
287  {
288  public:
289  typedef FieldImp FieldType;
290 
291  private:
294 
295  public:
298 
300 
301  private:
302  GeometryType geometryType_;
303  int order_;
304 
305  static const unsigned int topologyId = -1;
306 
307  protected:
308  using BaseType :: points_;
309  using BaseType :: weights_;
310 
311  public:
318  PolyhedronQuadrature( const GeometryType &geometry, int order, size_t id );
319 
321  virtual GeometryType geometryType () const
322  {
323  return geometryType_;
324  }
325 
327  virtual int order () const
328  {
329  return order_;
330  }
331 
333  static size_t maxOrder ()
334  {
335  return SimplexMaxOrder::maxOrder( dim );
336  }
337 
338  void reset( const int order, const int nop )
339  {
340  order_ = order;
341  points_.clear();
342  points_.reserve( nop );
343  weights_.clear();
344  weights_.reserve( nop );
345  }
346  };
347 
348 
349 
350  } // end namespace Fem
351 
352 } // end namespace Dune
353 
354 #include "femquadratures_inline.hh"
355 
356 #endif // #ifndef DUNE_FEM_FEMQUADRATURES_HH
Definition: bindguard.hh:11
Definition: femquadratures.hh:20
@ maxOrder1
Definition: femquadratures.hh:22
@ maxOrder2
Definition: femquadratures.hh:22
@ maxOrder3
Definition: femquadratures.hh:22
static int maxOrder(const int dim)
Definition: femquadratures.hh:24
Definition: femquadratures.hh:53
BaseType ::CoordinateType CoordinateType
type of local coordinates
Definition: femquadratures.hh:63
static size_t maxOrder()
maximal order of available quadratures
Definition: femquadratures.hh:92
int order_
Definition: femquadratures.hh:66
virtual int order() const
obtain order of the integration point list
Definition: femquadratures.hh:86
SimplexQuadrature(const GeometryType &geometry, int order, size_t id)
constructor filling the list of points and weights
Definition: femquadratures_inline.hh:16
virtual GeometryType geometryType() const
Definition: femquadratures.hh:79
FieldImp FieldType
Definition: femquadratures.hh:55
Definition: femquadratures.hh:119
FieldImp FieldType
Definition: femquadratures.hh:121
static size_t maxOrder()
maximal order of available quadratures
Definition: femquadratures.hh:156
virtual int order() const
obtain order of the integration point list
Definition: femquadratures.hh:150
CubeQuadrature(const GeometryType &geometry, int order, size_t id)
constructor filling the list of points and weights
Definition: femquadratures_inline.hh:33
int order_
Definition: femquadratures.hh:132
BaseType ::CoordinateType CoordinateType
type of local coordinates
Definition: femquadratures.hh:129
virtual GeometryType geometryType() const
Definition: femquadratures.hh:144
Definition: femquadratures.hh:177
BaseType ::CoordinateType CoordinateType
type of local coordinates
Definition: femquadratures.hh:187
virtual GeometryType geometryType() const
Definition: femquadratures.hh:202
FieldImp FieldType
Definition: femquadratures.hh:179
PrismQuadrature(const GeometryType &geometry, int order, size_t id)
constructor filling the list of points and weights
Definition: femquadratures_inline.hh:102
virtual int order() const
obtain order of the integration point list
Definition: femquadratures.hh:208
static size_t maxOrder()
maximal order of available quadratures
Definition: femquadratures.hh:214
Definition: femquadratures.hh:235
virtual int order() const
obtain order of the integration point list
Definition: femquadratures.hh:266
static size_t maxOrder()
maximal order of available quadratures
Definition: femquadratures.hh:272
FieldImp FieldType
Definition: femquadratures.hh:237
PyramidQuadrature(const GeometryType &geometry, int order, size_t id)
constructor filling the list of points and weights
Definition: femquadratures_inline.hh:145
BaseType ::CoordinateType CoordinateType
type of local coordinates
Definition: femquadratures.hh:245
virtual GeometryType geometryType() const
Definition: femquadratures.hh:260
Definition: femquadratures.hh:287
static size_t maxOrder()
maximal order of available quadratures
Definition: femquadratures.hh:333
virtual GeometryType geometryType() const
Definition: femquadratures.hh:321
void reset(const int order, const int nop)
Definition: femquadratures.hh:338
FieldImp FieldType
Definition: femquadratures.hh:289
virtual int order() const
obtain order of the integration point list
Definition: femquadratures.hh:327
PolyhedronQuadrature(const GeometryType &geometry, int order, size_t id)
constructor filling the list of points and weights
Definition: femquadratures_inline.hh:170
BaseType ::CoordinateType CoordinateType
type of local coordinates
Definition: femquadratures.hh:297
@ highestOrder
Definition: gausspoints.hh:32
@ highest_order
Definition: pyramidpoints.hh:21
std::vector< CoordinateType > points_
Definition: quadratureimp.hh:56
size_t nop() const
obtain the number of integration points
Definition: quadratureimp.hh:106
Generic implementation of a Dune quadrature.
Definition: quadratureimp.hh:196
void addQuadraturePoint(const CoordinateType &point, const FieldType weight)
Adds a point-weight pair to the quadrature.
Definition: quadratureimp.hh:270
std::vector< FieldType > weights_
Definition: quadratureimp.hh:211
BaseType ::CoordinateType CoordinateType
type of local coordinates
Definition: quadratureimp.hh:207