Template Numerical Library: TNL::Solvers::StaticIterativeSolver< Real, Index > Class Template Reference

Template Numerical Library version\ main:be7e16d88

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
TNL::Solvers::StaticIterativeSolver< Real, Index > Class Template Reference

Base class for iterative solvers. More...

`#include <TNL/Solvers/StaticIterativeSolver.h>`

## Public Member Functions
__cuda_callable__ | StaticIterativeSolver ()=default
| Default constructor.
__cuda_callable__ bool | checkConvergence () const
| Checks whether the convergence occurred already.
__cuda_callable__ bool | checkNextIteration () const
| Checks if the solver is allowed to do the next iteration.
__cuda_callable__ const Real & | getConvergenceResidue () const
| Gets the the convergence threshold.
__cuda_callable__ const Real & | getDivergenceResidue () const
| Gets the limit for the divergence criterion.
__cuda_callable__ const Index & | getIterations () const
| Gets the number of iterations performed by the solver so far.
__cuda_callable__ const Index & | getMaxIterations () const
| Gets the maximal number of iterations the solver is allowed to perform.
__cuda_callable__ const Index & | getMinIterations () const
| Gets the minimal number of iterations the solver is supposed to do.
__cuda_callable__ const Real & | getResidue () const
| Gets the residue reached at the current iteration.
__cuda_callable__ bool | nextIteration ()
| Proceeds to the next iteration.
__cuda_callable__ void | resetIterations ()
| Sets the the number of the current iterations to zero.
__cuda_callable__ void | setConvergenceResidue (const Real &convergenceResidue)
| Sets the threshold for the convergence.
__cuda_callable__ void | setDivergenceResidue (const Real &divergenceResidue)
| Sets the residue limit for the divergence criterion.
__cuda_callable__ void | setMaxIterations (const Index &maxIterations)
| Sets the maximal number of iterations the solver is allowed to perform.
__cuda_callable__ void | setMinIterations (const Index &minIterations)
| Sets the minimal number of iterations the solver is supposed to do.
__cuda_callable__ void | setResidue (const Real &residue)
| Sets the residue reached at the current iteration.
bool | setup (const Config::ParameterContainer &parameters, const std::string &prefix="")
| Method for setup of the iterative solver based on configuration parameters.

## Static Public Member Functions
static void | configSetup (Config::ConfigDescription &config, const std::string &prefix="")
| This method defines configuration entries for setup of the iterative solver.

## Protected Attributes
Real | convergenceResidue = 1e-6
Index | currentIteration = 0
Real | currentResidue = 0
Real | divergenceResidue = std::numeric_limits< Real >::max()
Index | maxIterations = 1000000000
Index | minIterations = 0
Index | refreshRate = 1

## Detailed Description

template<typename Real, typename Index>
class TNL::Solvers::StaticIterativeSolver< Real, Index >

Base class for iterative solvers.

Template Parameters

  Real | is a floating point type used for computations.
  Index | is an indexing type.

## Member Function Documentation

## ◆ checkConvergence()

template<typename Real, typename Index>

__cuda_callable__ bool TNL::Solvers::StaticIterativeSolver< Real, Index >::checkConvergence | ( |  | ) | const
| nodiscard

Checks whether the convergence occurred already.

Returns
  true if the convergence already occurred, and false otherwise.

## ◆ checkNextIteration()

template<typename Real, typename Index>

__cuda_callable__ bool TNL::Solvers::StaticIterativeSolver< Real, Index >::checkNextIteration | ( |  | ) | const
| nodiscard

Checks if the solver is allowed to do the next iteration.

Returns
  true if the solver is allowed to do the next iteration, and false otherwise. This may happen because the divergence occurred.

## ◆ configSetup()

template<typename Real, typename Index>

void TNL::Solvers::StaticIterativeSolver< Real, Index >::configSetup | ( | Config::ConfigDescription & | config,
|  | const std::string & | prefix = "" )
| static

This method defines configuration entries for setup of the iterative solver.

The following entries are defined:

max-iterations - maximal number of iterations the solver may perform.

min-iterations - minimal number of iterations the solver must perform.

convergence-residue - convergence occurs when the residue drops bellow this limit.

divergence-residue - divergence occurs when the residue exceeds given limit.

Parameters

  config | contains description of configuration parameters.
  prefix | is a prefix of particular configuration entries.

## ◆ getConvergenceResidue()

template<typename Real, typename Index>

__cuda_callable__ const Real & TNL::Solvers::StaticIterativeSolver< Real, Index >::getConvergenceResidue | ( |  | ) | const
| nodiscard

