Skip to content

Commit

Permalink
Fix bcresid_prototype in TwoPointBVPFunction
Browse files Browse the repository at this point in the history
Signed-off-by: ErikQQY <[email protected]>
  • Loading branch information
ErikQQY committed Oct 8, 2023
1 parent c6623b2 commit bf167ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scimlfunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4067,8 +4067,8 @@ function BVPFunction{iip, specialize, twopoint}(f, bc;
end

if twopoint
if iip && (bcresid_prototype === nothing || length(bcresid_prototype) != 2)
error("bcresid_prototype must be a tuple / indexable collection of length 2 for a inplace TwoPointBVPFunction")
if iip && bcresid_prototype !== nothing
@assert length(bcresid_prototype) == 2 error("bcresid_prototype must be a tuple / indexable collection of length 2 for an inplace TwoPointBVPFunction")

Check warning on line 4071 in src/scimlfunctions.jl

View check run for this annotation

Codecov / codecov/patch

src/scimlfunctions.jl#L4070-L4071

Added lines #L4070 - L4071 were not covered by tests
end
if bcresid_prototype !== nothing && length(bcresid_prototype) == 2
bcresid_prototype = ArrayPartition(first(bcresid_prototype),
Expand Down
8 changes: 8 additions & 0 deletions test/function_building_error_messages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,14 @@ BVPFunction(bfiip, bciip, vjp = bvjp)

@test_throws SciMLBase.NonconformingFunctionsError BVPFunction(bfoop, bciip, vjp = bvjp)

# TwoPointBVPFunction

tpbvpf(du, u, p, t) = du .= u
tpbvpbca(resa, ua, p) = resa .= ua
tpbvpbcb(resb, ub, p) = resb .= ub
SciMLBase.TwoPointBVPFunction(tpbvpf, (tpbvpbca, tpbvpbcb))
@test_throws ErrorException SciMLBase.TwoPointBVPFunction(tpbvpf, (tpbvpbca, tpbvpbcb), bcresid_prototype = (1, 1, 1))

# IntegralFunction

ioop(u, p) = p * u
Expand Down

0 comments on commit bf167ce

Please sign in to comment.