diff --git a/src/common_interface/solve.jl b/src/common_interface/solve.jl index 004fbdd..a1cb3c0 100644 --- a/src/common_interface/solve.jl +++ b/src/common_interface/solve.jl @@ -483,8 +483,12 @@ function DiffEqBase.__init(prob::DiffEqBase.AbstractODEProblem{uType, tupType, i save_everystep = isempty(saveat), save_idxs = nothing, dense = save_everystep, save_on = true, - save_start = true, - save_end = true, + save_start = save_everystep || isempty(saveat) || + saveat isa Number ? true : + prob.tspan[1] in saveat, + save_end = save_everystep || isempty(saveat) || + saveat isa Number ? true : + prob.tspan[2] in saveat, save_timeseries = nothing, progress = false, progress_steps = 1000, @@ -1415,7 +1419,7 @@ function DiffEqBase.solve!(integrator::AbstractSundialsIntegrator; early_free = integrator.userfun.p = integrator.p solver_step(integrator, tstop) integrator.t = first(integrator.tout) - # NB: CVode, ARKode may warn and then recover if integrator.t == integrator.tprev so don't flag this as an error + # NB: CVode, ARKode may warn and then recover if integrator.t == integrator.tprev so don't flag this as an error integrator.flag < 0 && break handle_callbacks!(integrator) # this also updates the interpolation integrator.flag < 0 && break