Skip to content

Commit 24a12c0

Browse files
committed
move ks to constcache
1 parent e94e560 commit 24a12c0

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,14 +697,15 @@ end
697697

698698
### Rodas4 methods
699699

700-
struct Rodas4ConstantCache{TF, UF, Tab, JType, WType, F, AD} <: RosenbrockConstantCache
700+
struct Rodas4ConstantCache{TF, UF, Tab, JType, WType, F, AD, rateType} <: RosenbrockConstantCache
701701
tf::TF
702702
uf::UF
703703
tab::Tab
704704
J::JType
705705
W::WType
706706
linsolve::F
707707
autodiff::AD
708+
ks::Vector{rateType}
708709
end
709710

710711
tabtype(::Rodas4) = Rodas4Tableau
@@ -721,10 +722,11 @@ function alg_cache(alg::Union{Rodas4, Rodas42, Rodas4P, Rodas4P2}, u, rate_proto
721722
J, W = build_J_W(alg, u, uprev, p, t, dt, f, uEltypeNoUnits, Val(false))
722723
linprob = nothing #LinearProblem(W,copy(u); u0=copy(u))
723724
linsolve = nothing #init(linprob,alg.linsolve,alias_A=true,alias_b=true)
725+
ks = Vector{typeof(rate_prototype)}(undef, 6)
724726
Rodas4ConstantCache(tf, uf,
725727
tabtype(alg)(constvalue(uBottomEltypeNoUnits),
726728
constvalue(tTypeNoUnits)), J, W, linsolve,
727-
alg_autodiff(alg))
729+
alg_autodiff(alg), ks)
728730
end
729731

730732
function alg_cache(alg::Union{Rodas4, Rodas42, Rodas4P, Rodas4P2}, u, rate_prototype, ::Type{uEltypeNoUnits},

lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_perform_step.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ end
12081208

12091209
@muladd function perform_step!(integrator, cache::Rodas4ConstantCache, repeat_step = false)
12101210
(;t, dt, uprev, u, f, p) = integrator
1211-
(;tf, uf) = cache
1211+
(;tf, uf, ks) = cache
12121212
(;A, C, gamma, c, d, H) = cache.tab
12131213

12141214
# Precalculations
@@ -1230,7 +1230,6 @@ end
12301230

12311231
# Initialize k arrays
12321232
num_stages = size(A,1)
1233-
ks = Vector{typeof(u)}(undef, num_stages)
12341233

12351234
# Loop for stages
12361235
for stage in 1:num_stages

lib/OrdinaryDiffEqRosenbrock/src/stiff_addsteps.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ function _ode_addsteps!(k, t, uprev, u, dt, f, p, cache::Rodas4ConstantCache,
291291
always_calc_begin = false, allow_calc_end = true,
292292
force_calc_end = false)
293293
if length(k) < 2 || always_calc_begin
294-
(;tf, uf, du) = cache
294+
(;tf, uf, ks) = cache
295295
(;A, C, gamma, c, d, H) = cache.tab
296296

297297
# Precalculations
@@ -319,7 +319,6 @@ function _ode_addsteps!(k, t, uprev, u, dt, f, p, cache::Rodas4ConstantCache,
319319
end
320320

321321
num_stages = size(A, 1)
322-
k = Vector{typeof(du)}(undef, num_stages)
323322

324323
for stage in 1:num_stages
325324
u = uprev

0 commit comments

Comments
 (0)