Skip to content

Commit

Permalink
refactor: add backward compat wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Nov 22, 2024
1 parent e07a234 commit 9c09207
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/remake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function remake(prob::ODEProblem; f = missing,

if f === missing
if build_initializeprob
initialization_data = remake_initialization_data(
initialization_data = remake_initialization_data_compat_wrapper(
prob.f.sys, prob.f, u0, tspan[1], p, newu0, newp)
else
initialization_data = nothing
Expand Down Expand Up @@ -202,6 +202,21 @@ function remake_initializeprob(sys, scimlfn, u0, t0, p)
scimlfn.update_initializeprob!, scimlfn.initializeprobmap, scimlfn.initializeprobpmap
end

"""
$(TYPEDSIGNATURES)
Wrapper around `remake_initialization_data` for backward compatibility when `newu0` and
`newp` were not arguments.
"""
function remake_initialization_data_compat_wrapper(sys, scimlfn, u0, t0, p, newu0, newp)
if hasmethod(remake_initialization_data,
Tuple{typeof(sys), typeof(scimlfn), typeof(u0), typeof(t0), typeof(p)})
remake_initialization_data(sys, scimlfn, u0, t0, p)
else
remake_initialization_data(sys, scimlfn, u0, t0, p, newu0, newp)
end
end

"""
remake_initialization_data(sys, scimlfn, u0, t0, p, newu0, newp)
Expand Down

0 comments on commit 9c09207

Please sign in to comment.