Skip to content

Commit 76a2792

Browse files
Merge pull request #39 from SciML/saveat_tstop
add saveat tstop robustness
2 parents 2552417 + c9594bc commit 76a2792

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/solve.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function DiffEqBase.__init(prob::AbstractSDDEProblem,# TODO DiffEqBasee.Abstract
2121
DiffEqBase.has_analytic(prob.f[1]) : DiffEqBase.has_analytic(prob.f)),
2222
save_on = true,
2323
save_start = save_everystep || isempty(saveat) || typeof(saveat) <: Number ? true : prob.tspan[1] in saveat,
24-
save_end = save_everystep || isempty(saveat) || typeof(saveat) <: Number ? true : prob.tspan[2] in saveat,
24+
save_end = nothing,
2525
callback = nothing,
2626
dense = save_everystep && isempty(saveat),
2727
calck = (!isempty(setdiff(saveat, tstops)) || dense),
@@ -331,6 +331,9 @@ function DiffEqBase.__init(prob::AbstractSDDEProblem,# TODO DiffEqBasee.Abstract
331331
# id = StochasticDiffEq.LinearInterpolationData(timeseries,ts)
332332
id = StochasticDiffEq.LinearInterpolationData(sde_integrator.sol.u, sde_integrator.sol.t)
333333

334+
save_end_user = save_end
335+
save_end = save_end === nothing ? save_everystep || isempty(saveat) || saveat isa Number || prob.tspan[2] in saveat : save_end
336+
334337
opts = StochasticDiffEq.SDEOptions(maxiters, save_everystep,
335338
adaptive, abstol_internal,
336339
reltol_internal, QT(gamma),
@@ -347,7 +350,7 @@ function DiffEqBase.__init(prob::AbstractSDDEProblem,# TODO DiffEqBasee.Abstract
347350
QT(beta1), QT(beta2),
348351
convert.(uBottomEltypeNoUnits, delta),
349352
QT(qoldinit),
350-
dense, save_on, save_start, save_end, save_noise,
353+
dense, save_on, save_start, save_end, save_end_user, save_noise,
351354
callbacks_internal, isoutofdomain, unstable_check,
352355
verbose, calck, force_dtmin,
353356
advance_to_tstop, stop_at_next_tstop)

0 commit comments

Comments
 (0)