LAMA
lama::ResidualThreshold Class Reference

ResidualThreshold is a stopping criterion of a solver which checks the residue of a solver for certain criteria. More...

#include <ResidualThreshold.hpp>

Inheritance diagram for lama::ResidualThreshold:

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 Criterioncopy () 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

Detailed Description

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.


Member Enumeration Documentation

Defines the operators which can be used to connect Criterions with.

Enumerator:
AND 

stands for logical and composition

OR 

stands for logical or composition

The possible check modes for the residue threshold.

Enumerator:
Absolute 

stands for an absolute residue reduction

Relative 

stands for an relative residue reduction


Constructor & Destructor Documentation

Creates a RedisualThreshold stopping criteria from the passed norm.

Parameters:
[in]normthe norm to use for residue calculation

Creates a RedisualThreshold stopping criteria from the passed parameters.

Parameters:
[in]normthe norm to use for residue calculation
[in]precisionthe desired precision
[in]checkModeif the residue should be check for an absolute or a relative reduction.

Creates a copy of the passed ResidualThreshold.

Parameters:
[in]otherthe ResidualThreshold to take a copy from.

Member Function Documentation

References ResidualThreshold().

References mNorm.

References mPrecision.

Referenced by 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.

Parameters:
[in]solverthe solver to check the state of.
Returns:
if this Criterion is true for the state of solver.

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::Criterion::setLeftChild ( const CriterionPtr  leftChild) [inherited]
void lama::Criterion::setOperation ( const BooleanOperator  operation) [inherited]

References mPrecision.

void lama::Criterion::setRightChild ( const CriterionPtr  rightChild) [inherited]
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.

Parameters:
[out]streamthe stream to write to.

Reimplemented from lama::Criterion.

References getPrecision(), and mCheckMode.


Field Documentation

Referenced by getNorm().


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