![]() |
Vulpes
0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
|
Classes | |
| class | QuadratureLibrary |
| A library for managing and generating quadrature rules for numerical integration. More... | |
| struct | QuadraturePoint |
| Represents a single quadrature point in a specified dimension. More... | |
| struct | QuadratureRule |
| Represents a quadrature rule consisting of a set of points and associated weights. More... | |
Typedefs | |
| using | QuadratureRule1Dmp = QuadratureRule1D<mpf_class> |
| template<typename T> | |
| using | QuadratureRule1D = QuadratureRule<T, 1> |
| Alias for a 1-dimensional quadrature rule. | |
Enumerations | |
| enum | QuadratureElemType : uint8_t { Simplex , TensorLegendre , TensorLobatto } |
| Enum representing the type of quadrature element. More... | |
Functions | |
| QuadratureRule1Dmp | gmpGaussLegendreQuadrature (std::size_t n, std::size_t precision=256) |
| Computes a Gauss-Legendre quadrature rule with arbitrary precision. | |
| QuadratureRule1Dmp | gmpGaussLobattoQuadrature (std::size_t n, std::size_t precision=256) |
| Generates a Gauss-Lobatto quadrature rule in 1D with arbitrary-precision arithmetic. | |
| template<std::size_t dim, typename T> | |
| QuadratureRule< T, dim > | buildTensorQuadrature (const QuadratureRule1D< T > &rule1d) |
| Constructs a tensor-product quadrature rule from a 1D quadrature rule. | |
| template<typename V, typename U, std::size_t Dim> | |
| QuadratureRule< V, Dim > | castRule (const QuadratureRule< U, Dim > &rule_src) |
| Casts a quadrature rule from one data type to another. | |
| template<typename T, std::size_t Dim> | |
| QuadratureRule< T, Dim - 1 > | baricentrycToCartesian (const QuadratureRule< T, Dim > &rule_bary) |
| Converts a barycentric quadrature rule to a Cartesian representation. | |
| template<std::size_t Dim> | |
| QuadratureRule< mpf_class, Dim+1 > | mpfGrundammMoellerQuadrature (std::size_t deg, std::size_t precision) |
| Generates Grundamm-Moller quadrature rules in barycentric coordinates. | |
| const QuadratureRule< mpf_class, 2 > & | getTriangleTabledQuadrature (std::size_t deg) |
| Retrieves a precomputed quadrature rule for a triangle. | |
| const QuadratureRule< mpf_class, 3 > & | getTetrahedronTabledQuadrature (std::size_t deg) |
| Retrieves a precomputed quadrature rule for a tetrahedron. | |
Variables | |
| static constexpr std::size_t | num_triangle_tabled_rules = 20 |
| Number of precomputed quadrature rules for triangles. | |
| static constexpr std::size_t | num_tetrahedron_tabled_rules = 20 |
| Number of precomputed quadrature rules for tetrahedra. | |
| using vulpes::qrule::QuadratureRule1D = QuadratureRule<T, 1> |
Alias for a 1-dimensional quadrature rule.
| T | The data type for the quadrature rule. |
| using vulpes::qrule::QuadratureRule1Dmp = QuadratureRule1D<mpf_class> |
Alias for 1D quadrature rule using mpf_class for arbitrary-precision arithmetic.
| enum vulpes::qrule::QuadratureElemType : uint8_t |
| QuadratureRule< T, Dim - 1 > vulpes::qrule::baricentrycToCartesian | ( | const QuadratureRule< T, Dim > & | rule_bary | ) |
Converts a barycentric quadrature rule to a Cartesian representation.
This method transforms a quadrature rule defined in barycentric coordinates of a Dim-dimensional simplex into Cartesian coordinates of a (Dim - 1)-dimensional space.
| T | The data type of the coordinates and weights (e.g., float, double). |
| Dim | The dimension of the barycentric simplex (must be > 2). |
| rule_bary | The input quadrature rule in barycentric coordinates. |
| QuadratureRule< T, dim > vulpes::qrule::buildTensorQuadrature | ( | const QuadratureRule1D< T > & | rule1d | ) |
Constructs a tensor-product quadrature rule from a 1D quadrature rule.
This function generates a multidimensional quadrature rule by creating the tensor product of a given 1D quadrature rule. The weights are computed as the product of the weights from the 1D rule, and the points are determined by interpreting the multidimensional indices.
| dim | The number of dimensions (tensor rank). Must be compile-time constant. |
| T | The type of weights and points, typically a floating-point or arbitrary-precision type. |
| rule1d | A 1D quadrature rule to be used as the base for the tensor product. |
| QuadratureRule< V, Dim > vulpes::qrule::castRule | ( | const QuadratureRule< U, Dim > & | rule_src | ) |
Casts a quadrature rule from one data type to another.
Converts a quadrature rule's weights and points from one data type to another, while preserving the rule's degree and structure. This is useful for adapting rules to different precision levels (e.g., from float to double or vice versa). The cast is done via vmath::to<U, V>, thus the typing must be supported by that function
| V | The target data type for the weights and points. |
| U | The source data type for the weights and points. |
| Dim | The spatial dimension of the quadrature rule. |
| rule_src | The input quadrature rule to be cast. |
| const QuadratureRule< mpf_class, 3 > & vulpes::qrule::getTetrahedronTabledQuadrature | ( | std::size_t | deg | ) |
Retrieves a precomputed quadrature rule for a tetrahedron.
Get the tabled quadrature rule of selected degree for a tetrahedron.
Provides quadrature rules for a tetrahedra for a specified degree. We employ Jaskowiec and Sukumar with 20 digits
| deg | The degree of the quadrature rule (up to 20). |
For the tetrahedron we employ the Jaskowiec-Sukumar rules up to degree 20. Jaskowiec, Jan, and N. Sukumar. 'High-order cubature rules for tetrahedra.' International Journal for Numerical Methods in Engineering 121.11 (2020): 2418-2436. DOI 10.1002/nme.6313
| const QuadratureRule< mpf_class, 2 > & vulpes::qrule::getTriangleTabledQuadrature | ( | std::size_t | deg | ) |
Retrieves a precomputed quadrature rule for a triangle.
Get the tabled quadrature rule of selected degree for a triangle.
Provides quadrature rule for the triangles for a specified degree. We employ Witherden and Vincent with 38 digits apart for degree 3 where we employ Hillion I with 17 digits
| deg | The degree of the quadrature rule (up to 20). |
We mainly use the Witherden-Vincent rules due to their high numerical precision. Values are computed using Polyquad. Tables are available as supplementary data to the paper link. All the rules are PI.
We tested them with all the monomials, they are accurate up to 38 digits.
F.D: Witherden, P.E. Vincent. the identification of symmetric quadrature rules for finite element methods'. Computers and Mathematics with Applications 69 (2015) 1232-1241. DOI 10.1016/j.camwa.2015.03.017
Since the Witherden-Vincent rules lack a formula of order three, for this specific case we use the (internal) Hillion rule. To ensure the best accuracy we apply few iterations of gradient descent in arbitrary precision to the rule (the loss function is the error on the integrations of the monomials, symmetry of the formula is preserved).
P. Hillion, 'Numerical Integration on a Triangle', International Journal for Numerical Methods in Engineering, Vol. 11, (1977), pp.797-815.
| QuadratureRule1Dmp vulpes::qrule::gmpGaussLegendreQuadrature | ( | std::size_t | n, |
| std::size_t | precision = 256 ) |
Computes a Gauss-Legendre quadrature rule with arbitrary precision.
Generates (n) nodes and weights for integrating functions on ([-1, 1]) using Gauss-Legendre quadrature, exact for polynomials up to degree (2n-1). Leverages arbitrary-precision arithmetic to ensure accuracy for large (n).
| n | Number of quadrature points \(\(n \geq 1\)\). |
| precision | Bit precision for computations (default: 256 bits). |
| QuadratureRule1Dmp vulpes::qrule::gmpGaussLobattoQuadrature | ( | std::size_t | n, |
| std::size_t | precision = 256 ) |
Generates a Gauss-Lobatto quadrature rule in 1D with arbitrary-precision arithmetic.
Gauss-Lobatto quadrature is a variant of Gauss quadrature that includes the endpoints of the interval ([-1, 1]) as nodes. It is exact for polynomials up to degree (2n-3). The nodes and weights are calculated using arbitrary precision.
| n | The number of quadrature points. |
| precision | The bit precision for arbitrary-precision arithmetic. Defaults to 256 bits. |
| QuadratureRule< mpf_class, Dim+1 > vulpes::qrule::mpfGrundammMoellerQuadrature | ( | std::size_t | deg, |
| std::size_t | precision ) |
Generates Grundamm-Moller quadrature rules in barycentric coordinates.
Computes a arbitrary-precision quadrature rule for a Dim-dimensional simplex using the Grundamm-Moller method. The rules are defined in barycentric coordinates. The weights may be negative.
A. Grundmann, H. M. Moller, 'Invariant integration formulas for the n-simplex by combinatorial methods', SIAM J. Numer. Anal. 15, 282-290 (1978), DOI 10.1137/0715019.
| Dim | The dimension of the simplex (e.g., 2 for triangles, 3 for tetrahedra). |
| deg | The degree of the quadrature rule (must be odd; will be adjusted if even). |
| precision | The precision used for arbitrary-precision computations (in bits). |
|
inlinestaticconstexpr |
Number of precomputed quadrature rules for tetrahedra.
|
inlinestaticconstexpr |
Number of precomputed quadrature rules for triangles.