-
-
Notifications
You must be signed in to change notification settings - Fork 259
Expand file tree
/
Copy pathinterp_func.jl
More file actions
57 lines (55 loc) · 2.19 KB
/
interp_func.jl
File metadata and controls
57 lines (55 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
function SciMLBase.interp_summary(
::Type{cacheType},
dense::Bool
) where {
cacheType <:
Union{
RosenbrockCombinedConstantCache,
RosenbrockCache,
HybridExplicitImplicitConstantCache, HybridExplicitImplicitCache,
},
}
return dense ? "specialized 3rd order \"free\" stiffness-aware interpolation" :
"1st order linear"
end
function SciMLBase.interp_summary(
::Type{cacheType},
dense::Bool
) where {
cacheType <:
Union{
RosenbrockCombinedConstantCache,
RosenbrockCache,
},
}
return dense ?
"specialized 4th (Rodas6P = 5th) order \"free\" stiffness-aware interpolation" :
"1st order linear"
end
# strip_cache for RosenbrockCache: the generic OrdinaryDiffEqCore version passes
# all-Nothing args, but several fields (dense, dtC, dtd, ks, interp_order, jac_reuse) have
# concrete types that don't accept Nothing. Provide a custom override that clears
# only the interpolation-related fields to zero-length arrays / nothing.
function OrdinaryDiffEqCore.strip_cache(cache::RosenbrockCache)
return RosenbrockCache(
cache.u, cache.uprev,
similar(cache.dense, 0), # dense::Vector{rateType} — must not be Nothing
cache.du, cache.du1, cache.du2,
similar(cache.dtC, 0, 0), # dtC::Matrix{tabType} — must not be Nothing
similar(cache.dtd, 0), # dtd::Vector{tabType} — must not be Nothing
similar(cache.ks, 0), # ks::Vector{rateType} — must not be Nothing
cache.fsalfirst, cache.fsallast, cache.dT,
cache.J, cache.W,
cache.tmp, cache.atmp, cache.weight,
cache.tab,
nothing, # tf
nothing, # uf
cache.linsolve_tmp, cache.linsolve,
nothing, # jac_config
nothing, # grad_config
cache.reltol, cache.alg,
cache.step_limiter!, cache.stage_limiter!,
cache.interp_order, # interp_order::Int — must not be Nothing
cache.jac_reuse # jac_reuse — preserve state across strip
)
end