From 2603b145780a24f796085f969f40999b80b16007 Mon Sep 17 00:00:00 2001 From: oscarddssmith Date: Wed, 21 Jun 2023 17:28:33 -0400 Subject: [PATCH] This fixes https://github.com/SciML/Sundials.jl/issues/292. It turns out we were asking for interpolated derivatives for essentially no reason (and doing so caused problems whenever you hit callbacks). As a nice side-benefit, this removes the 200 warnings --- src/common_interface/integrator_utils.jl | 6 +++--- src/common_interface/solve.jl | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/common_interface/integrator_utils.jl b/src/common_interface/integrator_utils.jl index 365f02e..c4c826f 100644 --- a/src/common_interface/integrator_utils.jl +++ b/src/common_interface/integrator_utils.jl @@ -69,7 +69,7 @@ function DiffEqBase.savevalues!(integrator::AbstractSundialsIntegrator, integrator.opts.save_idxs) push!(integrator.sol.t, integrator.t) if integrator.opts.dense - tmp = integrator(integrator.t, Val{1}) + tmp = DiffEqBase.get_du(integrator) save_value!(integrator.sol.interp.du, tmp, uType, integrator.opts.save_idxs) end @@ -151,11 +151,11 @@ function DiffEqBase.terminate!(integrator::AbstractSundialsIntegrator, integrator.opts.tstops.valtree = typeof(integrator.opts.tstops.valtree)() end -@inline function DiffEqBase.get_du(integrator::CVODEIntegrator) +@inline function DiffEqBase.get_du(integrator::AbstractSundialsIntegrator) integrator(integrator.t, Val{1}) end -@inline function DiffEqBase.get_du!(out, integrator::CVODEIntegrator) +@inline function DiffEqBase.get_du!(out, integrator::AbstractSundialsIntegrator) integrator(out, integrator.t, Val{1}) end diff --git a/src/common_interface/solve.jl b/src/common_interface/solve.jl index 1d43dd3..02e4514 100644 --- a/src/common_interface/solve.jl +++ b/src/common_interface/solve.jl @@ -1432,7 +1432,6 @@ function DiffEqBase.solve!(integrator::AbstractSundialsIntegrator; early_free = integrator.opts.save_idxs) push!(integrator.sol.t, integrator.t) if integrator.opts.dense - integrator(integrator.u, integrator.t, Val{1}) save_value!(integrator.sol.interp.du, integrator.u, uType, integrator.opts.save_idxs) end