Skip to content

Commit 88bcd2f

Browse files
Harsh SinghHarsh Singh
authored andcommitted
fix(Rosenbrock): add strip_cache override for RosenbrockCache
RosenbrockCache contains concrete container fields (Vector, Matrix, Int) which cannot accept , causing generic strip_cache to fail. Add specialized strip_cache that clears arrays and nulls AD/interp fields while preserving required structure. Fixes InterfaceI strip tests.
1 parent 949f6cd commit 88bcd2f

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

lib/OrdinaryDiffEqRosenbrock/src/interp_func.jl

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,40 @@ function SciMLBase.interp_summary(
2727
"specialized 4th (Rodas6P = 5th) order \"free\" stiffness-aware interpolation" :
2828
"1st order linear"
2929
end
30+
31+
# RosenbrockCache has concrete container fields (Vector{rateType}, Matrix{tabType}, Int)
32+
# that cannot accept `nothing`, so the generic strip_cache (which passes all `nothing`) fails.
33+
# This override clears arrays to empty versions while preserving type stability.
34+
function OrdinaryDiffEqCore.strip_cache(cache::RosenbrockCache)
35+
return RosenbrockCache(
36+
cache.u,
37+
cache.uprev,
38+
similar(cache.dense, 0),
39+
cache.du,
40+
cache.du1,
41+
cache.du2,
42+
similar(cache.dtC, 0, 0),
43+
similar(cache.dtd, 0),
44+
similar(cache.ks, 0),
45+
cache.fsalfirst,
46+
cache.fsallast,
47+
cache.dT,
48+
cache.J,
49+
cache.W,
50+
cache.tmp,
51+
cache.atmp,
52+
cache.weight,
53+
cache.tab,
54+
nothing,
55+
nothing,
56+
cache.linsolve_tmp,
57+
cache.linsolve,
58+
nothing,
59+
nothing,
60+
cache.reltol,
61+
cache.alg,
62+
cache.step_limiter!,
63+
cache.stage_limiter!,
64+
cache.interp_order
65+
)
66+
end

0 commit comments

Comments
 (0)