Skip to content

Commit 6491c17

Browse files
refactor: use build_function_wrapper for history functions
1 parent 5637a0c commit 6491c17

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/systems/diffeqs/abstractodesystem.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,9 @@ end
818818

819819
function generate_history(sys::AbstractODESystem, u0; expression = Val{false}, kwargs...)
820820
p = reorder_parameters(sys, parameters(sys))
821-
build_function(u0, p..., get_iv(sys); expression, kwargs...)
821+
build_function_wrapper(
822+
sys, u0, p..., get_iv(sys); expression, p_start = 1, p_end = length(p),
823+
similarto = typeof(u0), wrap_delays = false, kwargs...)
822824
end
823825

824826
function DiffEqBase.DDEProblem(sys::AbstractODESystem, args...; kwargs...)
@@ -842,8 +844,7 @@ function DiffEqBase.DDEProblem{iip}(sys::AbstractODESystem, u0map = [],
842844
check_length, eval_expression, eval_module, kwargs...)
843845
h_gen = generate_history(sys, u0; expression = Val{true})
844846
h_oop, h_iip = eval_or_rgf.(h_gen; eval_expression, eval_module)
845-
h(p, t) = h_oop(p, t)
846-
h(p::MTKParameters, t) = h_oop(p..., t)
847+
h = h_oop
847848
u0 = float.(h(p, tspan[1]))
848849
if u0 !== nothing
849850
u0 = u0_constructor(u0)
@@ -881,10 +882,7 @@ function DiffEqBase.SDDEProblem{iip}(sys::AbstractODESystem, u0map = [],
881882
check_length, kwargs...)
882883
h_gen = generate_history(sys, u0; expression = Val{true})
883884
h_oop, h_iip = eval_or_rgf.(h_gen; eval_expression, eval_module)
884-
h(out, p, t) = h_iip(out, p, t)
885-
h(p, t) = h_oop(p, t)
886-
h(p::MTKParameters, t) = h_oop(p..., t)
887-
h(out, p::MTKParameters, t) = h_iip(out, p..., t)
885+
h = h_oop
888886
u0 = h(p, tspan[1])
889887
if u0 !== nothing
890888
u0 = u0_constructor(u0)

0 commit comments

Comments
 (0)