Skip to content

Commit b5f5ef8

Browse files
Simplify dispatch
1 parent a256536 commit b5f5ef8

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

perf/flame.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ end
3535
p = @allocated do_work!(integrator, cache)
3636
using Test
3737
@testset "Allocations" begin
38-
@test_broken p == 0
38+
@test p == 0
3939
end
4040

4141
import ProfileCanvas

src/solvers/imex_ark.jl

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,10 @@ function init_cache(prob::DiffEqBase.AbstractODEProblem, alg::IMEXAlgorithm{Unco
4545
return IMEXARKCache(U, T_lim, T_exp, T_imp, temp, γ, newtons_method_cache)
4646
end
4747

48-
step_u!(integrator, cache::IMEXARKCache) = step_u!(integrator, cache, integrator.sol.prob.f, integrator.alg.name)
49-
50-
# include("hard_coded_ars343.jl")
5148
# generic fallback
52-
function step_u!(integrator, cache::IMEXARKCache, f, name)
49+
function step_u!(integrator, cache::IMEXARKCache)
5350
(; u, p, t, dt, alg) = integrator
51+
(; f) = integrator.sol.prob
5452
(; post_explicit!, post_implicit!) = f
5553
(; T_lim!, T_exp!, T_imp!, lim!, dss!) = f
5654
(; tableau, newtons_method) = alg
@@ -107,11 +105,10 @@ function step_u!(integrator, cache::IMEXARKCache, f, name)
107105
@. temp = U
108106
post_explicit!(U, p, t_imp)
109107
# TODO: can/should we remove these closures?
110-
implicit_equation_residual! =
111-
(residual, Ui) -> begin
112-
T_imp!(residual, Ui, p, t_imp)
113-
@. residual = temp + dt * a_imp[i, i] * residual - Ui
114-
end
108+
implicit_equation_residual! = (residual, Ui) -> begin
109+
T_imp!(residual, Ui, p, t_imp)
110+
@. residual = temp + dt * a_imp[i, i] * residual - Ui
111+
end
115112
implicit_equation_jacobian! = (jacobian, Ui) -> T_imp!.Wfact(jacobian, Ui, p, dt * a_imp[i, i], t_imp)
116113
call_post_implicit! = Ui -> begin
117114
post_implicit!(Ui, p, t_imp)

src/solvers/imex_ssprk.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ function init_cache(prob::DiffEqBase.AbstractODEProblem, alg::IMEXAlgorithm{SSP}
5252
return IMEXSSPRKCache(U, U_exp, U_lim, T_lim, T_exp, T_imp, temp, β, γ, newtons_method_cache)
5353
end
5454

55-
step_u!(integrator, cache::IMEXSSPRKCache) = step_u!(integrator, cache, integrator.sol.prob.f, integrator.alg.name)
56-
57-
function step_u!(integrator, cache::IMEXSSPRKCache, f, name)
55+
function step_u!(integrator, cache::IMEXSSPRKCache)
5856
(; u, p, t, dt, alg) = integrator
57+
(; f) = integrator.sol.prob
5958
(; post_explicit!, post_implicit!) = f
6059
(; T_lim!, T_exp!, T_imp!, lim!, dss!) = f
6160
(; tableau, newtons_method) = alg

0 commit comments

Comments
 (0)