Skip to content

Commit e313903

Browse files
Merge pull request SciML#728 from ErikQQY/qqy/twopoint_val
Fix twopoint Val for SecondOrderBVProblem
2 parents c2fb81f + 168db5d commit e313903

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/problems/bvp_problems.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,21 @@ struct SecondOrderBVProblem{uType, tType, isinplace, nlls, P, F, PT, K} <:
354354
kwargs::K
355355

356356
@add_kwonly function SecondOrderBVProblem{iip}(
357-
f::DynamicalBVPFunction{iip, TP}, u0, tspan,
357+
f::DynamicalBVPFunction{iip, specialize, TP}, u0, tspan,
358358
p = NullParameters(); problem_type = nothing, nlls = nothing,
359-
kwargs...) where {iip, TP}
359+
kwargs...) where {iip, specialize, TP}
360360
_u0 = prepare_initial_state(u0)
361361
_tspan = promote_tspan(tspan)
362362
warn_paramtype(p)
363+
prob_type = TP ? TwoPointSecondOrderBVProblem{iip}() : StandardSecondOrderBVProblem()
363364

365+
# Needed to ensure that `problem_type` doesn't get passed in kwargs
366+
if problem_type === nothing
367+
problem_type = prob_type
368+
else
369+
@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."
370+
end
371+
364372
return new{typeof(_u0), typeof(_tspan), iip, typeof(nlls), typeof(p), typeof(f),
365373
typeof(problem_type), typeof(kwargs)}(f, _u0, _tspan, p, problem_type, kwargs)
366374
end

src/scimlfunctions.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,7 +1973,7 @@ BVPFunction{iip, specialize}(f, bc;
19731973
colorvec = __has_colorvec(f) ? f.colorvec : nothing,
19741974
bccolorvec = __has_colorvec(f) ? bc.colorvec : nothing,
19751975
sys = __has_sys(f) ? f.sys : nothing,
1976-
twopoint::Union{Val, Bool} = Val(false)
1976+
twopoint::Union{Val, Bool} = Val(false))
19771977
```
19781978
19791979
Note that both the function `f` and boundary condition `bc` are required. `f` should
@@ -2094,7 +2094,8 @@ DynamicalBVPFunction{iip,specialize}(f, bc;
20942094
sparsity = __has_sparsity(f) ? f.sparsity : jac_prototype,
20952095
paramjac = __has_paramjac(f) ? f.paramjac : nothing,
20962096
colorvec = __has_colorvec(f) ? f.colorvec : nothing,
2097-
sys = __has_sys(f) ? f.sys : nothing)
2097+
sys = __has_sys(f) ? f.sys : nothing
2098+
twopoint::Union{Val, Bool} = Val(false))
20982099
```
20992100
21002101
Note that only the functions `f_i` themselves are required. These functions should

0 commit comments

Comments
 (0)