20 #include "pism/util/fem/Quadrature.hh"
43 const double *points1,
44 const double *weights1,
45 std::vector<QuadPoint>& points,
46 std::vector<double>& weights) {
48 weights.resize(
n *
n);
51 for (
unsigned int j = 0; j <
n; ++j) {
52 for (
unsigned int i = 0; i <
n; ++i) {
53 points[q] = {points1[i], points1[j], 0.0};
54 weights[q] = weights1[i] * weights1[j];
63 double A = 1.0 / std::sqrt(3.0);
65 m_points = {{-A, 0.0, 0.0}, {A, 0.0, 0.0}};
82 weights2[2] = {1.0, 1.0};
91 points3[3] = {-B, A, B};
96 weights3[3] = {w1, w2, w1};
103 A = sqrt(3.0 / 7.0 - (2.0 / 7.0) * sqrt(6.0 / 5.0)),
104 B = sqrt(3.0 / 7.0 + (2.0 / 7.0) * sqrt(6.0 / 5.0)),
105 points4[4] = {-B, -A, A, B};
110 w1 = (18.0 + sqrt(30.0)) / 36.0,
111 w2 = (18.0 - sqrt(30.0)) / 36.0,
112 weights4[4] = {w2, w1, w1, w2};
122 std::vector<double> xi(N), w(N);
123 const double dxi = 2.0 / N;
124 for (
unsigned int k = 0;
k < N; ++
k) {
125 xi[
k] = -1.0 + dxi*(
k + 0.5);
138 one_over_six = 1.0 / 6.0,
139 two_over_three = 2.0 / 3.0;
141 m_points = {{two_over_three, one_over_six, 0.0},
142 {one_over_six, two_over_three, 0.0},
143 {one_over_six, one_over_six, 0.0}};
145 m_weights = {one_over_six, one_over_six, one_over_six};
149 double xis[8] = {-1.0, 1.0, 1.0, -1.0, -1.0, 1.0, 1.0, -1.0};
150 double etas[8] = {-1.0, -1.0, 1.0, 1.0, -1.0, -1.0, 1.0, 1.0};
151 double zetas[8] = {-1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0};
156 double C = 1.0 / sqrt(3.0);
158 for (
int k = 0;
k < 8; ++
k) {
171 A = sqrt(3.0 / 7.0 - (2.0 / 7.0) * sqrt(6.0 / 5.0)),
172 B = sqrt(3.0 / 7.0 + (2.0 / 7.0) * sqrt(6.0 / 5.0)),
173 pt[4] = {-B, -A, A, B};
178 w1 = (18.0 + sqrt(30.0)) / 36.0,
179 w2 = (18.0 - sqrt(30.0)) / 36.0,
180 w[4] = {w2, w1, w1, w2};
185 for (
int i = 0; i < 4; ++i) {
186 for (
int j = 0; j < 4; ++j) {
187 for (
int k = 0;
k < 4; ++
k) {
Q1Quadrature1()
One-point quadrature on a rectangle.
Q1Quadrature4()
Two-by-two Gaussian quadrature on a rectangle.
Q1QuadratureN(unsigned int n)
N*N-point uniform (not Gaussian) quadrature for integrating discontinuous functions.
std::vector< QuadPoint > m_points
const std::vector< double > & weights() const
std::vector< double > m_weights
const std::vector< QuadPoint > & points() const
static void tensor_product_quadrature(unsigned int n, const double *points1, const double *weights1, std::vector< QuadPoint > &points, std::vector< double > &weights)