Skip to content

Commit 743813d

Browse files
more integrator interface on stochastic
1 parent 80afc6b commit 743813d

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/StochasticDiffEq.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ module StochasticDiffEq
2626

2727
import DiffEqBase: solve, solve!, init, step!, build_solution, initialize!
2828

29-
import DiffEqBase: resize!,deleteat!,addat!,full_cache,user_cache, u_cache,du_cache,
29+
# Integrator Interface
30+
import DiffEqBase: resize!,deleteat!,addat!,full_cache,user_cache,u_cache,du_cache,
3031
resize_non_user_cache!,deleteat_non_user_cache!,addat_non_user_cache!,
31-
terminate!,get_du, get_dt,get_proposed_dt,
32+
terminate!,get_du, get_dt,get_proposed_dt,set_proposed_dt!,
3233
u_modified!,savevalues!,add_tstop!,add_saveat!,set_reltol!,
3334
set_abstol!
3435

src/integrators/integrator_interface.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ end
2828

2929
(integrator::SDEIntegrator)(val::AbstractArray,t::Union{Number,AbstractArray},deriv::Type=Val{0};idxs=nothing) = current_interpolant!(val,t,integrator,idxs,deriv)
3030

31+
function u_modified!(integrator::SDEIntegrator,bool::Bool)
32+
integrator.u_modified = bool
33+
end
34+
35+
get_proposed_dt(integrator::SDEIntegrator) = integrator.dtpropose
36+
set_proposed_dt!(integrator::SDEIntegrator,dt::Number) = (integrator.dtpropose = dt)
37+
38+
function set_proposed_dt!(integrator::SDEIntegrator,integrator2::SDEIntegrator)
39+
integrator.dtpropose = integrator2.dtpropose
40+
integrator.qold = integrator2.qold
41+
integrator.erracc = integrator2.erracc
42+
integrator.dtacc = integrator2.dtacc
43+
end
3144

3245
user_cache(integrator::SDEIntegrator) = user_cache(integrator.cache)
3346
u_cache(integrator::SDEIntegrator) = u_cache(integrator.cache)

0 commit comments

Comments
 (0)