OGS
IntegrationGaussLegendrePrism.cpp
Go to the documentation of this file.
1
13
14#include <cassert>
15
16#include "BaseLib/Error.h"
17
18namespace
19{
20template <int OrderGaussLegendreTri, int OrderGaussLegendre>
21constexpr unsigned getNumberOfPointsConcrete()
22{
24 OrderGaussLegendre;
25}
26
27template <int OrderGaussLegendreTri, int OrderGaussLegendre>
29{
32
33 assert(igp < (getNumberOfPointsConcrete<OrderGaussLegendreTri,
34 OrderGaussLegendre>()));
35
36 const unsigned gp_r = igp % GLT::NPoints;
37 const unsigned gp_t = igp / GLT::NPoints;
38
39 std::array<double, 3> rst{GLT::X[gp_r][0], GLT::X[gp_r][1], GL::X[gp_t]};
40
41 double const weight = GLT::W[gp_r] * 0.5 * GL::W[gp_t];
42
43 return MathLib::WeightedPoint(rst, weight);
44}
45} // namespace
46
47namespace NumLib
48{
54
56 unsigned const order, unsigned const igp)
57{
58 // Note: These cases must correspod strictly to the logic in
59 // getNumberOfPoints()!
60 switch (order)
61 {
62 case 1:
63 return getWeightedPointConcrete<1, 1>(igp);
64 case 2:
65 return getWeightedPointConcrete<2, 2>(igp);
66 case 3:
67 // The combination <4, 3> has been chosen to allow extrapolation
68 // from the set of integration points on Prism13 elements for the
69 // third integration order. <3, 3> would not be sufficient.
70 return getWeightedPointConcrete<4, 3>(igp);
71 case 4:
72 return getWeightedPointConcrete<4, 4>(igp);
73 default:
75 "Integration order {} not supported for integration on prisms.",
76 order);
77 }
78}
79
81{
82 // Note: These cases must correspod strictly to the logic in
83 // getWeightedPoint()!
84 switch (order)
85 {
86 case 1:
87 return getNumberOfPointsConcrete<1, 1>();
88 case 2:
89 return getNumberOfPointsConcrete<2, 2>();
90 case 3:
91 // The combination <4, 3> has been chosen to allow extrapolation
92 // from the set of integration points on Prism13 elements for the
93 // third integration order. <3, 3> would not be sufficient.
94 return getNumberOfPointsConcrete<4, 3>();
95 case 4:
96 return getNumberOfPointsConcrete<4, 4>();
97 default:
99 "Integration order {} not supported for integration on prisms.",
100 order);
101 }
102}
103} // namespace NumLib
#define OGS_FATAL(...)
Definition Error.h:26
void setIntegrationOrder(unsigned const order)
Change the integration order.
unsigned getNumberOfPoints() const
return the number of sampling points
MathLib::WeightedPoint getWeightedPoint(unsigned const igp) const
MathLib::WeightedPoint getWeightedPointConcrete(unsigned const igp)