From b720c53f435ad2f566723f87aeb9a9205dc442a8 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Wed, 11 Jun 2025 16:43:07 +0530 Subject: [PATCH 1/2] feat: implement `u_modified!` for null integrator --- src/solve.jl | 1 + test/downstream/null_de.jl | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/solve.jl b/src/solve.jl index 816b9ab6b..0fe3c421b 100644 --- a/src/solve.jl +++ b/src/solve.jl @@ -710,6 +710,7 @@ function step!(integ::NullODEIntegrator, dt = nothing, stop_at_tdt = false) end return nothing end +function SciMLBase.u_modified!(integ::NullODEIntegrator, u) end function hack_null_solution_init(prob) if SciMLBase.has_initialization_data(prob.f) diff --git a/test/downstream/null_de.jl b/test/downstream/null_de.jl index 7405091a6..902287c4f 100644 --- a/test/downstream/null_de.jl +++ b/test/downstream/null_de.jl @@ -88,3 +88,9 @@ end sol = solve(prob) @test sol.resid isa SVector{1, Float64} end + +@testset "`u_modified!` works on null integrators" begin + prob = ODEProblem(Returns(nothing), nothing, (0.0, 1.0)) + integ = init(prob, Tsit5()) + @test_nowarn SciMLBase.u_modified!(integ, Float64[]) +end From 950b26db232b2fb8014ba34dd6aab4614d1222d4 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Wed, 11 Jun 2025 17:27:29 +0530 Subject: [PATCH 2/2] feat: implement `SciMLBase.check_error` for null integrator --- src/solve.jl | 1 + test/downstream/null_de.jl | 1 + 2 files changed, 2 insertions(+) diff --git a/src/solve.jl b/src/solve.jl index 0fe3c421b..de102cc3b 100644 --- a/src/solve.jl +++ b/src/solve.jl @@ -711,6 +711,7 @@ function step!(integ::NullODEIntegrator, dt = nothing, stop_at_tdt = false) return nothing end function SciMLBase.u_modified!(integ::NullODEIntegrator, u) end +SciMLBase.check_error(integ::NullODEIntegrator) = integ.sol.retcode function hack_null_solution_init(prob) if SciMLBase.has_initialization_data(prob.f) diff --git a/test/downstream/null_de.jl b/test/downstream/null_de.jl index 902287c4f..2ebd505c3 100644 --- a/test/downstream/null_de.jl +++ b/test/downstream/null_de.jl @@ -93,4 +93,5 @@ end prob = ODEProblem(Returns(nothing), nothing, (0.0, 1.0)) integ = init(prob, Tsit5()) @test_nowarn SciMLBase.u_modified!(integ, Float64[]) + @test SciMLBase.successful_retcode(SciMLBase.check_error(integ)) end