Ewoms::ResidReductionCriterion< Vector > Class Template Reference

Provides a convergence criterion which looks at the reduction of the two-norm of the residual for the linear solvers. More...

#include <residreductioncriterion.hh>

Inheritance diagram for Ewoms::ResidReductionCriterion< Vector >:
Inheritance graph

Public Member Functions

 ResidReductionCriterion (Dune::ScalarProduct< Vector > &scalarProduct)
 
 ResidReductionCriterion (Dune::ScalarProduct< Vector > &scalarProduct, Scalar reduction)
 
void setTolerance (Scalar tol)
 Set the maximum allowed weighted maximum of the reduction of the linear residual. More...
 
Scalar tolerance () const
 Return the maximum allowed weighted maximum of the reduction of the linear residual. More...
 
void setInitial (const Vector &curSol, const Vector &curResid)
 Set the initial solution of the linear system of equations. More...
 
void update (const Vector &curSol, const Vector &curResid)
 Update the internal members of the convergence criterion with the current solution. More...
 
bool converged () const
 Returns true if and only if the convergence criterion is met. More...
 
Scalar accuracy () const
 Returns the accuracy of the solution at the last update. More...
 
void printInitial (std::ostream &os=std::cout) const
 Prints the initial information about the convergence behaviour. More...
 
void print (Scalar iter, std::ostream &os=std::cout) const
 Prints the information about the convergence behaviour for the current iteration. More...
 

Detailed Description

template<class Vector>
class Ewoms::ResidReductionCriterion< Vector >

Provides a convergence criterion which looks at the reduction of the two-norm of the residual for the linear solvers.

For the ResidReductionCriterion, the error of the solution is defined as

\[ e^k = \frac{\left| A x_k - b \right|}{\left| A x_0 - b \right|}\;, \]

Constructor & Destructor Documentation

template<class Vector >
Ewoms::ResidReductionCriterion< Vector >::ResidReductionCriterion ( Dune::ScalarProduct< Vector > &  scalarProduct)
inline
template<class Vector >
Ewoms::ResidReductionCriterion< Vector >::ResidReductionCriterion ( Dune::ScalarProduct< Vector > &  scalarProduct,
Scalar  reduction 
)
inline

Member Function Documentation

template<class Vector >
Scalar Ewoms::ResidReductionCriterion< Vector >::accuracy ( ) const
inlinevirtual

Returns the accuracy of the solution at the last update.

A value of zero means that the solution was exact.

Implements Ewoms::ConvergenceCriterion< Vector >.

template<class Vector >
bool Ewoms::ResidReductionCriterion< Vector >::converged ( ) const
inlinevirtual

Returns true if and only if the convergence criterion is met.

Implements Ewoms::ConvergenceCriterion< Vector >.

References Ewoms::ResidReductionCriterion< Vector >::tolerance().

template<class Vector >
void Ewoms::ResidReductionCriterion< Vector >::print ( Scalar  iter,
std::ostream &  os = std::cout 
) const
inlinevirtual

Prints the information about the convergence behaviour for the current iteration.

Parameters
iterThe iteration number. The semantics of this parameter are chosen by the linear solver.
osThe output stream to which the message gets written.

Reimplemented from Ewoms::ConvergenceCriterion< Vector >.

template<class Vector >
void Ewoms::ResidReductionCriterion< Vector >::printInitial ( std::ostream &  os = std::cout) const
inlinevirtual

Prints the initial information about the convergence behaviour.

This method is called after setInitial() if the solver thinks it's a good idea to be verbose. In practice, "printing the initial information" means printing column headers and the initial state.

Parameters
osThe output stream to which the message gets written.

Reimplemented from Ewoms::ConvergenceCriterion< Vector >.

template<class Vector >
void Ewoms::ResidReductionCriterion< Vector >::setInitial ( const Vector &  curSol,
const Vector &  curResid 
)
inlinevirtual

Set the initial solution of the linear system of equations.

This version of the method does NOT take the two-norm of the residual as argument. If the two-norm of the defect is available for the linear solver, the version of the update() method with it should be called.

Parameters
curSolThe current iterative solution of the linear system of equations
curResidThe residual vector of the current iterative solution of the linear system of equations

Implements Ewoms::ConvergenceCriterion< Vector >.

template<class Vector >
void Ewoms::ResidReductionCriterion< Vector >::setTolerance ( Scalar  tol)
inline

Set the maximum allowed weighted maximum of the reduction of the linear residual.

template<class Vector >
Scalar Ewoms::ResidReductionCriterion< Vector >::tolerance ( ) const
inline

Return the maximum allowed weighted maximum of the reduction of the linear residual.

Referenced by Ewoms::ResidReductionCriterion< Vector >::converged().

template<class Vector >
void Ewoms::ResidReductionCriterion< Vector >::update ( const Vector &  curSol,
const Vector &  curResid 
)
inlinevirtual

Update the internal members of the convergence criterion with the current solution.

This version of the method does NOT take the two-norm of the residual as argument. If the two-norm of the defect is available for the linear solver, the version of the update() method with it should be called.

Parameters
curSolThe current iterative solution of the linear system of equations
curResidThe residual vector of the current iterative solution of the linear system of equations

Implements Ewoms::ConvergenceCriterion< Vector >.


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