Skip to content

Commit

Permalink
Fix Dispatches if Differential Equations is loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Sep 28, 2023
1 parent aea5795 commit 8924e95
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/BoundaryValueDiffEq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ import SparseDiffTools: AbstractSparseADType
import TruncatedStacktraces: @truncate_stacktrace
import UnPack: @unpack

function SciMLBase.__solve(prob::BVProblem, alg; kwargs...)
# If dispatch not directly defined
cache = init(prob, alg; kwargs...)
return solve!(cache)
end

include("types.jl")
include("utils.jl")
include("algorithms.jl")
Expand All @@ -34,6 +28,12 @@ include("solve/mirk.jl")
include("adaptivity.jl")
include("interpolation.jl")

function SciMLBase.__solve(prob::BVProblem, alg::BoundaryValueDiffEqAlgorithm, args...;
kwargs...)
cache = init(prob, alg, args...; kwargs...)
return solve!(cache)
end

export Shooting
export MIRK2, MIRK3, MIRK4, MIRK5, MIRK6
export MIRKJacobianComputationAlgorithm
Expand Down
4 changes: 2 additions & 2 deletions src/solve/mirk.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function SciMLBase.__init(prob::BVProblem, alg::AbstractMIRK; dt = 0.0, abstol = 1e-3,
adaptive = true, kwargs...)
function SciMLBase.__init(prob::BVProblem, alg::AbstractMIRK; dt = 0.0,
abstol = 1e-3, adaptive = true, kwargs...)
has_initial_guess = prob.u0 isa AbstractVector{<:AbstractArray}
iip = isinplace(prob)
(T, M, n) = if has_initial_guess
Expand Down
1 change: 0 additions & 1 deletion src/solve/single_shooting.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# TODO: Differentiate between nlsolve kwargs and odesolve kwargs
# TODO: Add in u0/p into `__solve`: Needed for differentiation
# TODO: Support Non-Vector Inputs
function SciMLBase.__solve(prob::BVProblem, alg::Shooting; kwargs...)
iip = isinplace(prob)
Expand Down

0 comments on commit 8924e95

Please sign in to comment.