LAMA
lama::OmegaSolver Class Reference

The OldSolutionHandler class only manages the omega parameter For solvers like Jacobi and SOR. More...

#include <OmegaSolver.hpp>

Inheritance diagram for lama::OmegaSolver:

Data Structures

struct  OmegaSolverRuntime

Public Member Functions

 OmegaSolver (const std::string &id)
 Creates a solver with the given id.
 OmegaSolver (const std::string &id, const Scalar omega)
 Creates a solver with the given id and omega.
 OmegaSolver (const std::string &id, LoggerPtr logger)
 Creates a solver with the given id and logger.
 OmegaSolver (const std::string &id, const Scalar omega, LoggerPtr logger)
 Creates a solver with the given id, omega and logger.
 OmegaSolver (const OmegaSolver &other)
 Copy constructor that copies the status independent solver information.
virtual ~OmegaSolver ()
 Destructor.
virtual void initialize (const Matrix &coefficients)
 This abstract method is used by derived solvers to initialize a omega solver.
void setOmega (const Scalar omega)
 Sets the omega parameter of this.
Scalar getOmega () const
 Returns omega.
virtual OmegaSolverRuntimegetRuntime ()=0
 Returns the complete configuration of the derived class.
virtual const OmegaSolverRuntimegetConstRuntime () const =0
 Returns the complete const configuration of the derived class.
virtual SolverPtr copy ()=0
 Copies the status independent solver informations to create a new instance of the same type.
virtual void solveImpl ()
 Solves the equation system.
void setStoppingCriterion (const CriterionPtr criterion)
 set a new StoppingCriterion to the solver.
void setPreconditioner (SolverPtr const conditioner)
 Sets the preconditioner of this solver.
const SolverPtr getPreconditioner () const
 returns the preconditioner of this solver
int getIterationCount () const
 returns the number of iterations, this solver has done so far.
virtual void solve (Vector &solution, const Vector &rhs)
 Solves the equation system based on the given rhs.
virtual void solveInit (Vector &solution, const Vector &rhs)
 Initializes the solver with rhs and solution.
virtual void solveFinalize ()
 Finalizes the solving process.
const std::string & getId () const
 Returns the ID of this solver.
const VectorgetResidual () const
 Contingently calculates the current residual based on the coefficients, rhs and solution currently associated with this.
const MatrixgetCoefficients () const
 Gets the matrix A from A*u=f.
void setLogger (LoggerPtr logger)
 Redefines mLogger.
void setLogLevel (LogLevel::LogLevel level)
 Switches the loglevel of mLogger.
virtual void setContext (ContextPtr context)
 Sets the context where this solver should be executed.

Protected Member Functions

virtual void iterate ()=0
 This abstract method is used by derived solvers to represent a solver iteration.
 LAMA_LOG_DECL_STATIC_LOGGER (logger)
bool criteriaAreSatisfied () const
 Checks if all of the stopping criteria are satisfied.
void logStartSolve ()
 Logging methods to maintain code-readability.
void logEndSolve ()
void logIterationEndAndResidual ()
void logIterationStart ()
virtual void writeAt (std::ostream &stream) const
 Overrides Printable::writeAt with more useful stuff.

Protected Attributes

Scalar mOmega
SolverPtr mPreconditioner
 The preconditioner of this solver.
CriterionPtr mCriterionRootComponent
 The root stopping criterion evaluated every iteration in the solve method.
std::string mId
 The ID of this solver.
LoggerPtr mLogger
 The solver logger.
ContextPtr mContext
 For forcing the context solver dependent.

Detailed Description

The OldSolutionHandler class only manages the omega parameter For solvers like Jacobi and SOR.


Constructor & Destructor Documentation

lama::OmegaSolver::OmegaSolver ( const std::string &  id)

Creates a solver with the given id.

Parameters:
[in]idThe id of the solver.
lama::OmegaSolver::OmegaSolver ( const std::string &  id,
const Scalar  omega 
)

Creates a solver with the given id and omega.

