OGS
IntegrationGaussLegendreRegular-impl.h
Go to the documentation of this file.
1
12
13
#include <cassert>
14
15
namespace
NumLib
16
{
17
template
<>
18
inline
std::array<unsigned, 1>
19
IntegrationGaussLegendreRegular<1>::getPositionIndices
(
unsigned
/*order*/
,
20
unsigned
igp)
21
{
22
std::array<unsigned, 1> result;
23
result[0] = igp;
24
return
result;
25
}
26
27
template
<>
28
inline
std::array<unsigned, 2>
29
IntegrationGaussLegendreRegular<2>::getPositionIndices
(
unsigned
order,
30
unsigned
igp)
31
{
32
assert(igp < order * order);
33
std::array<unsigned, 2> result;
34
result[0] = igp / order;
35
result[1] = igp % order;
36
return
result;
37
}
38
39
template
<>
40
inline
std::array<unsigned, 3>
41
IntegrationGaussLegendreRegular<3>::getPositionIndices
(
unsigned
order,
42
unsigned
igp)
43
{
44
assert(igp < order * order * order);
45
unsigned
const
gp_r = igp / (order * order);
46
unsigned
const
gp_s = igp % (order * order);
47
std::array<unsigned, 3> result;
48
result[0] = gp_r;
49
result[1] = gp_s / order;
50
result[2] = gp_s % order;
51
return
result;
52
}
53
54
template
<
unsigned
N_DIM>
55
inline
MathLib::WeightedPoint
56
IntegrationGaussLegendreRegular<N_DIM>::getWeightedPoint
(
unsigned
const
order,
57
unsigned
const
igp)
58
{
59
assert(igp < std::pow(order, N_DIM));
60
std::array<unsigned, N_DIM>
const
pos =
getPositionIndices
(order, igp);
61
62
switch
(order)
63
{
64
case
1:
65
return
getWeightedPoint<MathLib::GaussLegendre<1>
>(pos);
66
case
2:
67
return
getWeightedPoint<MathLib::GaussLegendre<2>
>(pos);
68
case
3:
69
return
getWeightedPoint<MathLib::GaussLegendre<3>
>(pos);
70
case
4:
71
return
getWeightedPoint<MathLib::GaussLegendre<4>
>(pos);
72
}
73
OGS_FATAL
(
"Integration order {:d} not implemented."
, order);
74
}
75
76
template
<
unsigned
N_DIM>
77
template
<
typename
Method>
78
inline
MathLib::WeightedPoint
79
IntegrationGaussLegendreRegular<N_DIM>::getWeightedPoint
(
80
std::array<unsigned, N_DIM>
const
& pos)
81
{
82
std::array<double, N_DIM> coords;
83
double
weight = 1;
84
for
(
unsigned
d = 0; d < N_DIM; d++)
85
{
86
coords[d] = Method::X[pos[d]];
87
weight *= Method::W[pos[d]];
88
}
89
90
return
MathLib::WeightedPoint
(coords, weight);
91
}
92
}
// namespace NumLib
OGS_FATAL
#define OGS_FATAL(...)
Definition
Error.h:26
MathLib::WeightedPoint
Definition
WeightedPoint.h:22
NumLib::IntegrationGaussLegendreRegular::getPositionIndices
static std::array< unsigned, N_DIM > getPositionIndices(unsigned order, unsigned igp)
NumLib::IntegrationGaussLegendreRegular::getWeightedPoint
MathLib::WeightedPoint getWeightedPoint(unsigned const igp) const
Definition
IntegrationGaussLegendreRegular.h:58
NumLib
Definition
ProjectData.h:46
NumLib
Fem
Integration
IntegrationGaussLegendreRegular-impl.h
Generated by
1.14.0