|
1 |
| -""" |
2 |
| -$(TYPEDEF) |
3 |
| -
|
4 |
| -Statistics from the differential equation solver about the solution process. |
5 |
| -
|
6 |
| -## Fields |
7 |
| -
|
8 |
| -- nf: Number of function evaluations. If the differential equation is a split function, |
9 |
| - such as a `SplitFunction` for implicit-explicit (IMEX) integration, then `nf` is the |
10 |
| - number of function evaluations for the first function (the implicit function) |
11 |
| -- nf2: If the differential equation is a split function, such as a `SplitFunction` |
12 |
| - for implicit-explicit (IMEX) integration, then `nf2` is the number of function |
13 |
| - evaluations for the second function, i.e. the function treated explicitly. Otherwise |
14 |
| - it is zero. |
15 |
| -- nw: The number of W=I-gamma*J (or W=I/gamma-J) matrices constructed during the solving |
16 |
| - process. |
17 |
| -- nsolve: The number of linear solves `W\b` required for the integration. |
18 |
| -- njacs: Number of Jacobians calculated during the integration. |
19 |
| -- nnonliniter: Total number of iterations for the nonlinear solvers. |
20 |
| -- nnonlinconvfail: Number of nonlinear solver convergence failures. |
21 |
| -- ncondition: Number of calls to the condition function for callbacks. |
22 |
| -- naccept: Number of accepted steps. |
23 |
| -- nreject: Number of rejected steps. |
24 |
| -- maxeig: Maximum eigenvalue over the solution. This is only computed if the |
25 |
| - method is an auto-switching algorithm. |
26 |
| -""" |
27 |
| -mutable struct Stats |
28 |
| - nf::Int |
29 |
| - nf2::Int |
30 |
| - nw::Int |
31 |
| - nsolve::Int |
32 |
| - njacs::Int |
33 |
| - nnonliniter::Int |
34 |
| - nnonlinconvfail::Int |
35 |
| - ncondition::Int |
36 |
| - naccept::Int |
37 |
| - nreject::Int |
38 |
| - maxeig::Float64 |
39 |
| -end |
40 |
| - |
41 |
| -Base.@deprecate_binding DEStats Stats false |
42 |
| - |
43 |
| -Stats(x::Int = -1) = Stats(x, x, x, x, x, x, x, x, x, x, 0.0) |
44 |
| - |
45 |
| -function Base.show(io::IO, s::Stats) |
46 |
| - println(io, summary(s)) |
47 |
| - @printf io "%-50s %-d\n" "Number of function 1 evaluations:" s.nf |
48 |
| - @printf io "%-50s %-d\n" "Number of function 2 evaluations:" s.nf2 |
49 |
| - @printf io "%-50s %-d\n" "Number of W matrix evaluations:" s.nw |
50 |
| - @printf io "%-50s %-d\n" "Number of linear solves:" s.nsolve |
51 |
| - @printf io "%-50s %-d\n" "Number of Jacobians created:" s.njacs |
52 |
| - @printf io "%-50s %-d\n" "Number of nonlinear solver iterations:" s.nnonliniter |
53 |
| - @printf io "%-50s %-d\n" "Number of nonlinear solver convergence failures:" s.nnonlinconvfail |
54 |
| - @printf io "%-50s %-d\n" "Number of rootfind condition calls:" s.ncondition |
55 |
| - @printf io "%-50s %-d\n" "Number of accepted steps:" s.naccept |
56 |
| - @printf io "%-50s %-d" "Number of rejected steps:" s.nreject |
57 |
| - iszero(s.maxeig) || @printf io "\n%-50s %-d" "Maximum eigenvalue recorded:" s.maxeig |
| 1 | +@static if isdefined(SciMLBase, :DEStats) |
| 2 | + const Stats = SciMLBase.DEStats |
| 3 | +else |
| 4 | + """ |
| 5 | + $(TYPEDEF) |
| 6 | + |
| 7 | + Statistics from the differential equation solver about the solution process. |
| 8 | + |
| 9 | + ## Fields |
| 10 | + |
| 11 | + - nf: Number of function evaluations. If the differential equation is a split function, |
| 12 | + such as a `SplitFunction` for implicit-explicit (IMEX) integration, then `nf` is the |
| 13 | + number of function evaluations for the first function (the implicit function) |
| 14 | + - nf2: If the differential equation is a split function, such as a `SplitFunction` |
| 15 | + for implicit-explicit (IMEX) integration, then `nf2` is the number of function |
| 16 | + evaluations for the second function, i.e. the function treated explicitly. Otherwise |
| 17 | + it is zero. |
| 18 | + - nw: The number of W=I-gamma*J (or W=I/gamma-J) matrices constructed during the solving |
| 19 | + process. |
| 20 | + - nsolve: The number of linear solves `W\b` required for the integration. |
| 21 | + - njacs: Number of Jacobians calculated during the integration. |
| 22 | + - nnonliniter: Total number of iterations for the nonlinear solvers. |
| 23 | + - nnonlinconvfail: Number of nonlinear solver convergence failures. |
| 24 | + - ncondition: Number of calls to the condition function for callbacks. |
| 25 | + - naccept: Number of accepted steps. |
| 26 | + - nreject: Number of rejected steps. |
| 27 | + - maxeig: Maximum eigenvalue over the solution. This is only computed if the |
| 28 | + method is an auto-switching algorithm. |
| 29 | + """ |
| 30 | + mutable struct Stats |
| 31 | + nf::Int |
| 32 | + nf2::Int |
| 33 | + nw::Int |
| 34 | + nsolve::Int |
| 35 | + njacs::Int |
| 36 | + nnonliniter::Int |
| 37 | + nnonlinconvfail::Int |
| 38 | + ncondition::Int |
| 39 | + naccept::Int |
| 40 | + nreject::Int |
| 41 | + maxeig::Float64 |
| 42 | + end |
| 43 | + |
| 44 | + Base.@deprecate_binding DEStats Stats false |
| 45 | + |
| 46 | + Stats(x::Int = -1) = Stats(x, x, x, x, x, x, x, x, x, x, 0.0) |
| 47 | + |
| 48 | + function Base.show(io::IO, s::Stats) |
| 49 | + println(io, summary(s)) |
| 50 | + @printf io "%-50s %-d\n" "Number of function 1 evaluations:" s.nf |
| 51 | + @printf io "%-50s %-d\n" "Number of function 2 evaluations:" s.nf2 |
| 52 | + @printf io "%-50s %-d\n" "Number of W matrix evaluations:" s.nw |
| 53 | + @printf io "%-50s %-d\n" "Number of linear solves:" s.nsolve |
| 54 | + @printf io "%-50s %-d\n" "Number of Jacobians created:" s.njacs |
| 55 | + @printf io "%-50s %-d\n" "Number of nonlinear solver iterations:" s.nnonliniter |
| 56 | + @printf io "%-50s %-d\n" "Number of nonlinear solver convergence failures:" s.nnonlinconvfail |
| 57 | + @printf io "%-50s %-d\n" "Number of rootfind condition calls:" s.ncondition |
| 58 | + @printf io "%-50s %-d\n" "Number of accepted steps:" s.naccept |
| 59 | + @printf io "%-50s %-d" "Number of rejected steps:" s.nreject |
| 60 | + iszero(s.maxeig) || @printf io "\n%-50s %-d" "Maximum eigenvalue recorded:" s.maxeig |
| 61 | + end |
58 | 62 | end
|
0 commit comments