From 59ff3be59bb1f2c0246795c17c5affa4047b2c8e Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Sat, 9 May 2026 18:20:11 +0300 Subject: [PATCH] docs(quadrature): explain Tuple wrap in integration_points Clarify why `integration_points` converts the quadrature `SVector` to a `Tuple` for downstream destructuring while noting compile-time stack usage. - Refresh comments around `default_quadrature` / `_quadrature_topology_type`. --- src/quadrature/gauss.jl | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/quadrature/gauss.jl b/src/quadrature/gauss.jl index 3e5e42d..3cbec53 100644 --- a/src/quadrature/gauss.jl +++ b/src/quadrature/gauss.jl @@ -12,18 +12,19 @@ Gauss-Legendre integration using new quadrature API. Return integration points for the given topology using default quadrature rule. """ function integration_points(topology::T) where {T<:AbstractTopology} - # Get default quadrature rule for this topology (uses node count to infer order) + # Default quadrature rule for this topology (basis order inferred + # from node count via `_infer_basis_order`). rule = default_quadrature(T) - + # Map parametric topology type to generic quadrature type - # E.g., Hexahedron{8} → Hexahedron, Triangle{3} → Triangle + # (e.g. Hexahedron{8} → Hexahedron, Triangle{3} → Triangle). quad_topo = _quadrature_topology_type(T) - - # Get points using new API: get_quadrature_points(Hexahedron, GaussLegendre{2}()) - # Returns: SVector{N, QuadraturePoint{D,Float64}} + + # Returns SVector{N, QuadraturePoint{D,Float64}}. Wrapping in a + # `Tuple` keeps the return type `NTuple{N, QuadraturePoint{...}}` + # so call sites can still splat / destructure; for the small N + # used here the conversion compiles to a stack-only construction. quad_points = get_quadrature_points(quad_topo, rule) - - # Convert SVector to Tuple (zero-allocation) return Tuple(quad_points) end