LAMA
lama::MetaSolver Class Reference

#include <MetaSolver.hpp>

Inheritance diagram for lama::MetaSolver:

Data Structures

struct  MetaSolverRuntime

Public Types

typedef std::string::const_iterator StringIterator

Public Member Functions

 MetaSolver (const std::string &id)
 Creates a solver with a given ID.
 MetaSolver (const std::string &id, LoggerPtr logger)
 Create a solver with a given ID and a given logger.
 MetaSolver (const std::string &id, const std::string &configuration)
 Create a solver with a given ID and a default-logger.
 MetaSolver (const std::string &id, const std::string &configuration, LoggerPtr logger)
 Create a solver with a given ID and a given logger.
 MetaSolver (const MetaSolver &other)
virtual ~MetaSolver ()
 virtual destructor of MetaSolver
virtual void initialize (const Matrix &coefficients)
 Used to initialize a solver with a certain matrix A from A*u=f.
virtual void initializePreconditioner (const Matrix &coefficients, LogLevel::LogLevel level)
 Used to initialize the preconditioner of a solver with a different matrix A'.
virtual void solveImpl ()
 Solves the equation system based on the given rhs.
void interpreteArgument (const std::string arg)
void parseConfiguration (const std::string &configuration)
virtual const MetaSolverRuntimegetConstRuntime () const
 Returns the complete const configuration of the derived class.
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 writeAt (std::ostream &stream) const
 Overrides Printable::writeAt with more useful stuff.

Protected Attributes

std::string mId
 The ID of this solver.
LoggerPtr mLogger
 The solver logger.
ContextPtr mContext
 For forcing the context solver dependent.

Private Member Functions

virtual SolverPtr copy ()
 Copies the status independent solver informations to create a new instance of the same type.
virtual MetaSolverRuntimegetRuntime ()
 Returns the complete configuration of the derived class.
 LAMA_LOG_DECL_STATIC_LOGGER (logger)

Private Attributes

MetaSolverRuntime mMetaSovlerRuntime

Member Typedef Documentation

typedef std::string::const_iterator lama::MetaSolver::StringIterator

Constructor & Destructor Documentation

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

Creates a solver with a given ID.

Parameters:
idThe ID for the solver.
lama::MetaSolver::MetaSolver ( const std::string &  id,
LoggerPtr  logger 
)

Create a solver with a given ID and a given logger.

Parameters:
idThe ID of the solver.
loggerThe logger which shall be used by the solver
lama::MetaSolver::MetaSolver ( const std::string &  id,
const std::string &  configuration 
)

Create a solver with a given ID and a default-logger.

The solver configuration is defined by a std::string.

Parameters:
idThe ID of the solver.
configurationConfiguration for solver(s)

References interpreteArgument().

lama::MetaSolver::MetaSolver ( const std::string &  id,
const std::string &  configuration,
LoggerPtr  logger 
)

Create a solver with a given ID and a given logger.

The solver configuration is defined by a std::string.

Parameters:
idThe ID of the solver.
configurationConfiguration for solver(s)
loggerThe logger which shall be used by the solver

References interpreteArgument().

virtual destructor of MetaSolver


Member Function Documentation

SolverPtr lama::MetaSolver::copy ( ) [private, 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::Solver.

References LAMA_THROWEXCEPTION.

Referenced by interpreteArgument().

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

Returns the complete const configuration of the derived class.

Implements lama::Solver.

References mMetaSovlerRuntime.

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 the complete configuration of the derived class.

Implements lama::Solver.

References mMetaSovlerRuntime.

Referenced by initialize(), initializePreconditioner(), parseConfiguration(), and solveImpl().

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

Used to initialize a solver with a certain matrix A from A*u=f.

This method initializes a solver with a certain coefficient-matrix. The only thing it does is storing the matrix pointer as a member for derived solver classes to use it. The caller delegates the property of the pointer to the Solver instance.

This method may be overwritten by base classes which desire more complex initialization.

Parameters:
coefficientsThe matrix A from A*u=f.

Reimplemented from lama::Solver.

References getRuntime(), LAMA_THROWEXCEPTION, and lama::MetaSolver::MetaSolverRuntime::mRootSolver.

void lama::MetaSolver::initializePreconditioner ( const Matrix coefficients,
LogLevel::LogLevel  level 
) [virtual]

Used to initialize the preconditioner of a solver with a different matrix A'.

This method initializes a solver with a certain coefficient-matrix. The only thing it does is storing the matrix pointer as a member for derived solver classes to use it. The caller delegates the property of the pointer to the Solver instance.

This method may be overwritten by base classes which desire more complex initialization.

Parameters:
coefficientsThe matrix A from A*u=f.

References lama::IterativeSolver::getPreconditioner(), getRuntime(), LAMA_THROWEXCEPTION, and lama::MetaSolver::MetaSolverRuntime::mRootSolver.

void lama::MetaSolver::interpreteArgument ( const std::string  arg)

References copy(), and parseConfiguration().

Referenced by MetaSolver().

Reimplemented from lama::Solver.

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::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::MetaSolver::solveImpl ( ) [virtual]

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.

Implements lama::Solver.

References getRuntime(), LAMA_THROWEXCEPTION, and lama::MetaSolver::MetaSolverRuntime::mRootSolver.

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: