39
39
get_fsalfirstlast (cache:: ExplicitTaylor2Cache , u) = (cache. k1, cache. k1)
40
40
41
41
@cache struct ExplicitTaylorCache{
42
- P, jetType, uType, taylorType, uNoUnitsType, StageLimiter, StepLimiter,
42
+ P, uType, taylorType, uNoUnitsType, StageLimiter, StepLimiter,
43
43
Thread} <: OrdinaryDiffEqMutableCache
44
44
order:: Val{P}
45
- jet:: jetType
45
+ jet:: Function
46
46
u:: uType
47
47
uprev:: uType
48
48
utaylor:: taylorType
@@ -54,17 +54,17 @@ get_fsalfirstlast(cache::ExplicitTaylor2Cache, u) = (cache.k1, cache.k1)
54
54
thread:: Thread
55
55
end
56
56
57
- function alg_cache (alg:: ExplicitTaylor{P} , u, rate_prototype, :: Type{uEltypeNoUnits} ,
57
+ function alg_cache (alg:: ExplicitTaylor , u, rate_prototype, :: Type{uEltypeNoUnits} ,
58
58
:: Type{uBottomEltypeNoUnits} , :: Type{tTypeNoUnits} , uprev, uprev2, f, t,
59
59
dt, reltol, p, calck,
60
- :: Val{true} ) where {P, uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits}
61
- _, jet_iip = build_jet (f, p, Val (P) , length (u))
62
- utaylor = TaylorDiff. make_seed (u, zero (u), Val (P) )
60
+ :: Val{true} ) where {uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits}
61
+ _, jet_iip = build_jet (f, p, alg . order , length (u))
62
+ utaylor = TaylorDiff. make_seed (u, zero (u), alg . order )
63
63
utilde = zero (u)
64
64
atmp = similar (u, uEltypeNoUnits)
65
65
recursivefill! (atmp, false )
66
66
tmp = zero (u)
67
- ExplicitTaylorCache (Val (P) , jet_iip, u, uprev, utaylor, utilde, tmp, atmp,
67
+ ExplicitTaylorCache (alg . order , jet_iip, u, uprev, utaylor, utilde, tmp, atmp,
68
68
alg. stage_limiter!, alg. step_limiter!, alg. thread)
69
69
end
70
70
86
86
87
87
# FSAL currently not used, providing dummy implementation to satisfy the interface
88
88
get_fsalfirstlast (cache:: ExplicitTaylorCache , u) = (cache. u, cache. u)
89
+
90
+ @cache struct ExplicitTaylorAdaptiveOrderCache{
91
+ uType, taylorType, uNoUnitsType, StageLimiter, StepLimiter,
92
+ Thread} <: OrdinaryDiffEqMutableCache
93
+ min_order:: Int
94
+ max_order:: Int
95
+ current_order:: Ref{Int}
96
+ jets:: Vector{Function}
97
+ u:: uType
98
+ uprev:: uType
99
+ utaylor:: taylorType
100
+ utilde:: uType
101
+ tmp:: uType
102
+ atmp:: uNoUnitsType
103
+ stage_limiter!:: StageLimiter
104
+ step_limiter!:: StepLimiter
105
+ thread:: Thread
106
+ end
107
+ function alg_cache (
108
+ alg:: ExplicitTaylorAdaptiveOrder , u, rate_prototype, :: Type{uEltypeNoUnits} ,
109
+ :: Type{uBottomEltypeNoUnits} , :: Type{tTypeNoUnits} , uprev, uprev2, f, t,
110
+ dt, reltol, p, calck,
111
+ :: Val{true} ) where {uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits}
112
+ jets = Function[]
113
+ for order in alg. min_order: alg. max_order
114
+ _, jet_iip = build_jet (f, p, Val (order), length (u))
115
+ push! (jets, jet_iip)
116
+ end
117
+ utaylor = TaylorDiff. make_seed (u, zero (u), Val (alg. max_order))
118
+ utilde = zero (u)
119
+ atmp = similar (u, uEltypeNoUnits)
120
+ recursivefill! (atmp, false )
121
+ tmp = zero (u)
122
+ current_order = Ref {Int} (alg. min_order)
123
+ ExplicitTaylorAdaptiveOrderCache (alg. min_order, alg. max_order, current_order, jets, u, uprev, utaylor, utilde, tmp, atmp,
124
+ alg. stage_limiter!, alg. step_limiter!, alg. thread)
125
+ end
126
+
127
+ get_fsalfirstlast (cache:: ExplicitTaylorAdaptiveOrderCache , u) = (cache. u, cache. u)
0 commit comments