Chi-Tech
quadrature_conical.cc
Go to the documentation of this file.
2
5
6//###################################################################
7/**Initialize conical quadrature for a triangle.*/
9{
10 QuadratureGaussLegendre legendre((QuadratureOrder)std::floor(((int)order_ + 1) / 2.0));
11 QuadratureJacobi jacobiA(order_, /*alpha=*/1, /*beta=*/0);
12
13 legendre.SetRange({0, 1});
14
15 const size_t np = legendre.qpoints_.size();
16
17 qpoints_.resize(np * np);
18 weights_.resize(np * np);
19
20 // Compute the conical product
21 unsigned int gp = 0;
22 for (unsigned int i=0; i<np; i++)
23 for (unsigned int j=0; j<np; j++)
24 {
25 qpoints_[gp](0) = jacobiA.qpoints_[j](0); //s[j];
26 qpoints_[gp](1) = legendre.qpoints_[i](0) *
27 (1.-jacobiA.qpoints_[j](0)); //r[i]*(1.-s[j]);
28 weights_[gp] = legendre.weights_[i] *
29 jacobiA.weights_[j]; //A[i]*B[j];
30 gp++;
31 }
32}
33
34//###################################################################
35/**Initialize conical quadrature for a tetrahedron.*/
37{
38 QuadratureGaussLegendre legendre((QuadratureOrder)std::floor(((int)order_ + 1) / 2.0));
39 QuadratureJacobi jacobiA(order_, /*alpha=*/1, /*beta=*/0);
40 QuadratureJacobi jacobiB(order_, /*alpha=*/2, /*beta=*/0);
41
42 legendre.SetRange({0, 1});
43
44 const size_t np = legendre.qpoints_.size();
45
46 qpoints_.resize(np * np * np);
47 weights_.resize(np * np * np);
48
49 double weight_sum = 0.0;
50 unsigned int gp = 0;
51 for (unsigned int i=0; i<np; i++)
52 for (unsigned int j=0; j<np; j++)
53 for (unsigned int k=0; k<np; k++)
54 {
55 qpoints_[gp](0) = jacobiB.qpoints_[k](0); //t[k];
56 qpoints_[gp](1) = jacobiA.qpoints_ [j](0) *
57 (1.-jacobiB.qpoints_[k](0)); //s[j]*(1.-t[k]);
58 qpoints_[gp](2) = legendre.qpoints_[i](0) *
59 (1.-jacobiA.qpoints_[j](0)) *
60 (1.-jacobiB.qpoints_[k](0)); //r[i]*(1.-s[j])*(1.-t[k]);
61 weights_[gp] = legendre.weights_[i] *
62 jacobiA.weights_ [j] *
63 jacobiB.weights_ [k]; //A[i]*B[j]*C[k];
64 weight_sum += weights_[gp];
65 gp++;
66 }
67
68 double w_scale = (1.0/6.0)/weight_sum;
69 for (auto& v : weights_)
70 v *= w_scale;
71}
void SetRange(const std::pair< double, double > &in_range)
Definition: quadrature.cc:91
std::vector< chi_math::QuadraturePointXYZ > qpoints_
Definition: quadrature.h:37
QuadratureOrder order_
Definition: quadrature.h:36
std::vector< double > weights_
Definition: quadrature.h:38
QuadratureOrder
Definition: quadrature.h:12