From bf167ce3927878bfa83b6c65ea50db54b6b6d6f8 Mon Sep 17 00:00:00 2001 From: ErikQQY <2283984853@qq.com> Date: Sun, 8 Oct 2023 14:44:13 +0800 Subject: [PATCH] Fix bcresid_prototype in TwoPointBVPFunction Signed-off-by: ErikQQY <2283984853@qq.com> --- src/scimlfunctions.jl | 4 ++-- test/function_building_error_messages.jl | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/scimlfunctions.jl b/src/scimlfunctions.jl index 391859e20..b3949a96a 100644 --- a/src/scimlfunctions.jl +++ b/src/scimlfunctions.jl @@ -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") end if bcresid_prototype !== nothing && length(bcresid_prototype) == 2 bcresid_prototype = ArrayPartition(first(bcresid_prototype), diff --git a/test/function_building_error_messages.jl b/test/function_building_error_messages.jl index 924c342e5..5c6e189a7 100644 --- a/test/function_building_error_messages.jl +++ b/test/function_building_error_messages.jl @@ -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