OGS
NumLib::IntegrationGaussLegendreRegular< N_DIM > Class Template Reference

Detailed Description

template<unsigned N_DIM>
class NumLib::IntegrationGaussLegendreRegular< N_DIM >

Gauss-Legendre quadrature rule for regular shape elements: line, quad and hex.

Template Parameters
N_DIMSpatial dimension

Definition at line 20 of file IntegrationGaussLegendreRegular.h.

#include <IntegrationGaussLegendreRegular.h>

Public Member Functions

 IntegrationGaussLegendreRegular (unsigned order=2)
void setIntegrationOrder (unsigned order)
 Change the integration order.
unsigned getIntegrationOrder () const
 return current integration order.
unsigned getNumberOfPoints () const
 return the number of sampling points
MathLib::WeightedPoint getWeightedPoint (unsigned const igp) const
std::array< unsigned, 1 > getPositionIndices (unsigned, unsigned igp)
std::array< unsigned, 2 > getPositionIndices (unsigned order, unsigned igp)
std::array< unsigned, 3 > getPositionIndices (unsigned order, unsigned igp)

Static Public Member Functions

static std::array< unsigned, N_DIM > getPositionIndices (unsigned order, unsigned igp)
static MathLib::WeightedPoint getWeightedPoint (unsigned const order, unsigned const igp)

Static Private Member Functions

template<typename Method>
static MathLib::WeightedPoint getWeightedPoint (std::array< unsigned, N_DIM > const &pos)

Private Attributes

unsigned _order
unsigned _n_sampl_pt {0}

Constructor & Destructor Documentation

◆ IntegrationGaussLegendreRegular()

template<unsigned N_DIM>
NumLib::IntegrationGaussLegendreRegular< N_DIM >::IntegrationGaussLegendreRegular ( unsigned order = 2)
inlineexplicit

Create IntegrationGaussLegendreRegular of the given Gauss-Legendre integration order.

Parameters
orderintegration order (default 2)

Definition at line 27 of file IntegrationGaussLegendreRegular.h.

Member Function Documentation

◆ getIntegrationOrder()

template<unsigned N_DIM>
unsigned NumLib::IntegrationGaussLegendreRegular< N_DIM >::getIntegrationOrder ( ) const
inline

return current integration order.

Definition at line 40 of file IntegrationGaussLegendreRegular.h.

40{ return _order; }

Referenced by NumLib::IntegrationGaussLegendreRegular< MeshElement::dimension >::getWeightedPoint().

◆ getNumberOfPoints()

template<unsigned N_DIM>
unsigned NumLib::IntegrationGaussLegendreRegular< N_DIM >::getNumberOfPoints ( ) const
inline

return the number of sampling points

Definition at line 43 of file IntegrationGaussLegendreRegular.h.

◆ getPositionIndices() [1/4]

std::array< unsigned, 2 > NumLib::IntegrationGaussLegendreRegular< 2 >::getPositionIndices ( unsigned order,
unsigned igp )
inline

Definition at line 20 of file IntegrationGaussLegendreRegular-impl.h.

22{
23 assert(igp < order * order);
25 result[0] = igp / order;
26 result[1] = igp % order;
27 return result;
28}

◆ getPositionIndices() [2/4]

std::array< unsigned, 3 > NumLib::IntegrationGaussLegendreRegular< 3 >::getPositionIndices ( unsigned order,
unsigned igp )
inline

Definition at line 32 of file IntegrationGaussLegendreRegular-impl.h.

34{
35 assert(igp < order * order * order);
36 unsigned const gp_r = igp / (order * order);
37 unsigned const gp_s = igp % (order * order);
39 result[0] = gp_r;
40 result[1] = gp_s / order;
41 result[2] = gp_s % order;
42 return result;
43}

◆ getPositionIndices() [3/4]

template<unsigned N_DIM>
std::array< unsigned, N_DIM > NumLib::IntegrationGaussLegendreRegular< N_DIM >::getPositionIndices ( unsigned order,
unsigned igp )
static

