Skip to content

Commit

Permalink
use inplace version of function
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaLampert committed Aug 24, 2024
1 parent b62ead0 commit eb6e3c1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/semidiscretization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,17 @@ 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`.
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

Expand Down

0 comments on commit eb6e3c1

Please sign in to comment.