9#ifndef GOOSEFEM_ITERATE_H
10#define GOOSEFEM_ITERATE_H
45 std::fill(m_res.begin(), m_res.end(), std::numeric_limits<double>::infinity());
71 std::rotate(m_res.begin(), m_res.begin() + 1, m_res.end());
82 return std::is_sorted(m_res.cbegin(), m_res.cend(), std::greater<double>());
93 return !std::any_of(m_res.cbegin(), m_res.cend(), [=](
const auto&
i) { return i >= tol; });
99 const std::vector<double>&
data()
const
108 const std::vector<double>&
get()
const
114 std::vector<double> m_res;
Class to perform a residual check based on the last "n" iterations.
void roll_insert(double res)
Roll the list with the residuals, and add a new residual to the end.
bool all_less(double tol) const
Check of the sequence of n residuals are all below a tolerance.
const std::vector< double > & get() const
Get the historic residuals.
bool descending() const
Check of the sequence of n residuals is in descending order.
StopList(size_t n=1)
Constructor.
void reset(size_t n)
Reset all residuals to infinity, and change the number of residuals to check.
void reset()
Reset all residuals to infinity.
const std::vector< double > & data() const
Get the historic residuals.
Toolbox to perform finite element computations.
auto AsTensor(const T &arg, const S &shape)
"Broadcast" a scalar stored in an array (e.g.