1- default_statistics () = Dict {Symbol, Vector{Real}} (
2- :assembly_times => [],
3- :solver_times => [],
4- :assembly_allocations => [],
5- :solver_allocations => [],
6- :linear_residuals => [],
7- :nonlinear_residuals => [],
8- :matrix_nnz => [],
9- :total_times => [],
10- :total_allocations => [],
1+ default_statistics (Tv = Float64, Ti = Int64) = Dict {Symbol, Any} (
2+ :timeroutputs => TimerOutput (),
3+ :linear_residuals => Tv[],
4+ :nonlinear_residuals => Tv[],
5+ :matrix_nnz => Ti[],
116)
127
138mutable struct SolverConfiguration{AT <: AbstractMatrix , bT, xT}
@@ -19,7 +14,7 @@ mutable struct SolverConfiguration{AT <: AbstractMatrix, bT, xT}
1914 res:: xT
2015 freedofs:: Vector{Int} # # stores indices of free dofs
2116 LP:: LinearProblem
22- statistics:: Dict{Symbol, Vector{Real} }
17+ statistics:: Dict{Symbol, Any }
2318 linsolver:: Any
2419 unknown_ids_in_sol:: Array{Int, 1}
2520 unknowns:: Array{Unknown, 1}
@@ -28,17 +23,54 @@ mutable struct SolverConfiguration{AT <: AbstractMatrix, bT, xT}
2823 parameters:: Dict{Symbol, Any} # dictionary with user parameters
2924end
3025
26+ """
27+ ````
28+ residuals(S::SolverConfiguration)
29+ ````
30+
31+ returns the vector with the residuals of all iterations
32+ """
33+ residuals (S:: SolverConfiguration ) = S. statistics[:nonlinear_residuals ]
34+
3135"""
3236````
3337residual(S::SolverConfiguration)
3438````
3539
3640returns the residual of the last solve
37-
3841"""
3942residual (S:: SolverConfiguration ) = S. statistics[:nonlinear_residuals ][end ]
4043
4144
45+ """
46+ ````
47+ timeroutputs(S::SolverConfiguration)
48+ ````
49+
50+ returns TimerOutputs object that contains detailed information on solving and assembly times
51+ """
52+ timeroutputs (S:: SolverConfiguration ) = S. statistics[:timeroutputs ]
53+
54+
55+ """
56+ ````
57+ lastmatrix(S::SolverConfiguration)
58+ ````
59+
60+ returns the currently stored system matrix
61+ """
62+ lastmatrix (S:: SolverConfiguration ) = S. A
63+
64+ """
65+ ````
66+ lastrhs(S::SolverConfiguration)
67+ ````
68+
69+ returns the currently stored right-hand side
70+ """
71+ lastrhs (S:: SolverConfiguration ) = S. b
72+
73+
4274#
4375# Default context information with help info.
4476#
@@ -65,6 +97,7 @@ default_solver_kwargs() = Dict{Symbol, Tuple{Any, String}}(
6597 :constant_rhs => (false , " right-hand side is constant (skips reassembly)" ),
6698 :method_linear => (UMFPACKFactorization (), " any solver or custom LinearSolveFunction compatible with LinearSolve.jl (default = UMFPACKFactorization())" ),
6799 :precon_linear => (nothing , " function that computes preconditioner for method_linear in case an iterative solver is chosen" ),
100+ :timeroutputs => (:full , " configures show of timeroutputs (choose between :hide, :full, :compact)" ),
68101 :initialized => (false , " linear system in solver configuration is already assembled (turns true after first solve)" ),
69102 :plot => (false , " plot all solved unknowns with a (very rough but fast) unicode plot" ),
70103)
83116
84117"""
85118````
86- function iterate_until_stationarity (
87- SolverConfiguration( Problem::ProblemDescription
119+ function SolverConfiguration (
120+ Problem::ProblemDescription
88121 [FES::Union{<:FESpace, Vector{<:FESpace}}];
89122 init = nothing,
90123 unknowns = Problem.unknowns,
@@ -170,5 +203,5 @@ function SolverConfiguration(Problem::ProblemDescription, unknowns::Array{Unknow
170203 else
171204 LP = LinearProblem (A. entries. cscmatrix, b. entries)
172205 end
173- return SolverConfiguration {typeof(A), typeof(b), typeof(x)} (Problem, A, b, x, x_temp, res, freedofs, LP, default_statistics (), nothing , unknown_ids_in_sol, unknowns, copy (unknowns), offsets, parameters)
206+ return SolverConfiguration {typeof(A), typeof(b), typeof(x)} (Problem, A, b, x, x_temp, res, freedofs, LP, default_statistics (TvM, TiM ), nothing , unknown_ids_in_sol, unknowns, copy (unknowns), offsets, parameters)
174207end
0 commit comments