Class to perform a residual check based on the last "n" iterations.
More...
#include <include/GooseFEM/Iterate.h>
|
| StopList (size_t n=1) |
| Constructor. More...
|
|
void | reset () |
| Reset all residuals to infinity. More...
|
|
void | reset (size_t n) |
| Reset all residuals to infinity, and change the number of residuals to check. More...
|
|
void | roll_insert (double res) |
| Roll the list with the residuals, and add a new residual to the end. More...
|
|
bool | descending () const |
| Check of the sequence of n residuals is in descending order. More...
|
|
bool | all_less (double tol) const |
| Check of the sequence of n residuals are all below a tolerance. More...
|
|
const std::vector< double > & | data () const |
| Get the historic residuals. More...
|
|
const std::vector< double > & | get () const |
| Get the historic residuals. More...
|
|
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.
Definition at line 27 of file Iterate.h.
◆ StopList()
GooseFEM::Iterate::StopList::StopList |
( |
size_t |
n = 1 | ) |
|
|
inline |
Constructor.
- Parameters
-
n | Number of consecutive iterations to consider. |
Definition at line 34 of file Iterate.h.
◆ all_less()
bool GooseFEM::Iterate::StopList::all_less |
( |
double |
tol | ) |
const |
|
inline |
Check of the sequence of n
residuals are all below a tolerance.
- Parameters
-
- Returns
true
if all n
residuals are less than the tolerance.
Definition at line 91 of file Iterate.h.
◆ data()
const std::vector< double > & GooseFEM::Iterate::StopList::data |
( |
| ) |
const |
|
inline |
Get the historic residuals.
Definition at line 99 of file Iterate.h.
◆ descending()
bool GooseFEM::Iterate::StopList::descending |
( |
| ) |
const |
|
inline |
Check of the sequence of n
residuals is in descending order.
- Returns
true
if the n
residuals are in descending order.
Definition at line 80 of file Iterate.h.
◆ get()
const std::vector< double > & GooseFEM::Iterate::StopList::get |
( |
| ) |
const |
|
inline |
Get the historic residuals.
Definition at line 107 of file Iterate.h.
◆ reset() [1/2]
void GooseFEM::Iterate::StopList::reset |
( |
| ) |
|
|
inline |
Reset all residuals to infinity.
Definition at line 43 of file Iterate.h.
◆ reset() [2/2]
void GooseFEM::Iterate::StopList::reset |
( |
size_t |
n | ) |
|
|
inline |
Reset all residuals to infinity, and change the number of residuals to check.
- Parameters
-
n | Number of consecutive iterations to consider. |
Definition at line 53 of file Iterate.h.
◆ roll_insert()
void GooseFEM::Iterate::StopList::roll_insert |
( |
double |
res | ) |
|
|
inline |
Roll the list with the residuals, and add a new residual to the end.
In Python code this function corresponds to::
residuals = residuals[1:] + [new_residual]
I.e. the residual of n
iterations ago will be forgotten.
- Parameters
-
res | New residual to add to the list of residuals. |
Definition at line 69 of file Iterate.h.
The documentation for this class was generated from the following file: