NiHu
2.0
|
The purpose of this tutorial is to explain how you can work with quadratures in NiHu.
Quadratures are used to perform numerical integration over intrinsic domains. The most common regular quadratures in finite and boundary element methods are Gaussian quadratures. A Gaussian quadrature can be defined by specialising the template class NiHu::gaussian_quadrature with a specific domain class, and providing a quadrature order to the constructor:
In the above example, a line quadrature is created that integrates over the domain \( -1 \le \xi \le +1\) with a 7-th order quadrature. A 7-th order quadrature can accurately integrate polynomials of order up to 7. For the case of Gaussian quadratures, an \( n \)-th order quadrature consists of \( (n+1)/2 \) quadrature points.
A quadrature is a standard container of NiHu::quadrature_elem instances, where each NiHu::quadrature_elem contains a base point and a weight. As a consequence, a quadrature can be traversed using standard C++ traversing methods. For example, the quadrature locations and weights can be printed as
or, equivalently:
and the result reads as:
-0.861136 0.347855 -0.339981 0.652145 0.339981 0.652145 0.861136 0.347855
2 and 3-dimensional quadratures, as well as quadratures over triangles are defined similarly:
with the output
-0.861136 -0.861136 0.121003 -0.861136 -0.339981 0.226852 -0.861136 0.339981 0.226852 -0.861136 0.861136 0.121003 -0.339981 -0.861136 0.226852 -0.339981 -0.339981 0.425293 -0.339981 0.339981 0.425293 -0.339981 0.861136 0.226852 0.339981 -0.861136 0.226852 0.339981 -0.339981 0.425293 0.339981 0.339981 0.425293 0.339981 0.861136 0.226852 0.861136 -0.861136 0.121003 0.861136 -0.339981 0.226852 0.861136 0.339981 0.226852 0.861136 0.861136 0.121003