OGS
IntegrationGaussLegendrePrism.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
5
6#include <cassert>
7
8#include "BaseLib/Error.h"
9
10namespace
11{
12template <int OrderGaussLegendreTri, int OrderGaussLegendre>
13constexpr unsigned getNumberOfPointsConcrete()
14{
16 OrderGaussLegendre;
17}
18
19template <int OrderGaussLegendreTri, int OrderGaussLegendre>
21{
24
25 assert(igp < (getNumberOfPointsConcrete<OrderGaussLegendreTri,
26 OrderGaussLegendre>()));
27
28 const unsigned gp_r = igp % GLT::NPoints;
29 const unsigned gp_t = igp / GLT::NPoints;
30
31 std::array<double, 3> rst{GLT::X[gp_r][0], GLT::X[gp_r][1], GL::X[gp_t]};
32
33 double const weight = GLT::W[gp_r] * 0.5 * GL::W[gp_t];
34
35 return MathLib::WeightedPoint(rst, weight);
36}
37} // namespace
38
39namespace NumLib
40{
46
48 unsigned const order, unsigned const igp)
49{
50 // Note: These cases must correspond strictly to the logic in
51 // getNumberOfPoints()!
52 switch (order)
53 {
54 case 1:
55 return getWeightedPointConcrete<1, 1>(igp);
56 case 2:
57 return getWeightedPointConcrete<2, 2>(igp);
58 case 3:
59 // The combination <4, 3> has been chosen to allow extrapolation
60 // from the set of integration points on Prism13 elements for the
61 // third integration order. <3, 3> would not be sufficient.
62 return getWeightedPointConcrete<4, 3>(igp);
63 case 4:
64 return getWeightedPointConcrete<4, 4>(igp);
65 default:
67 "Integration order {} not supported for integration on prisms.",
68 order);
69 }
70}
71
73{
74 // Note: These cases must correspond strictly to the logic in
75 // getWeightedPoint()!
76 switch (order)
77 {
78 case 1:
79 return getNumberOfPointsConcrete<1, 1>();
80 case 2:
81 return getNumberOfPointsConcrete<2, 2>();
82 case 3:
83 // The combination <4, 3> has been chosen to allow extrapolation
84 // from the set of integration points on Prism13 elements for the
85 // third integration order. <3, 3> would not be sufficient.
86 return getNumberOfPointsConcrete<4, 3>();
87 case 4:
88 return getNumberOfPointsConcrete<4, 4>();
89 default:
91 "Integration order {} not supported for integration on prisms.",
92 order);
93 }
94}
95} // namespace NumLib
#define OGS_FATAL(...)
Definition Error.h:19
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)
static MATHLIB_EXPORT const unsigned NPoints