DUNE-FEM (unstable)

pardgsimplexquadrature.hh
1#ifndef DUNE_FEM_PARDGSIMPLEXQUADRATURE_HPP
2#define DUNE_FEM_PARDGSIMPLEXQUADRATURE_HPP
3
4#include <cassert>
5#include <vector>
6
8
9namespace Dune {
10namespace Fem {
11namespace ParDGSimplexQuadrature
12{
13
14
15template<int dim>
16class Quadrature
17{
18public:
19 enum { numCorners = dim+1 };
20 typedef Dune::FieldVector< double, dim > CoordinateType;
22
23 Quadrature(int nop, int degree, const double x[][dim+1])
24 : nop(nop), degree(degree), x_w( nop )
25 {
26 for(int i=0; i<nop; i++)
27 {
28 for(int l=0; l<=dim; l++) x_w[i][l] = x[i][l];
29 }
30 }
31
32 explicit Quadrature( const int order )
33 {
34 const Quadrature& quad = quadrature( order );
35 nop = quad.number_of_points();
36 degree = quad.max_order();
37
38 assert( order <= degree );
39
40 x_w.resize( nop );
41 for(int i=0; i<nop; i++)
42 {
43 for(int l=0; l<=dim; l++) x_w[i][l] = quad.x_w[i][l];
44 }
45 }
46
47 CoordinateType point( const int i ) const
48 {
49 assert(i >= 0 && i < numPoints());
50 CoordinateType result;
51 for (size_t j = 0; j < dim; ++j)
52 {
53 result[j] = x(i)[j];
54 }
55 return result;
56 }
57
59 double weight(const int i) const
60 {
61 assert(i >= 0 && i < numPoints());
62 // scale with volume of reference element!
63 return w(i);
64 }
65
66 int order() const { return degree; }
67
68 int numPoints() const { return number_of_points(); }
69 int max_order() const { return degree; }
70
71 int number_of_points() const{ return nop; }
72
73 const Point& x(int i) const {
74 assert(i>=0 && i<nop);
75 return x_w[i];
76 }
77
78 double w(int i) const
79 {
80 assert(i>=0 && i<nop);
81 return x_w[i][dim];
82 }
83
84 void check() const;
85
86 static const Quadrature& quadrature(int minimum_degree);
87
88protected:
89
90 int nop;
91 int degree;
92 std::vector< Point > x_w;
93};
94
95
96// dimensions of interest
97typedef Quadrature<0> Quadrature0d;
98typedef Quadrature<1> Quadrature1d;
99typedef Quadrature<2> Quadrature2d;
100typedef Quadrature<3> Quadrature3d;
101
102
103
104// 0d quadrature rule
105//
106// there is only one with one point and infinite degree
107extern const Quadrature0d quad0d;
108
109
110
111// 1d quadrature rules for the interval (0,1)
112//
113// naming convention of quad1d_x: x denotes the order of the formula
114// i.e. the maximum degree of polynimials
115// that is integrated exact by the formula.
116//
117// exception quad1d_0: this is a dummy that has no points
118extern const Quadrature1d quad1d_0, quad1d_1, quad1d_3, quad1d_5, quad1d_7,
119 quad1d_9, quad1d_11, quad1d_13, quad1d_15, quad1d_17, quad1d_19, quad1d_21,
120 quad1d_23, quad1d_25, quad1d_27, quad1d_29, quad1d_31, quad1d_33, quad1d_35,
121 quad1d_37, quad1d_39;
122
123
124
125// 2d quadrature rules for the reference triangle [(0,0), (1,0), (0,1)]
126//
127// naming convention of quad2d_x: x denotes the order of the formula
128// i.e. the maximum degree of polynimials
129// that is integrated exact by the formula.
130//
131// exception quad2d_0: this is a dummy that has no points
132extern const Quadrature2d quad2d_0, quad2d_1, quad2d_2, quad2d_3, quad2d_4,
133 quad2d_5, quad2d_6, quad2d_7, quad2d_8, quad2d_9, quad2d_10, quad2d_11,
134 quad2d_13;
135
136
137
138
139// 3d quadrature rules for the reference
140// tetrahedron [(0,0,0), (1,0,0), (0,1,0), (0,0,1)]
141//
142// naming convention of quad3d_x: x denotes the order of the formula
143// i.e. the maximum degree of polynimials
144// that is integrated exact by the formula.
145//
146// exception quad3d_0: this is a dummy that has no points
147extern const Quadrature3d quad3d_0, quad3d_1, quad3d_2, quad3d_3, quad3d_4,
148 quad3d_5, quad3d_5b, quad3d_6, quad3d_7, quad3d_7b, quad3d_8, quad3d_9,
149 quad3d_11;
150
151
152} // ParDGSimplexQuadrature
153} // Fem
154} // Dune
155
156#endif
vector space out of a tensor product of fields.
Definition: fvector.hh:91
actual interface class for quadratures
Implements a vector constructed from a given type representing a field and a compile-time given size.
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)