Parameters:
[in]idThe id of the solver.
[in]omegaThe omega parameter which is used by the jacobi solver.
lama::OmegaSolver::OmegaSolver ( const std::string &  id,
LoggerPtr  logger 
)

Creates a solver with the given id and logger.

Parameters:
[in]idThe id of the solver.
[in]loggerThe logger which is used by this solver.
lama::OmegaSolver::OmegaSolver ( const std::string &  id,
const Scalar  omega,
LoggerPtr  logger 
)

Creates a solver with the given id, omega and logger.

Parameters:
[in]idThe id of the solver.
[in]omegaThe omega parameter which is used by the jacobi solver.
[in]loggerThe logger used by the solver.

Copy constructor that copies the status independent solver information.

Destructor.


Member Function Documentation

virtual SolverPtr lama::OmegaSolver::copy ( ) [pure virtual]

Copies the status independent solver informations to create a new instance of the same type.

Returns:
shared pointer of the copied solver

Implements lama::IterativeSolver.

Implemented in lama::SpecializedJacobi, lama::DefaultJacobi, and lama::SOR.

bool lama::IterativeSolver::criteriaAreSatisfied ( ) const [protected, inherited]

Checks if all of the stopping criteria are satisfied.

return Whether the criteria are satisfied or not

References lama::Solver::getId(), LAMA_THROWEXCEPTION, and lama::IterativeSolver::mCriterionRootComponent.

Referenced by lama::IterativeSolver::solveImpl().

const Matrix & lama::Solver::getCoefficients ( ) const [inherited]

Gets the matrix A from A*u=f.

Returns:
The coefficient matrix A.

References lama::Solver::getConstRuntime(), LAMA_ASSERT_DEBUG, and lama::Solver::SolverRuntime::mCoefficients.

Referenced by lama::InverseSolver::invert(), and lama::LUSolver::piamax_own().

virtual const OmegaSolverRuntime& lama::OmegaSolver::getConstRuntime ( ) const [pure virtual]

Returns the complete const configuration of the derived class.

Implements lama::IterativeSolver.

Implemented in lama::DefaultJacobi, lama::SpecializedJacobi, and lama::SOR.

const std::string & lama::Solver::getId ( ) const [inherited]

Returns the ID of this solver.

Returns:
The ID of this solver.

References lama::Solver::mId.

Referenced by lama::IterativeSolver::criteriaAreSatisfied(), lama::IterativeSolver::solveImpl(), and lama::SolverConfigGrammar::SolverConfigGrammar().

Returns omega.

Returns:
Omega.

References mOmega.

returns the preconditioner of this solver

Returns:
the preconditioner

References lama::IterativeSolver::mPreconditioner.

Referenced by lama::MetaSolver::initializePreconditioner(), and lama::IterativeSolver::IterativeSolver().

Returns the complete configuration of the derived class.

Implements lama::IterativeSolver.

Implemented in lama::DefaultJacobi, lama::SpecializedJacobi, and lama::SOR.

void lama::OmegaSolver::initialize ( const Matrix coefficients) [virtual]

This abstract method is used by derived solvers to initialize a omega solver.

Reimplemented from lama::IterativeSolver.

Reimplemented in lama::DefaultJacobi, lama::DefaultJacobi, lama::SOR, and lama::SpecializedJacobi.

virtual void lama::OmegaSolver::iterate ( ) [protected, pure virtual]

This abstract method is used by derived solvers to represent a solver iteration.

Implements lama::IterativeSolver.

Implemented in lama::DefaultJacobi, lama::DefaultJacobi, lama::SpecializedJacobi, and lama::SOR.

Reimplemented from lama::IterativeSolver.

Reimplemented in lama::DefaultJacobi, and lama::SOR.

void lama::IterativeSolver::logStartSolve ( ) [protected, inherited]
void lama::Solver::setContext ( ContextPtr  context) [virtual, inherited]

Sets the context where this solver should be executed.

Sets the context where this solver should be executed. Caution: This overrides the context of the coefficients matrix A from A * u = f used to inializ this solver.

Parameters:
[in]contextthe context where this solver should be executed.

Reimplemented in lama::InverseSolver.

References lama::Solver::mContext.

