Namespace GooseFEM::Iterate#
-
namespace Iterate
Support function for iterations in end-user programs.
-
class StopList
- #include <GooseFEM/Iterate.h>
Class to perform a residual check based on the last “n” iterations.
A typical usage is in dynamic simulations where equilibrium is checked based on a force residual. Fluctuations could however be responsible for this criterion to be triggered too early. By checking several time-steps such case can be avoided.
Public Functions
-
inline StopList(size_t n = 1)
Constructor.
- Parameters:
n – Number of consecutive iterations to consider.
-
inline void reset()
Reset all residuals to infinity.
-
inline void reset(size_t n)
Reset all residuals to infinity, and change the number of residuals to check.
- Parameters:
n – Number of consecutive iterations to consider.
-
inline void roll_insert(double res)
Roll the list with the residuals, and add a new residual to the end.
In Python code this function corresponds to::
I.e. the residual ofresiduals = residuals[1:] + [new_residual]
n
iterations ago will be forgotten.- Parameters:
res – New residual to add to the list of residuals.
-
inline bool descending() const
Check of the sequence of
n
residuals is in descending order.- Returns:
true
if then
residuals are in descending order.
-
inline bool all_less(double tol) const
Check of the sequence of
n
residuals are all below a tolerance.- Parameters:
tol – Tolerance.
- Returns:
true
if alln
residuals are less than the tolerance.
-
inline const std::vector<double> &data() const
Get the historic residuals.
-
inline const std::vector<double> &get() const
Get the historic residuals.
-
inline StopList(size_t n = 1)
-
class StopList