diff --git a/src/problems/bvp_problems.jl b/src/problems/bvp_problems.jl index 03c88ba49..fa53bc5fb 100644 --- a/src/problems/bvp_problems.jl +++ b/src/problems/bvp_problems.jl @@ -354,13 +354,21 @@ struct SecondOrderBVProblem{uType, tType, isinplace, nlls, P, F, PT, K} <: kwargs::K @add_kwonly function SecondOrderBVProblem{iip}( - f::DynamicalBVPFunction{iip, TP}, u0, tspan, + f::DynamicalBVPFunction{iip, specialize, TP}, u0, tspan, p = NullParameters(); problem_type = nothing, nlls = nothing, - kwargs...) where {iip, TP} + kwargs...) where {iip, specialize, TP} _u0 = prepare_initial_state(u0) _tspan = promote_tspan(tspan) warn_paramtype(p) + prob_type = TP ? TwoPointSecondOrderBVProblem{iip}() : StandardSecondOrderBVProblem() + # Needed to ensure that `problem_type` doesn't get passed in kwargs + if problem_type === nothing + problem_type = prob_type + else + @assert prob_type===problem_type "This indicates incorrect problem type specification! Users should never pass in `problem_type` kwarg, this exists exclusively for internal use." + end + return new{typeof(_u0), typeof(_tspan), iip, typeof(nlls), typeof(p), typeof(f), typeof(problem_type), typeof(kwargs)}(f, _u0, _tspan, p, problem_type, kwargs) end diff --git a/src/scimlfunctions.jl b/src/scimlfunctions.jl index becff1bf9..2ef61a53d 100644 --- a/src/scimlfunctions.jl +++ b/src/scimlfunctions.jl @@ -1973,7 +1973,7 @@ BVPFunction{iip, specialize}(f, bc; colorvec = __has_colorvec(f) ? f.colorvec : nothing, bccolorvec = __has_colorvec(f) ? bc.colorvec : nothing, sys = __has_sys(f) ? f.sys : nothing, - twopoint::Union{Val, Bool} = Val(false) + twopoint::Union{Val, Bool} = Val(false)) ``` Note that both the function `f` and boundary condition `bc` are required. `f` should @@ -2094,7 +2094,8 @@ DynamicalBVPFunction{iip,specialize}(f, bc; sparsity = __has_sparsity(f) ? f.sparsity : jac_prototype, paramjac = __has_paramjac(f) ? f.paramjac : nothing, colorvec = __has_colorvec(f) ? f.colorvec : nothing, - sys = __has_sys(f) ? f.sys : nothing) + sys = __has_sys(f) ? f.sys : nothing + twopoint::Union{Val, Bool} = Val(false)) ``` Note that only the functions `f_i` themselves are required. These functions should