OGS
IntegrationGaussLegendreTri.h
Go to the documentation of this file.
1
14#pragma once
15
16#include "BaseLib/Error.h"
19
20namespace NumLib
21{
37{
38public:
44 explicit IntegrationGaussLegendreTri(unsigned order = 2) : _order(order)
45 {
46 this->setIntegrationOrder(order);
47 }
48
50 void setIntegrationOrder(unsigned order)
51 {
52 _order = order;
54 }
55
57 unsigned getIntegrationOrder() const { return _order; }
58
60 unsigned getNumberOfPoints() const { return _n_sampl_pt; }
61
68 MathLib::WeightedPoint getWeightedPoint(unsigned const igp) const
69 {
71 }
72
80 static MathLib::WeightedPoint getWeightedPoint(unsigned const order, unsigned const igp)
81 {
82 switch (order)
83 {
84 case 1:
85 return getWeightedPoint<MathLib::GaussLegendreTri<1>>(igp);
86 case 2:
87 return getWeightedPoint<MathLib::GaussLegendreTri<2>>(igp);
88 case 3:
89 return getWeightedPoint<MathLib::GaussLegendreTri<3>>(igp);
90 case 4:
91 return getWeightedPoint<MathLib::GaussLegendreTri<4>>(igp);
92 }
93 OGS_FATAL("Integration order {:d} not implemented for triangles.",
94 order);
95 }
96
97 template <typename Method>
98 static MathLib::WeightedPoint getWeightedPoint(unsigned const igp)
99 {
100 return MathLib::WeightedPoint(Method::X[igp], 0.5 * Method::W[igp]);
101 }
102
109 static unsigned getNumberOfPoints(unsigned order)
110 {
111 switch (order)
112 {
113 case 1:
115 case 2:
117 case 3:
119 case 4:
121 }
122 OGS_FATAL("Integration order {:d} not implemented for triangles.",
123 order);
124 }
125
126private:
127 unsigned _order;
128 unsigned _n_sampl_pt{0};
129};
130
131} // namespace NumLib
#define OGS_FATAL(...)
Definition Error.h:26
Gauss-Legendre quadrature rule for triangles.
static MathLib::WeightedPoint getWeightedPoint(unsigned const igp)
unsigned getNumberOfPoints() const
return the number of sampling points
static MathLib::WeightedPoint getWeightedPoint(unsigned const order, unsigned const igp)
void setIntegrationOrder(unsigned order)
Change the integration order.
unsigned getIntegrationOrder() const
return current integration order.
static unsigned getNumberOfPoints(unsigned order)
MathLib::WeightedPoint getWeightedPoint(unsigned const igp) const