From 01887001062b6c7511adeab79ef0e1f875ab6ff9 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Fri, 6 Dec 2024 17:06:11 +0530 Subject: [PATCH] fixup! feat: retain `prob.f.sys` when `remake`ing `SDEProblem` --- src/remake.jl | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/remake.jl b/src/remake.jl index b53caffd2..02cc33cb8 100644 --- a/src/remake.jl +++ b/src/remake.jl @@ -401,6 +401,13 @@ function remake(func::Union{SDEFunction, SDDEFunction}; analytic = missing, sys = missing, kwargs...) + props = getproperties(func) + props = @delete props.f + props = @delete props.g + @reset props.mass_matrix = coalesce(mass_matrix, func.mass_matrix) + @reset props.analytic = coalesce(analytic, func.analytic) + @reset props.sys = coalesce(sys, func.sys) + if f === missing f = func.f end @@ -409,20 +416,12 @@ function remake(func::Union{SDEFunction, SDDEFunction}; g = func.g end - if mass_matrix === missing - mass_matrix = func.mass_matrix - end - - if analytic === missing - analytic = func.analytic - end - - if sys === missing - sys = func.sys + if f isa AbstractSciMLFunction + f = f.f end T = func isa SDEFunction ? SDEFunction : SDDEFunction - return T(f, g; mass_matrix, analytic, sys, kwargs...) + return T(f, g; props..., kwargs...) end function remake(prob::DDEProblem; f = missing, h = missing, u0 = missing,