From eb6e3c1a3edce07f10c0ec645a4923d338f16e56 Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Sat, 24 Aug 2024 18:29:13 +0200 Subject: [PATCH] use inplace version of function --- src/semidiscretization.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/semidiscretization.jl b/src/semidiscretization.jl index ae54f562..f89a0bd8 100644 --- a/src/semidiscretization.jl +++ b/src/semidiscretization.jl @@ -144,6 +144,9 @@ function integrate_quantity!(quantity, func, q, semi::Semidiscretization) integrate(quantity, semi) end +# Obtain the function, which has an additional `!` appended to the name +inplace_version(f) = getfield(@__MODULE__, Symbol(string(nameof(f)) * "!")) + # The entropy/energy of the Svärd-Kalisch and Serre-Green-Naghdi equations # takes the whole `q` for every point in space since it requires # the derivative of the velocity `v_x`. @@ -151,7 +154,7 @@ function integrate_quantity!(quantity, func::Union{typeof(energy_total_modified), typeof(entropy_modified)}, q, semi::Semidiscretization) - energy_total_modified!(quantity, q, semi.equations, semi.cache) + inplace_version(func)(quantity, q, semi.equations, semi.cache) integrate(quantity, semi) end