Skip to content

Commit

Permalink
Fix isinplace check for bc
Browse files Browse the repository at this point in the history
Signed-off-by: ErikQQY <[email protected]>
  • Loading branch information
ErikQQY committed Apr 14, 2024
1 parent 031898a commit 7fc3288
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/problems/bvp_problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -342,5 +342,5 @@ function SecondOrderBVProblem(f, bc, u0, tspan, p = NullParameters(); kwargs...)
end

function SecondOrderBVProblem(f::AbstractBVPFunction, u0, tspan, p = NullParameters(); kwargs...)
return SecondOrderBVProblem{isinplace(f)}(f, u0, tspan, p; kwargs...)
return SecondOrderBVProblem{isinplace(f, 5)}(f, u0, tspan, p; kwargs...)

Check warning on line 345 in src/problems/bvp_problems.jl

View check run for this annotation

Codecov / codecov/patch

src/problems/bvp_problems.jl#L344-L345

Added lines #L344 - L345 were not covered by tests
end
7 changes: 5 additions & 2 deletions src/scimlfunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3751,8 +3751,11 @@ function BVPFunction{iip, specialize, twopoint}(f, bc;
end

bciip = if !twopoint
# bc in SecondOrderBVProblem should have 5 arguments
isinplace(f, 5) ? isinplace(bc, 5, "bc", iip) : isinplace(bc, 4, "bc", iip)
try
isinplace(bc, 4, "bc", iip)
catch e
isinplace(bc, 5, "bc", iip)
end
else
@assert length(bc) == 2
bc = Tuple(bc)
Expand Down
2 changes: 1 addition & 1 deletion test/function_building_error_messages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ bcjac(u, p, t) = [1.0]
bciip,
jac = bjac,
bcjac = bcjac)
@test_throws SciMLBase.TooFewArgumentsError BVPFunction(bfoop,
@test_throws SciMLBase.NonconformingFunctionsError BVPFunction(bfoop,
bciip,
jac = bjac,
bcjac = bcjac)
Expand Down

0 comments on commit 7fc3288

Please sign in to comment.