Referenced by lama::GMRES::initialize().

void lama::Solver::setLogger ( LoggerPtr  logger) [inherited]

Redefines mLogger.

References lama::Solver::mLogger.

void lama::Solver::setLogLevel ( LogLevel::LogLevel  level) [inherited]

Switches the loglevel of mLogger.

Returns:

References lama::Solver::mLogger.

void lama::OmegaSolver::setOmega ( const Scalar  omega)

Sets the omega parameter of this.

Parameters:
[in]omegaThe omega parameter of the omega solver.

References mOmega.

void lama::IterativeSolver::setPreconditioner ( SolverPtr const  conditioner) [inherited]

Sets the preconditioner of this solver.

Preconditioner should be set before initializing the this solver, otherwise the preconditioner initialization should be executed manually

Parameters:
conditionerThe preconditioner

References lama::IterativeSolver::mPreconditioner.

void lama::IterativeSolver::setStoppingCriterion ( const CriterionPtr  criterion) [inherited]

set a new StoppingCriterion to the solver.

Parameters:
[in]criterionthe new criterion.

References LAMA_ASSERT_ERROR, and lama::IterativeSolver::mCriterionRootComponent.

Referenced by lama::SingleGridSetup::initialize().

void lama::Solver::solve ( Vector solution,
const Vector rhs 
) [virtual, inherited]

Solves the equation system based on the given rhs.

The solver needs to be initialized first with the matrix from the equation to solve, e.g. A from A*u=f (call solver::initialize(A) for example) This method is abstract. It has to be implemented by a class which inherits from this class.

Parameters:
rhsThe right hand side of A*u=f.
solutionThe solution from A*u=f. Mostly used as starting solution for an IterativeSolver.

Reimplemented in lama::LUSolver, lama::DefaultJacobi, and lama::SpecializedJacobi.

References lama::Solver::getConstRuntime(), LAMA_REGION, lama::Solver::solveFinalize(), lama::Solver::solveImpl(), and lama::Solver::solveInit().

Referenced by lama::SimpleAMG::cycle().

void lama::Solver::solveFinalize ( ) [virtual, inherited]

Finalizes the solving process.

Reimplemented in lama::DefaultJacobi, and lama::SpecializedJacobi.

Referenced by lama::Solver::solve().

void lama::IterativeSolver::solveImpl ( ) [virtual, inherited]

Solves the equation system.

Rhs and starting solution have to be initialized first! (call solveInit( rhs, solution ) ). The solver needs to be initialized first with the matrix from the equation to solve, e.g. A from A*u=f (call solver::initialize(A) for example)

This method solves the equation system by using the given rhs and solution. For most iterative solvers the solution-vector is used as a starting solution for the solve process. This class does not take responsibility for deleting the vectors after the solver! Make sure you do not delete the vectors during the solver process.

Implements lama::Solver.

References lama::IterativeSolver::criteriaAreSatisfied(), lama::IterativeSolver::getConstRuntime(), lama::Solver::getId(), lama::IterativeSolver::getRuntime(), lama::IterativeSolver::iterate(), LAMA_THROWEXCEPTION, lama::IterativeSolver::logEndSolve(), lama::IterativeSolver::logIterationEndAndResidual(), lama::IterativeSolver::logIterationStart(), lama::IterativeSolver::logStartSolve(), and lama::IterativeSolver::IterativeSolverRuntime::mIterations.

Referenced by lama::SpecializedJacobi::solve(), and lama::DefaultJacobi::solve().

void lama::Solver::solveInit ( Vector solution,
const Vector rhs 
) [virtual, inherited]
void lama::Solver::writeAt ( std::ostream &  stream) const [protected, virtual, inherited]

Overrides Printable::writeAt with more useful stuff.

Reimplemented from Printable.

References lama::Solver::mId.


Field Documentation

ContextPtr lama::Solver::mContext [protected, inherited]

For forcing the context solver dependent.

If the context for a solver is set, the context of the input matrix will be ignored

Referenced by lama::SpecializedJacobi::iterateTyped(), lama::InverseSolver::setContext(), and lama::Solver::setContext().


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