Get position indexes in r-s-t axis.

Parameters
orderThe number of integration points
igpThe integration point index
Returns
a tuple of position indexes

Referenced by getWeightedPoint().

◆ getPositionIndices() [4/4]

std::array< unsigned, 1 > NumLib::IntegrationGaussLegendreRegular< 1 >::getPositionIndices ( unsigned ,
unsigned igp )
inline

Definition at line 10 of file IntegrationGaussLegendreRegular-impl.h.

12{
14 result[0] = igp;
15 return result;
16}

◆ getWeightedPoint() [1/3]

template<unsigned N_DIM>
template<typename Method>
MathLib::WeightedPoint NumLib::IntegrationGaussLegendreRegular< N_DIM >::getWeightedPoint ( std::array< unsigned, N_DIM > const & pos)
inlinestaticprivate

Computes weighted point using given integration method.

Template Parameters
MethodIntegration method to use.
Parameters
posPoint indices computed by getPositionIndices.

Definition at line 70 of file IntegrationGaussLegendreRegular-impl.h.

72{
74 double weight = 1;
75 for (unsigned d = 0; d < N_DIM; d++)
76 {
77 coords[d] = Method::X[pos[d]];
78 weight *= Method::W[pos[d]];
79 }
80
82}

◆ getWeightedPoint() [2/3]

template<unsigned N_DIM>
MathLib::WeightedPoint NumLib::IntegrationGaussLegendreRegular< N_DIM >::getWeightedPoint ( unsigned const igp) const
inline

Get coordinates of the integration point.

Parameters
igpThe integration point index
Returns
a weighted point

Definition at line 49 of file IntegrationGaussLegendreRegular.h.

50 {
52 }
unsigned getIntegrationOrder() const
return current integration order.
MathLib::WeightedPoint getWeightedPoint(unsigned const igp) const

Referenced by getWeightedPoint(), and NumLib::IntegrationGaussLegendreRegular< MeshElement::dimension >::getWeightedPoint().

◆ getWeightedPoint() [3/3]

template<unsigned N_DIM>
MathLib::WeightedPoint NumLib::IntegrationGaussLegendreRegular< N_DIM >::getWeightedPoint ( unsigned const order,
unsigned const igp )
inlinestatic

Get coordinates of the integration point.

Parameters
orderThe number of integration points
igpThe integration point index
Returns
a weighted point

Definition at line 47 of file IntegrationGaussLegendreRegular-impl.h.

49{
52
53 switch (order)
54 {
55 case 1:
57 case 2:
59 case 3:
61 case 4:
63 }
64 OGS_FATAL("Integration order {:d} not implemented.", order);
65}
#define OGS_FATAL(...)
Definition Error.h:19
static std::array< unsigned, N_DIM > getPositionIndices(unsigned order, unsigned igp)

References getPositionIndices(), getWeightedPoint(), and OGS_FATAL.

◆ setIntegrationOrder()

template<unsigned N_DIM>
void NumLib::IntegrationGaussLegendreRegular< N_DIM >::setIntegrationOrder ( unsigned order)
inline

Change the integration order.

Definition at line 33 of file IntegrationGaussLegendreRegular.h.

34 {
35 this->_n_sampl_pt = static_cast<unsigned>(std::pow(order, N_DIM));
36 this->_order = order;
37 }

Referenced by NumLib::IntegrationGaussLegendreRegular< MeshElement::dimension >::IntegrationGaussLegendreRegular().

Member Data Documentation

◆ _n_sampl_pt

template<unsigned N_DIM>
unsigned NumLib::IntegrationGaussLegendreRegular< N_DIM >::_n_sampl_pt {0}
private

Definition at line 81 of file IntegrationGaussLegendreRegular.h.

81{0};

◆ _order

template<unsigned N_DIM>
unsigned NumLib::IntegrationGaussLegendreRegular< N_DIM >::_order
private

Definition at line 80 of file IntegrationGaussLegendreRegular.h.


The documentation for this class was generated from the following files: