Skip to content

Commit

Permalink
refactor: depend on OrdinaryDiffEqCore for _initialize_dae!
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Nov 27, 2024
1 parent 9a0733b commit d8cfa88
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221"
NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RandomNumbers = "e6cf234a-135c-5ec9-84dd-332b85af5143"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
Expand Down Expand Up @@ -48,6 +49,7 @@ Logging = "1.6"
MuladdMacro = "0.2.1"
NLsolve = "4"
OrdinaryDiffEq = "6.87"
OrdinaryDiffEqCore = "1"
Random = "1.6"
RandomNumbers = "1.5.3"
RecursiveArrayTools = "2, 3"
Expand Down
2 changes: 2 additions & 0 deletions src/StochasticDiffEq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ using OrdinaryDiffEq: nlsolvefail, isnewton, set_new_W!, get_W, _vec, _reshape

using OrdinaryDiffEq: NLSolver

import OrdinaryDiffEqCore

if isdefined(OrdinaryDiffEq,:FastConvergence)
using OrdinaryDiffEq:
FastConvergence, Convergence, SlowConvergence, VerySlowConvergence, Divergence
Expand Down
8 changes: 4 additions & 4 deletions src/initialize_dae.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
struct SDEDefaultInit <: DiffEqBase.DAEInitializationAlgorithm end

function DiffEqBase.initialize_dae!(integrator::SDEIntegrator, initializealg = integrator.initializealg)
OrdinaryDiffEq._initialize_dae!(integrator, integrator.sol.prob, initializealg, Val(DiffEqBase.isinplace(integrator.sol.prob)))
OrdinaryDiffEqCore._initialize_dae!(integrator, integrator.sol.prob, initializealg, Val(DiffEqBase.isinplace(integrator.sol.prob)))
end

function OrdinaryDiffEq._initialize_dae!(integrator::SDEIntegrator, prob, ::SDEDefaultInit, isinplace)
function OrdinaryDiffEqCore._initialize_dae!(integrator::SDEIntegrator, prob, ::SDEDefaultInit, isinplace)
if SciMLBase.has_initializeprob(prob.f)
OrdinaryDiffEq._initialize_dae!(integrator, prob, SciMLBase.OverrideInit(), isinplace)
OrdinaryDiffEqCore._initialize_dae!(integrator, prob, SciMLBase.OverrideInit(), isinplace)
else
OrdinaryDiffEq._initialize_dae!(integrator, prob, SciMLBase.CheckInit(), isinplace)
OrdinaryDiffEqCore._initialize_dae!(integrator, prob, SciMLBase.CheckInit(), isinplace)
end
end

0 comments on commit d8cfa88

Please sign in to comment.