OGS
IntegrationGaussLegendreRegular.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 <array>
7#include <cmath>
8
9#include "BaseLib/Error.h"
12
13namespace NumLib
14{
19template <unsigned N_DIM>
21{
22public:
27 explicit IntegrationGaussLegendreRegular(unsigned order = 2) : _order(order)
28 {
29 this->setIntegrationOrder(order);
30 }
31
33 void setIntegrationOrder(unsigned order)
34 {
35 this->_n_sampl_pt = static_cast<unsigned>(std::pow(order, N_DIM));
36 this->_order = order;
37 }
38
40 unsigned getIntegrationOrder() const { return _order; }
41
43 unsigned getNumberOfPoints() const { return _n_sampl_pt; }
44
49 MathLib::WeightedPoint getWeightedPoint(unsigned const igp) const
50 {
52 }
53
59 static std::array<unsigned, N_DIM> getPositionIndices(unsigned order,
60 unsigned igp);
61
67 static MathLib::WeightedPoint getWeightedPoint(unsigned const order,
68 unsigned const igp);
69
70private:
75 template <typename Method>
77 std::array<unsigned, N_DIM> const& pos);
78
79private:
80 unsigned _order;
81 unsigned _n_sampl_pt{0};
82};
83
84} // namespace NumLib
85
static std::array< unsigned, N_DIM > getPositionIndices(unsigned order, unsigned igp)
unsigned getIntegrationOrder() const
return current integration order.
unsigned getNumberOfPoints() const
return the number of sampling points
static MathLib::WeightedPoint getWeightedPoint(std::array< unsigned, N_DIM > const &pos)
MathLib::WeightedPoint getWeightedPoint(unsigned const igp) const
void setIntegrationOrder(unsigned order)
Change the integration order.
static MathLib::WeightedPoint getWeightedPoint(unsigned const order, unsigned const igp)