G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsQuadRule< T > Class Template Reference

Detailed Description

template<class T>
class gismo::gsQuadRule< T >

Class representing a reference quadrature rule.

+ Inheritance diagram for gsQuadRule< T >:
+ Collaboration diagram for gsQuadRule< T >:

Public Member Functions

index_t dim () const
 Dimension of the rule.
 
 gsQuadRule ()
 Default empty constructor.
 
virtual void mapTo (const gsVector< T > &lower, const gsVector< T > &upper, gsMatrix< T > &nodes, gsVector< T > &weights) const
 Maps quadrature rule (i.e., points and weights) from the reference domain to an element. More...
 
virtual void mapTo (T startVal, T endVal, gsMatrix< T > &nodes, gsVector< T > &weights) const
 Maps a univariate quadrature rule (i.e., points and weights) from the reference interval to an arbitrary interval.
 
void mapToAll (const std::vector< T > &breaks, gsMatrix< T > &nodes, gsVector< T > &weights) const
 Maps a univariate quadrature rule (i.e., points and weights) from the reference interval to a number of intervals, implied by the breaks.
 
index_t numNodes () const
 Number of nodes in the currently kept rule.
 
const gsMatrix< T > & referenceNodes () const
 Returns reference nodes for the currently kept rule. More...
 
const gsVector< T > & referenceWeights () const
 Returns reference weights for the currently kept rule. More...
 
virtual void setNodes (gsVector< index_t > const &, unsigned=0)
 Initialize quadrature rule with numNodes number of quadrature points per integration variable. More...
 
void setNodes (index_t numNodes, unsigned digits=0)
 Initialize a univariate quadrature rule with numNodes quadrature points. More...
 

Protected Member Functions

void computeTensorProductRule (const std::vector< gsVector< T > > &nodes, const std::vector< gsVector< T > > &weights)
 Computes the tensor product rule from coordinate-wise 1D nodes and weights.
 

Protected Attributes

gsMatrix< T > m_nodes
 Reference quadrature nodes (on the interval [-1,1]).
 
gsVector< T > m_weights
 Reference quadrature weights (corresponding to interval [-1,1]).
 

Member Function Documentation

void mapTo ( const gsVector< T > &  lower,
const gsVector< T > &  upper,
gsMatrix< T > &  nodes,
gsVector< T > &  weights 
) const
inlinevirtual

Maps quadrature rule (i.e., points and weights) from the reference domain to an element.

The currently kept rule (which is initialized on the reference hypercube [-1,1]^d by calling setNodes()) is mapped to the d-dimensional hypercube specified by lower and upper.
For example, for d=2, the square [a,b]x[c,d] is defined by lower = [a,c], upper = [b,d].

Parameters
[in]lowervector of length d, defining the coordinates of the lower corner of the hypercube.
[in]uppervector of length d, defining the coordinates of the upper corner of the hypercube.
[in,out]nodeswill be overwritten with the coordinates of the quadrature nodes.
Size of the matrix nodes = d x n, where
d is the dimension of the element, and
n is the number of quadrature points.
[in,out]weightswill be overwritten with the corresponding Gauss quadrature weights.
Length of the vector weights = number of quadrature nodes.

Reimplemented in gsPatchRule< T >, and gsOverIntegrateRule< T >.

const gsMatrix<T>& referenceNodes ( ) const
inline

Returns reference nodes for the currently kept rule.

Returns
v Vector of length d = dim(), where each entry v_i of v is again a vector. v_i contains the reference quadrature points for the i-th coordinate direction.
const gsVector<T>& referenceWeights ( ) const
inline

Returns reference weights for the currently kept rule.

Returns
v Vector of length d = dim(), where each entry v_i of v is again a vector. v_i contains the reference quadrature weights for the i-th coordinate direction.
virtual void setNodes ( gsVector< index_t > const &  ,
unsigned  = 0 
)
inlinevirtual

Initialize quadrature rule with numNodes number of quadrature points per integration variable.

The call of this function initializes the quadrature rule for further use, i.e., the quadrature points and weights on the reference cube are set up and stored. The dimension d of the reference cube is specified by the length of the vector numNodes.

Example: numNodes = [2,5] corresponds to quadrature in 2D where two quadrature points are used for the first coordinate and five quadrature points for the second coordinate. In this case, 2*5 = 10 quadrature nodes and weights are set up.


Parameters
numNodes vector of length digits containing numbers of nodes to be used (per integration variable).
digits accuracy of nodes and weights. If 0, the quadrature rule will use precomputed tables if possible. If greater then 0, it will force to compute it everytime.

Reimplemented in gsGaussRule< T >, gsNewtonCotesRule< T >, and gsLobattoRule< T >.

void setNodes ( index_t  numNodes,
unsigned  digits = 0 
)
inline

Initialize a univariate quadrature rule with numNodes quadrature points.

Parameters
numNodesquadrature point
digitsaccuracy of nodes and weights. If 0, the quadrature rule will use precomputed tables if possible. If greater then 0, it will force to compute it everytime.