OGS
IntegrationGaussLegendreTri.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include "BaseLib/Error.h"
9
10namespace NumLib
11{
27{
28public:
34 explicit IntegrationGaussLegendreTri(unsigned order = 2) : _order(order)
35 {
36 this->setIntegrationOrder(order);
37 }
38
40 void setIntegrationOrder(unsigned order)
41 {
42 _order = order;
44 }
45
47 unsigned getIntegrationOrder() const { return _order; }
48
50 unsigned getNumberOfPoints() const { return _n_sampl_pt; }
51
58 MathLib::WeightedPoint getWeightedPoint(unsigned const igp) const
59 {
61 }
62
70 static MathLib::WeightedPoint getWeightedPoint(unsigned const order, unsigned const igp)
71 {
72 switch (order)
73 {
74 case 1:
76 case 2:
78 case 3:
80 case 4:
82 }
83 OGS_FATAL("Integration order {:d} not implemented for triangles.",
84 order);
85 }
86
87 template <typename Method>
88 static MathLib::WeightedPoint getWeightedPoint(unsigned const igp)
89 {
90 return MathLib::WeightedPoint(Method::X[igp], 0.5 * Method::W[igp]);
91 }
92
99 static unsigned getNumberOfPoints(unsigned order)
100 {
101 switch (order)
102 {
103 case 1:
105 case 2:
107 case 3:
109 case 4:
111 }
112 OGS_FATAL("Integration order {:d} not implemented for triangles.",
113 order);
114 }
115
116private:
117 unsigned _order;
118 unsigned _n_sampl_pt{0};
119};
120
121} // namespace NumLib
#define OGS_FATAL(...)
Definition Error.h:19
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
static MATHLIB_EXPORT const unsigned NPoints