From 83f8c3d43efc67219077b627038e5bacde8358fc Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Mon, 18 Nov 2024 19:46:49 +0530 Subject: [PATCH] fix: fix SII implementation for `NonlinearSolveNoInitCache` (#506) Co-authored-by: Christopher Rackauckas --- lib/NonlinearSolveBase/src/solve.jl | 2 ++ test/mtk_cache_indexing_tests.jl | 3 +++ 2 files changed, 5 insertions(+) diff --git a/lib/NonlinearSolveBase/src/solve.jl b/lib/NonlinearSolveBase/src/solve.jl index e4dd33636..66ad6a0e4 100644 --- a/lib/NonlinearSolveBase/src/solve.jl +++ b/lib/NonlinearSolveBase/src/solve.jl @@ -248,6 +248,8 @@ end kwargs::Any end +get_u(cache::NonlinearSolveNoInitCache) = SII.state_values(cache.prob) + function SciMLBase.reinit!( cache::NonlinearSolveNoInitCache, u0 = cache.prob.u0; p = cache.prob.p, kwargs... ) diff --git a/test/mtk_cache_indexing_tests.jl b/test/mtk_cache_indexing_tests.jl index 6e059e78c..dc11a1147 100644 --- a/test/mtk_cache_indexing_tests.jl +++ b/test/mtk_cache_indexing_tests.jl @@ -20,6 +20,9 @@ nint = init(nlprob, alg) @test nint isa integtype + @test_nowarn state_values(nint) + @test_nowarn parameter_values(nint) + for (i, sym) in enumerate([X, nlsys.X, :X]) # test both getindex and setindex! nint[sym] = 1.5i