Skip to content

Commit 7974f6c

Browse files
callback initialize and retcodes
1 parent c21f941 commit 7974f6c

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/StochasticDiffEq.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ module StochasticDiffEq
1111

1212
using Compat
1313

14-
import DiffEqBase: solve, solve!, init, step!, build_solution
14+
import DiffEqBase: solve, solve!, init, step!, build_solution, initialize!
1515

1616
import DiffEqBase: resize!,deleteat!,addat!,full_cache,user_cache, u_cache,du_cache,
1717
resize_non_user_cache!,deleteat_non_user_cache!,addat_non_user_cache!,
18-
terminate!,get_du, get_dt,get_proposed_dt,modify_proposed_dt!,
18+
terminate!,get_du, get_dt,get_proposed_dt,
1919
u_modified!,savevalues!,add_tstop!,add_saveat!,set_reltol!,
2020
set_abstol!
2121

src/integrators/integrator_utils.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,23 @@ end
4949
warn("Max Iters Reached. Aborting")
5050
end
5151
postamble!(integrator)
52+
integrator.sol.retcode = :MaxIters
5253
return integrator.sol
5354
end
5455
if !integrator.opts.force_dtmin && integrator.opts.adaptive && abs(integrator.dt) <= abs(integrator.opts.dtmin)
5556
if integrator.opts.verbose
5657
warn("dt <= dtmin. Aborting. If you would like to force continuation with dt=dtmin, set force_dtmin=true")
5758
end
5859
postamble!(integrator)
60+
integrator.sol.retcode = :DtLessThanMin
5961
return integrator.sol
6062
end
6163
if integrator.opts.unstable_check(integrator.dt,integrator.t,integrator.u)
6264
if integrator.opts.verbose
6365
warn("Instability detected. Aborting")
6466
end
6567
postamble!(integrator)
68+
integrator.sol.retcode = :Unstable
6669
return integrator.sol
6770
end
6871
end

src/solve.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ function init{uType,tType,isinplace,NoiseClass,F,F2,F3,algType<:AbstractSDEAlgor
271271
tTypeNoUnits(qoldinit),q11)
272272
if initialize_integrator
273273
initialize!(integrator,integrator.cache)
274+
initialize!(callbacks_internal,t,u,integrator)
274275
end
275276
integrator
276277
end
@@ -293,5 +294,6 @@ function solve!(integrator::SDEIntegrator)
293294
if typeof(integrator.sol.prob) <: AbstractSDETestProblem
294295
calculate_solution_errors!(integrator.sol;timeseries_errors=integrator.opts.timeseries_errors,dense_errors=integrator.opts.dense_errors)
295296
end
296-
integrator.sol
297+
integrator.sol.retcode = :Success
298+
nothing
297299
end

0 commit comments

Comments
 (0)