Gets the the convergence threshold.

See IterativeSolver::setConvergenceResidue.

Returns
  the convergence threshold.

## ◆ getDivergenceResidue()

template<typename Real, typename Index>

__cuda_callable__ const Real & TNL::Solvers::StaticIterativeSolver< Real, Index >::getDivergenceResidue | ( |  | ) | const
| nodiscard

Gets the limit for the divergence criterion.

See IterativeSolver::setDivergenceResidue.

Returns
  the residue limit of the divergence.

## ◆ getIterations()

template<typename Real, typename Index>

__cuda_callable__ const Index & TNL::Solvers::StaticIterativeSolver< Real, Index >::getIterations | ( |  | ) | const
| nodiscard

Gets the number of iterations performed by the solver so far.

Returns
  number of iterations performed so far.

## ◆ getMaxIterations()

template<typename Real, typename Index>

__cuda_callable__ const Index & TNL::Solvers::StaticIterativeSolver< Real, Index >::getMaxIterations | ( |  | ) | const
| nodiscard

Gets the maximal number of iterations the solver is allowed to perform.

See IterativeSolver::setMaxIterations.

Returns
  maximal number of allowed iterations.

## ◆ getMinIterations()

template<typename Real, typename Index>

__cuda_callable__ const Index & TNL::Solvers::StaticIterativeSolver< Real, Index >::getMinIterations | ( |  | ) | const
| nodiscard

Gets the minimal number of iterations the solver is supposed to do.

Returns
  minimal number of iterations the solver is supposed to do.

## ◆ getResidue()

template<typename Real, typename Index>

__cuda_callable__ const Real & TNL::Solvers::StaticIterativeSolver< Real, Index >::getResidue | ( |  | ) | const
| nodiscard

Gets the residue reached at the current iteration.

Returns
  residue reached at the current iteration.

## ◆ nextIteration()

template<typename Real, typename Index>

__cuda_callable__ bool TNL::Solvers::StaticIterativeSolver< Real, Index >::nextIteration | ( |  | ) |
| nodiscard

Proceeds to the next iteration.

Returns
  true if the solver is allowed to do the next iteration, and false otherwise. This may happen because the divergence occurred.

## ◆ setConvergenceResidue()

template<typename Real, typename Index>

__cuda_callable__ void TNL::Solvers::StaticIterativeSolver< Real, Index >::setConvergenceResidue | ( | const Real & | convergenceResidue | ) |

Sets the threshold for the convergence.

The convergence occurs when the residue drops bellow this limit.

Parameters

  convergenceResidue | is threshold for the convergence.

## ◆ setDivergenceResidue()

template<typename Real, typename Index>

__cuda_callable__ void TNL::Solvers::StaticIterativeSolver< Real, Index >::setDivergenceResidue | ( | const Real & | divergenceResidue | ) |

Sets the residue limit for the divergence criterion.

The divergence occurs when the residue exceeds the limit.

Parameters

  divergenceResidue | the residue limit of the divergence.

## ◆ setMaxIterations()

template<typename Real, typename Index>

__cuda_callable__ void TNL::Solvers::StaticIterativeSolver< Real, Index >::setMaxIterations | ( | const Index & | maxIterations | ) |

Sets the maximal number of iterations the solver is allowed to perform.

If the number of iterations performed by the solver exceeds given limit, the divergence occurs.

Parameters

  maxIterations | maximal number of allowed iterations.

## ◆ setMinIterations()

template<typename Real, typename Index>

__cuda_callable__ void TNL::Solvers::StaticIterativeSolver< Real, Index >::setMinIterations | ( | const Index & | minIterations | ) |

Sets the minimal number of iterations the solver is supposed to do.

Parameters

  minIterations | minimal number of iterations the solver is supposed to do.

## ◆ setResidue()

template<typename Real, typename Index>

__cuda_callable__ void TNL::Solvers::StaticIterativeSolver< Real, Index >::setResidue | ( | const Real & | residue | ) |

Sets the residue reached at the current iteration.

Parameters

  residue | reached at the current iteration.

## ◆ setup()

template<typename Real, typename Index>

bool TNL::Solvers::StaticIterativeSolver< Real, Index >::setup | ( | const Config::ParameterContainer & | parameters,
|  | const std::string & | prefix = "" )

Method for setup of the iterative solver based on configuration parameters.

Parameters

  parameters | contains values of the define configuration entries.
  prefix | is a prefix of particular configuration entries.

The documentation for this class was generated from the following file:

- src/TNL/Solvers/StaticIterativeSolver.h