Skip to content

Commit

Permalink
feat: add initialization support
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Nov 29, 2024
1 parent 4912067 commit aa87692
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/integrators/type.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ end
mutable struct SDDEIntegrator{algType, IIP, uType, uEltype, tType, P, eigenType,
tTypeNoUnits, uEltypeNoUnits, randType, randType2, rateType,
solType, cacheType, F, G, F6, OType, noiseType,
EventErrorType, CallbackCacheType, H, IType} <:
EventErrorType, CallbackCacheType, H, IType, IA} <:
AbstractSDDEIntegrator{algType, IIP, uType, tType}
f::F
g::G
Expand Down Expand Up @@ -81,6 +81,7 @@ mutable struct SDDEIntegrator{algType, IIP, uType, uEltype, tType, P, eigenType,
history::H
stats::DiffEqBase.Stats
integrator::IType # history integrator
initializealg::IA
end

function (integrator::SDDEIntegrator)(t, deriv::Type = Val{0}; idxs = nothing)
Expand Down
8 changes: 5 additions & 3 deletions src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ function DiffEqBase.__init(prob::AbstractSDDEProblem,# TODO DiffEqBasee.Abstract
# Keywords for Delay problems (from DDE)
discontinuity_interp_points::Int = 10,
discontinuity_abstol = eltype(prob.tspan)(1 // Int64(10)^12),
discontinuity_reltol = 0, kwargs...) where {recompile_flag}
discontinuity_reltol = 0,
initializealg = StochasticDiffEq.SDEDefaultInit(), kwargs...) where {recompile_flag}

# alg = getalg(alg0);
if prob.f isa Tuple
Expand Down Expand Up @@ -468,7 +469,7 @@ function DiffEqBase.__init(prob::AbstractSDDEProblem,# TODO DiffEqBasee.Abstract
typeof(c),
typeof(opts), typeof(noise), typeof(last_event_error),
typeof(callback_cache), typeof(history),
typeof(sde_integrator)}(f_with_history,
typeof(sde_integrator), typeof(initializealg)}(f_with_history,
g_with_history, c, noise, uprev,
tprev,
order_discontinuity_t0,
Expand All @@ -486,9 +487,10 @@ function DiffEqBase.__init(prob::AbstractSDDEProblem,# TODO DiffEqBasee.Abstract
P,
opts, iter, success_iter, eigen_est,
EEst, q, QT(qoldinit), q11, history,
stats, sde_integrator)
stats, sde_integrator, initializealg)

if initialize_integrator
DiffEqBase.initialize_dae!(integrator)
StochasticDiffEq.initialize_callbacks!(integrator, initialize_save)
initialize!(integrator, integrator.cache)

Expand Down

0 comments on commit aa87692

Please sign in to comment.