GooseFEM 1.4.1.dev2+g78f16df
Loading...
Searching...
No Matches
GooseFEM::Iterate::StopList Class Reference

Class to perform a residual check based on the last "n" iterations. More...

#include <GooseFEM/Iterate.h>

Public Member Functions

 StopList (size_t n=1)
 Constructor.
 
void reset ()
 Reset all residuals to infinity.
 
void reset (size_t n)
 Reset all residuals to infinity, and change the number of residuals to check.
 
void roll_insert (double res)
 Roll the list with the residuals, and add a new residual to the end.
 
bool descending () const
 Check of the sequence of n residuals is in descending order.
 
bool all_less (double tol) const
 Check of the sequence of n residuals are all below a tolerance.
 
const std::vector< double > & data () const
 Get the historic residuals.
 
const std::vector< double > & get () const
 Get the historic residuals.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ StopList()

GooseFEM::Iterate::StopList::StopList ( size_t n = 1)
inline

Constructor.

Parameters
nNumber of consecutive iterations to consider.

Definition at line 34 of file Iterate.h.

Member Function Documentation

◆ 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
tolTolerance.
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 108 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
nNumber 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
resNew 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: