DUNE-FEM (unstable)

femquadratures.hh
1#ifndef DUNE_FEM_FEMQUADRATURES_HH
2#define DUNE_FEM_FEMQUADRATURES_HH
3
5
6#include <dune/fem/quadrature/quadratureimp.hh>
7
8// quadrature storage classes
9#include "gausspoints.hh"
10#include "pyramidpoints.hh"
11#include "pardgsimplexquadrature.hh"
12
13namespace Dune
14{
15
16 namespace Fem
17 {
18
19 struct SimplexMaxOrder
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 >
51 class SimplexQuadrature
52 : public QuadratureImp< FieldImp, dim >
53 {
54 public:
55 typedef FieldImp FieldType;
56
57 private:
58 typedef SimplexQuadrature< FieldType, dim > ThisType;
59 typedef QuadratureImp< FieldType, dim > BaseType;
60
61 public:
63 typedef typename BaseType :: CoordinateType CoordinateType;
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 {
82 }
83
86 virtual int order () const
87 {
88 return order_;
89 }
90
92 static size_t maxOrder ()
93 {
94 if( dim == 1 )
95 return SimplexMaxOrder::maxOrder1;
96 if( dim == 2 )
97 return SimplexMaxOrder::maxOrder2;
98 if( dim == 3 )
99 return SimplexMaxOrder::maxOrder3;
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 >
117 class CubeQuadratureBase
118 : public QuadratureImp< FieldImp, dim >
119 {
120 public:
121 typedef FieldImp FieldType;
122
123 private:
124 typedef CubeQuadratureBase< FieldType, dim > ThisType;
125 typedef QuadratureImp< FieldType, dim > BaseType;
126
127 public:
129 typedef typename BaseType :: CoordinateType CoordinateType;
130
131 protected:
132 int order_;
133
134 public:
142 template <class QuadPoints>
143 CubeQuadratureBase( const GeometryType &geometry,
144 int order, size_t id,
145 const QuadPoints& pts );
146
148 virtual GeometryType geometryType () const
149 {
150 return Dune::GeometryTypes::cube(dim);
151 }
152
154 virtual int order () const
155 {
156 return order_;
157 }
158
160 static size_t maxOrder ()
161 {
163 }
164 };
165
166 /* \class CubeQuadrature
167 * \ingroup Quadrature
168 * \brief generic quadrature class for cubes
169 *
170 * CubeQuadrature implements the geometry-specific part of the quadrature
171 * and initialises the vector quadrature points and weights.
172 *
173 * \note The quadrature uses the 1d gauss points (and their tensorial
174 * product) as quadrature points
175 */
176 template< class FieldImp, int dim >
177 class CubeQuadrature : public CubeQuadratureBase< FieldImp, dim >
178 {
179 public:
180 typedef FieldImp FieldType;
181
182 private:
183 typedef CubeQuadrature< FieldType, dim > ThisType;
184 typedef CubeQuadratureBase< FieldType, dim > BaseType;
185
186 public:
188 typedef typename BaseType :: CoordinateType CoordinateType;
189
190 public:
197 CubeQuadrature( const GeometryType &geometry, int order, size_t id )
198 : BaseType( geometry, order, id, GaussPts() )
199 {}
200 };
201
202
203 /* \class ModifiedNewtonCotesQuadrature
204 * \ingroup Quadrature
205 * \brief A quadrature with equidistant points where the first and last interval
206 * is only h/2 instead of h in the original Newton-Cotes rule.
207 * This allows to compute integrals of DG functions on quadrature
208 * points that correspond to a finite volume submesh.
209 *
210 * ModifiedNewtonCotesQuadrature implements the geometry-specific part of the quadrature
211 * and initialises the vector quadrature points and weights.
212 *
213 * \note The quadrature uses the 1d equidistant points (and their tensorial
214 * product) as quadrature points
215 */
216 template< class FieldImp, int dim >
217 class ModifiedNewtonCotesQuadrature : public CubeQuadratureBase< FieldImp, dim >
218 {
219 public:
220 typedef FieldImp FieldType;
221
222 private:
223 typedef ModifiedNewtonCotesQuadrature< FieldType, dim > ThisType;
224 typedef CubeQuadratureBase< FieldType, dim > BaseType;
225
226 public:
228 typedef typename BaseType :: CoordinateType CoordinateType;
229
230 public:
237 ModifiedNewtonCotesQuadrature( const GeometryType &geometry, int order, size_t id )
238 : BaseType( geometry, order, id, ModifiedNewtonCotes() )
239 {}
240 };
241
242
243
244 /* \class PrismQuadrature
245 * \ingroup Quadrature
246 * \brief quadrature class for prisms
247 *
248 * PrismQuadrature implements the geometry-specific part of the quadrature
249 * and initialises the vector quadrature points and weights.
250 *
251 * \note The HD stuff is used here, but needs some rework since only one
252 * rule is provided.
253 */
254 template< class FieldImp >
255 class PrismQuadrature
256 : public QuadratureImp< FieldImp, 3 >
257 {
258 public:
259 typedef FieldImp FieldType;
260
261 private:
262 typedef PrismQuadrature< FieldType > ThisType;
263 typedef QuadratureImp< FieldType, 3 > BaseType;
264
265 public:
267 typedef typename BaseType :: CoordinateType CoordinateType;
268
269 private:
270 int order_;
271
272 public:
279 PrismQuadrature( const GeometryType &geometry, int order, size_t id );
280
282 virtual GeometryType geometryType () const
283 {
285 }
286
288 virtual int order () const
289 {
290 return order_;
291 }
292
294 static size_t maxOrder ()
295 {
296 return SimplexMaxOrder::maxOrder2;
297 }
298 };
299
300
301
302 /* \class PyramidQuadrature
303 * \ingroup Quadrature
304 * \brief quadrature class for pyramids
305 *
306 * PyramidQuadrature implements the geometry-specific part of the quadrature
307 * and initialises the vector quadrature points and weights.
308 *
309 * \note The HD stuff is used here, but needs some rework since only one
310 * rule is provided.
311 */
312 template< class FieldImp >
313 class PyramidQuadrature
314 : public QuadratureImp< FieldImp, 3 >
315 {
316 public:
317 typedef FieldImp FieldType;
318
319 private:
320 typedef PyramidQuadrature< FieldType > ThisType;
321 typedef QuadratureImp< FieldType, 3 > BaseType;
322
323 public:
325 typedef typename BaseType :: CoordinateType CoordinateType;
326
327 private:
328 int order_;
329
330 public:
337 PyramidQuadrature( const GeometryType &geometry, int order, size_t id );
338
340 virtual GeometryType geometryType () const
341 {
343 }
344
346 virtual int order () const
347 {
348 return order_;
349 }
350
352 static size_t maxOrder ()
353 {
354 return PyramidPoints :: highest_order;
355 }
356 };
357
358
359 /* \class PolygonQuadrature
360 * \ingroup Quadrature
361 * \brief quadrature class for polygons
362 *
363 */
364 template< class FieldImp, int dim >
365 class PolyhedronQuadrature
366 : public QuadratureImp< FieldImp, dim >
367 {
368 public:
369 typedef FieldImp FieldType;
370
371 private:
372 typedef PolyhedronQuadrature< FieldType, dim > ThisType;
373 typedef QuadratureImp< FieldType, dim > BaseType;
374
375 public:
377 typedef typename BaseType :: CoordinateType CoordinateType;
378
380
381 private:
382 GeometryType geometryType_;
383 int order_;
384
385 static const unsigned int topologyId = -1;
386
387 protected:
388 using BaseType :: points_;
389 using BaseType :: weights_;
390
391 public:
398 PolyhedronQuadrature( const GeometryType &geometry, int order, size_t id );
399
401 virtual GeometryType geometryType () const
402 {
403 return geometryType_;
404 }
405
407 virtual int order () const
408 {
409 return order_;
410 }
411
413 static size_t maxOrder ()
414 {
415 return SimplexMaxOrder::maxOrder( dim );
416 }
417
418 void reset( const int order, const int nop )
419 {
420 order_ = order;
421 points_.clear();
422 points_.reserve( nop );
423 weights_.clear();
424 weights_.reserve( nop );
425 }
426 };
427
428
429
430 } // end namespace Fem
431
432} // end namespace Dune
433
434#include "femquadratures_inline.hh"
435
436#endif // #ifndef DUNE_FEM_FEMQUADRATURES_HH
static const int highestOrder
highest quadrature order within the array
Definition: gausspoints.hh:114
void addQuadraturePoint(const CoordinateType &point, const FieldType weight)
Adds a point-weight pair to the quadrature.
Definition: quadratureimp.hh:270
BaseType::CoordinateType CoordinateType
type of local coordinates
Definition: quadratureimp.hh:207
GeometryType geometryType(const Dune::GeometryType &t)
mapping from GeometryType to VTKGeometryType
Definition: common.hh:151
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
constexpr GeometryType cube(unsigned int dim)
Returns a GeometryType representing a hypercube of dimension dim.
Definition: type.hh:462
constexpr GeometryType prism
GeometryType representing a 3D prism.
Definition: type.hh:528
constexpr GeometryType pyramid
GeometryType representing a 3D pyramid.
Definition: type.hh:522
constexpr GeometryType simplex(unsigned int dim)
Returns a GeometryType representing a simplex of dimension dim.
Definition: type.hh:453
Dune namespace.
Definition: alignedallocator.hh:13
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.111.3 (Nov 13, 23:29, 2024)