LAMA
|
ResidualThreshold is a stopping criterion of a solver which checks the residue of a solver for certain criteria. More...
#include <ResidualThreshold.hpp>
Public Types | |
enum | ResidualThresholdCheckMode { Absolute, Relative } |
The possible check modes for the residue threshold. More... | |
enum | BooleanOperator { AND, OR } |
Defines the operators which can be used to connect Criterions with. More... | |
Public Member Functions | |
ResidualThreshold () | |
ResidualThreshold (const NormPtr norm) | |
Creates a RedisualThreshold stopping criteria from the passed norm. | |
ResidualThreshold (const NormPtr norm, Scalar precision, ResidualThresholdCheckMode checkMode) | |
Creates a RedisualThreshold stopping criteria from the passed parameters. | |
ResidualThreshold (const ResidualThreshold &other) | |
Creates a copy of the passed ResidualThreshold. | |
virtual | ~ResidualThreshold () |
Destroys this ResidualThreshold. | |
virtual Criterion * | copy () const |
bool | isSatisfied (const IterativeSolver &solver) |
Checks if this Criterion is true for the state of the passed solver. | |
ResidualThresholdCheckMode | getCheckMode () const |
IndexType | getIterationExtrema () const |
Scalar | getFirstNormResult () const |
const NormPtr | getNorm () const |
Scalar | getPrecision () const |
void | setCheckMode (ResidualThresholdCheckMode mCheckMode) |
void | setFirstNormResult (Scalar firstNormResult) |
void | setPrecision (Scalar precision) |
virtual void | writeAt (std::ostream &stream) const |
Writes some Information about this to the passed stream. | |
const CriterionPtr | getLeftChild () const |
const CriterionPtr | getRightChild () const |
BooleanOperator | getOperation () const |
void | setLeftChild (const CriterionPtr leftChild) |
void | setRightChild (const CriterionPtr rightChild) |
void | setOperation (const BooleanOperator operation) |
bool | hasLeftChild () const |
Returns true if the boolean condition has a left child Do not use getLeftChild() to compare pointers. | |
bool | hasRightChild () const |
Returns true if the boolean condition has a right child Do not use getRightChild() to compare pointers. | |
Protected Member Functions | |
LAMA_LOG_USING (Criterion::logger) | |
LAMA_LOG_DECL_STATIC_LOGGER (logger) | |
Private Attributes | |
const NormPtr | mNorm |
ResidualThresholdCheckMode | mCheckMode |
Scalar | mPrecision |
Scalar | mFirstNormResult |
ResidualThreshold is a stopping criterion of a solver which checks the residue of a solver for certain criteria.
ResidualThreshold is a stopping criterion of a solver which checks the residue of a solver to fall below a configured threshold. The threshold is either checked absolute or relative to the initial residue.
enum lama::Criterion::BooleanOperator [inherited] |
Referenced by copy().
lama::ResidualThreshold::ResidualThreshold | ( | const NormPtr | norm | ) |
Creates a RedisualThreshold stopping criteria from the passed norm.
[in] | norm | the norm to use for residue calculation |
lama::ResidualThreshold::ResidualThreshold | ( | const NormPtr | norm, |
Scalar | precision, | ||
ResidualThresholdCheckMode | checkMode | ||
) |
Creates a RedisualThreshold stopping criteria from the passed parameters.
[in] | norm | the norm to use for residue calculation |
[in] | precision | the desired precision |
[in] | checkMode | if the residue should be check for an absolute or a relative reduction. |
lama::ResidualThreshold::ResidualThreshold | ( | const ResidualThreshold & | other | ) |
Creates a copy of the passed ResidualThreshold.
[in] | other | the ResidualThreshold to take a copy from. |
lama::ResidualThreshold::~ResidualThreshold | ( | ) | [virtual] |
Destroys this ResidualThreshold.
Criterion * lama::ResidualThreshold::copy | ( | ) | const [virtual] |
References ResidualThreshold().
References mCheckMode.
References mFirstNormResult.
const CriterionPtr lama::Criterion::getLeftChild | ( | ) | const [inherited] |
References lama::Criterion::mLeftChild.
Referenced by lama::Criterion::writeAt().
const NormPtr lama::ResidualThreshold::getNorm | ( | ) | const |
References mNorm.
Criterion::BooleanOperator lama::Criterion::getOperation | ( | ) | const [inherited] |
References lama::Criterion::mOperation.
Referenced by lama::Criterion::writeAt().
Scalar lama::ResidualThreshold::getPrecision | ( | ) | const |
References mPrecision.
Referenced by writeAt().
const CriterionPtr lama::Criterion::getRightChild | ( | ) | const [inherited] |
References lama::Criterion::mRightChild.
Referenced by lama::Criterion::writeAt().
bool lama::Criterion::hasLeftChild | ( | ) | const [inherited] |
Returns true if the boolean condition has a left child Do not use getLeftChild() to compare pointers.
Logical operations are overwritten
return Returns true if the boolean condition has a left child. If pointer is not set: false
References lama::Criterion::mLeftChild.
Referenced by lama::Criterion::isSatisfied(), and lama::Criterion::writeAt().
bool lama::Criterion::hasRightChild | ( | ) | const [inherited] |
Returns true if the boolean condition has a right child Do not use getRightChild() to compare pointers.
Logical operations are overwritten
return Returns true if the boolean condition has a right child. If pointer is not set: false
References lama::Criterion::mRightChild.
Referenced by lama::Criterion::isSatisfied(), and lama::Criterion::writeAt().
bool lama::ResidualThreshold::isSatisfied | ( | const IterativeSolver & | solver | ) | [inline, virtual] |
Checks if this Criterion is true for the state of the passed solver.
[in] | solver | the solver to check the state of. |
Reimplemented from lama::Criterion.
References Absolute, lama::IterativeSolver::getIterationCount(), lama::Solver::getResidual(), LAMA_ASSERT, mCheckMode, mFirstNormResult, mPrecision, and Relative.
lama::Criterion::LAMA_LOG_DECL_STATIC_LOGGER | ( | logger | ) | [protected, inherited] |
Reimplemented in lama::IterationCount.
lama::ResidualThreshold::LAMA_LOG_USING | ( | Criterion::logger | ) | [protected] |
void lama::ResidualThreshold::setCheckMode | ( | ResidualThresholdCheckMode | mCheckMode | ) |
References mCheckMode.
void lama::ResidualThreshold::setFirstNormResult | ( | Scalar | firstNormResult | ) |
References mFirstNormResult.
void lama::Criterion::setLeftChild | ( | const CriterionPtr | leftChild | ) | [inherited] |
References lama::Criterion::mLeftChild.
void lama::Criterion::setOperation | ( | const BooleanOperator | operation | ) | [inherited] |
References lama::Criterion::mOperation.
void lama::ResidualThreshold::setPrecision | ( | Scalar | precision | ) |
References mPrecision.
void lama::Criterion::setRightChild | ( | const CriterionPtr | rightChild | ) | [inherited] |
References lama::Criterion::mRightChild.
void lama::ResidualThreshold::writeAt | ( | std::ostream & | stream | ) | const [virtual] |
Writes some Information about this to the passed stream.
If a deriving class does not overrides writeAt, typeid(this).name() is written to stream.
[out] | stream | the stream to write to. |
Reimplemented from lama::Criterion.
References getPrecision(), and mCheckMode.
Referenced by getCheckMode(), isSatisfied(), setCheckMode(), and writeAt().
Referenced by getFirstNormResult(), isSatisfied(), and setFirstNormResult().
const NormPtr lama::ResidualThreshold::mNorm [private] |
Referenced by getNorm().
Scalar lama::ResidualThreshold::mPrecision [private] |
Referenced by getPrecision(), isSatisfied(), and setPrecision().