1212
1313TruncatedStacktraces. @truncate_stacktrace CompositeCache 1
1414
15- if isdefined (Base, :Experimental ) && isdefined (Base. Experimental, :silence! )
16- Base. Experimental. silence! (CompositeCache)
15+ mutable struct DefaultCache{T1, T2, T3, T4, T5, T6, A, F} <: OrdinaryDiffEqCache
16+ args:: A
17+ choice_function:: F
18+ current:: Int
19+ cache1:: T1
20+ cache2:: T2
21+ cache3:: T3
22+ cache4:: T4
23+ cache5:: T5
24+ cache6:: T6
25+ function DefaultCache {T1, T2, T3, T4, T5, T6, F} (args, choice_function, current) where {T1, T2, T3, T4, T5, T6, F}
26+ new {T1, T2, T3, T4, T5, T6, typeof(args), F} (args, choice_function, current)
27+ end
1728end
1829
19- function alg_cache (alg:: CompositeAlgorithm{Tuple{T1, T2}, F} , u, rate_prototype,
20- :: Type{uEltypeNoUnits} , :: Type{uBottomEltypeNoUnits} ,
21- :: Type{tTypeNoUnits} , uprev,
22- uprev2, f, t, dt, reltol, p, calck,
23- :: Val{V} ) where {T1, T2, F, V, uEltypeNoUnits, uBottomEltypeNoUnits,
24- tTypeNoUnits}
25- caches = (
26- alg_cache (alg. algs[1 ], u, rate_prototype, uEltypeNoUnits,
27- uBottomEltypeNoUnits,
28- tTypeNoUnits, uprev, uprev2, f, t, dt, reltol, p, calck, Val (V)),
29- alg_cache (alg. algs[2 ], u, rate_prototype, uEltypeNoUnits,
30- uBottomEltypeNoUnits,
31- tTypeNoUnits, uprev, uprev2, f, t, dt, reltol, p, calck, Val (V)))
32- CompositeCache (caches, alg. choice_function, 1 )
30+ TruncatedStacktraces. @truncate_stacktrace DefaultCache 1
31+
32+ if isdefined (Base, :Experimental ) && isdefined (Base. Experimental, :silence! )
33+ Base. Experimental. silence! (CompositeCache)
34+ Base. Experimental. silence! (DefaultCache)
3335end
3436
3537function alg_cache (alg:: CompositeAlgorithm , u, rate_prototype, :: Type{uEltypeNoUnits} ,
@@ -41,6 +43,24 @@ function alg_cache(alg::CompositeAlgorithm, u, rate_prototype, ::Type{uEltypeNoU
4143 CompositeCache (caches, alg. choice_function, 1 )
4244end
4345
46+ function alg_cache (alg:: CompositeAlgorithm{CS, Tuple{A1, A2, A3, A4, A5, A6}} , u,
47+ rate_prototype, :: Type{uEltypeNoUnits} , :: Type{uBottomEltypeNoUnits} , :: Type{tTypeNoUnits} ,
48+ uprev, uprev2, f, t, dt, reltol, p, calck,
49+ :: Val{V} ) where {CS, V, uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits, A1, A2, A3, A4, A5, A6}
50+
51+ args = (u, rate_prototype, uEltypeNoUnits,
52+ uBottomEltypeNoUnits, tTypeNoUnits, uprev, uprev2, f, t, dt,
53+ reltol, p, calck, Val (V))
54+ argT = map (typeof, args)
55+ T1 = Base. promote_op (alg_cache, A1, argT... )
56+ T2 = Base. promote_op (alg_cache, A2, argT... )
57+ T3 = Base. promote_op (alg_cache, A3, argT... )
58+ T4 = Base. promote_op (alg_cache, A4, argT... )
59+ T5 = Base. promote_op (alg_cache, A5, argT... )
60+ T6 = Base. promote_op (alg_cache, A6, argT... )
61+ DefaultCache {T1, T2, T3, T4, T5, T6, typeof(alg.choice_function)} (args, alg. choice_function, 1 )
62+ end
63+
4464# map + closure approach doesn't infer
4565@generated function __alg_cache (algs:: T , u, rate_prototype, :: Type{uEltypeNoUnits} ,
4666 :: Type{uBottomEltypeNoUnits} , :: Type{tTypeNoUnits} , uprev,
0 commit comments