From 76ad13ed81602745fa3a9f38627b7841b6bed1ae Mon Sep 17 00:00:00 2001 From: Alejandro Mota Date: Sun, 23 Aug 2026 12:10:17 -0700 Subject: [PATCH] Accept vector-valued per-qp kernels in the diagonal assembler A diagonal-only element kernel can now return the per-quadrature-point diagonal directly as an SVector, so the full NxN element matrix is never formed. The existing SMatrix method is untouched; the two dispatch on the kernel's return type. Signed-off-by: Alejandro Mota --- src/assemblers/Assemblers.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/assemblers/Assemblers.jl b/src/assemblers/Assemblers.jl index e80b209..57cbcee 100644 --- a/src/assemblers/Assemblers.jl +++ b/src/assemblers/Assemblers.jl @@ -44,6 +44,12 @@ end return val_e + diag_q end +# A diagonal-only element kernel returns the per-quadrature-point diagonal +# directly as an SVector, so the full N×N element matrix is never formed. +@inline function _accumulate_q_value(::AssembledDiagonal, storage, d_q::SVector{N, T}, val_e, q, e) where {N, T} + return val_e + d_q +end + @inline function _accumulate_q_value(::AssembledScalar, storage::AbstractArray{T, 3}, val_q, val_e, q, e) where T # TODO will it always be 1 for how we're using this? storage[1, q, e] = val_q