From ce6df896aad7fae9d4e186a1f6ea9a94988de00a Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Fri, 22 Nov 2024 12:41:48 +0530 Subject: [PATCH] refactor: add backward compat wrapper --- src/remake.jl | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/remake.jl b/src/remake.jl index 42f9c82d0..92829281d 100644 --- a/src/remake.jl +++ b/src/remake.jl @@ -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 @@ -202,6 +202,20 @@ 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)