Rodin/Variational/QuadratureRule.h file

Quadrature rule classes for numerical integration.

This file defines specializations of Rodin::Variational::QuadratureRule for integrating functions and shape-function expressions over mesh polytopes.

Mathematical foundation

A quadrature rule approximates an integral by a weighted sum:

\[ \int_K f(x)\,dx \approx \sum_{q=1}^{n_q} w_q\,f(x_q), \]

where:

  • $ x_q $ are quadrature points,
  • $ w_q $ are quadrature weights,
  • $ n_q $ is the number of quadrature points.

In Rodin, the reference quadrature formula lives in the QF module, while the mapped geometric points live in PolytopeQuadrature. This separation allows:

  • canonical reuse of reference quadrature formulas,
  • integrator-owned mapped points for the currently bound polytope,
  • bounded mapped-point storage during a one-pass mesh traversal.

Usage

Typical usage is:

auto qr = QuadratureRule(integrand);
qr.setPolytope(cell);
const auto value = qr.compute();

For local element integrators, setPolytope() binds the integrator to a concrete polytope, selects an appropriate quadrature formula, and owns the corresponding PolytopeQuadrature until the next bind or destruction. Moving a rule transfers this ownership without relocating the mapped points. Copying a rule does not copy its polytope binding. For $ T $ active rules with at most $ Q $ points per cell, mapped-point storage is $ O(TQ) $ , independent of the number of traversed cells. The public mesh-owned quadrature cache remains available to callers that intentionally require stable borrowed quadratures across multiple cells; assembly neither evicts nor invalidates those objects. These lifetimes are independent of the assembly backend and require no collective operation.

Namespaces

namespace Rodin
The Rodin library for finite element methods and shape optimization.
namespace Rodin::Variational
Finite element spaces, fields, and variational problems.

Classes

template<class FunctionDerived>
class Rodin::Variational::QuadratureRule<FunctionBase<FunctionDerived>>
Quadrature rule for integrating general functions on mesh polytopes.
template<class FES, class Data>
class Rodin::Variational::QuadratureRule<GridFunction<FES, Data>>
Integration of a scalar grid function over a mesh region.
template<class LHSDerived, class TrialFES, class RHSDerived, class TestFES>
class Rodin::Variational::QuadratureRule<Dot<ShapeFunctionBase<LHSDerived, TrialFES, TrialSpace>, ShapeFunctionBase<RHSDerived, TestFES, TestSpace>>>
Local bilinear-form quadrature for the dot product of a trial and a test shape function.
template<class NestedDerived, class FES>
class Rodin::Variational::QuadratureRule<ShapeFunctionBase<NestedDerived, FES, TestSpace>>
Local linear-form quadrature for a test shape function expression.