LifeV
SolverAmesos Class Reference

SolverAmesos - Class to wrap linear solver. More...

#include <SolverAmesos.hpp>

+ Collaboration diagram for SolverAmesos:

Private Attributes

matrix_type::matrix_ptrtype M_matrix
 
Epetra_LinearProblem M_problem
 
Amesos_BaseSolver * M_solver
 
Teuchos::ParameterList M_trilinosParameterList
 
Displayer M_displayer
 

Public Types

typedef Real value_type
 
typedef Displayer::commPtr_Type commPtr_Type
 
typedef SolverAmesos solver_type
 
typedef MatrixEpetra< Realmatrix_type
 
typedef VectorEpetra vector_type
 
typedef void prec_raw_type
 
typedef std::shared_ptr< prec_raw_typeprec_type
 
typedef std::shared_ptr< matrix_typematrix_ptrtype
 
typedef std::shared_ptr< VectorEpetravector_ptrtype
 

Constructors & Destructor

 SolverAmesos (const commPtr_Type &comm)
 Default constructor. More...
 
 ~SolverAmesos ()
 Destructor. More...
 

Methods

Real computeResidual (const vector_type &solution, const vector_type &rhs)
 Compute the residual. More...
 
Int solveSystem (vector_type &rhsFull, vector_type &solution, const matrix_ptrtype &)
 Solves the system and returns the number of iterations. More...
 
void printStatus ()
 Display status of the solver. More...
 
bool isPreconditionerSet () const
 Return true if the preconditioner is set. More...
 
void resetPreconditioner ()
 Delete the stored preconditioner. More...
 
void setupPreconditioner (const GetPot &dataFile, const std::string &section)
 Setup the preconditioner. More...
 
void setReusePreconditioner (const bool &)
 Specify if the preconditioner should be reuse or not. More...
 
void showMe (std::ostream &output=std::cout) const
 Print informations about the solver. More...
 

Set Methods

Int setMatrix (const matrix_type &matrix)
 Set matrix from MatrixEpetra. More...
 
void setOperator (const Epetra_Operator &oper)
 Method to set a general linear operator (of class derived from Epetra_Operator) defining the linear system. More...
 
void setDataFromGetPot (const GetPot &dataFile, const std::string &section)
 Method to setup the solver using GetPot. More...
 
template<typename ParameterType >
void setParameter (const std::string &name, const ParameterType value)
 Set a parameter in the list. More...
 
void setParameters ()
 Set the current parameters with the internal parameters list. More...
 
void setParametersList (const Teuchos::ParameterList &list)
 Set the current parameters list. More...
 
void setTolerance (const Real tolerance)
 Set the tolerance of the solver. More...
 
void setMaxNumIterations (const Int maxIter=-1)
 Set the tolerance and the maximum number of iterations. More...
 

Get Methods

Int numIterations ()
 Return the total number of iterations. More...
 
Real trueResidual ()
 Return the true residual. More...
 
const Teuchos::ParameterList & parametersList () const
 Get the current parameters list. More...
 

Private Methods

void createSolver (const std::string &solverType)
 Create a solver using a factory. More...
 

Detailed Description

SolverAmesos - Class to wrap linear solver.

Author
Simone Deparis simon.nosp@m.e.de.nosp@m.paris.nosp@m.@epf.nosp@m.l.ch
Gilles Fourestey gille.nosp@m.s.fo.nosp@m.urest.nosp@m.ey@e.nosp@m.pfl.c.nosp@m.h

Definition at line 62 of file SolverAmesos.hpp.

Member Typedef Documentation

◆ value_type

typedef Real value_type

Definition at line 69 of file SolverAmesos.hpp.

◆ commPtr_Type

Definition at line 71 of file SolverAmesos.hpp.

◆ solver_type

Definition at line 73 of file SolverAmesos.hpp.

◆ matrix_type

Definition at line 75 of file SolverAmesos.hpp.

◆ vector_type

Definition at line 76 of file SolverAmesos.hpp.

◆ prec_raw_type

typedef void prec_raw_type

Definition at line 78 of file SolverAmesos.hpp.

◆ prec_type

typedef std::shared_ptr<prec_raw_type> prec_type

Definition at line 79 of file SolverAmesos.hpp.

◆ matrix_ptrtype

typedef std::shared_ptr<matrix_type> matrix_ptrtype

Definition at line 80 of file SolverAmesos.hpp.

◆ vector_ptrtype

typedef std::shared_ptr<VectorEpetra> vector_ptrtype

Definition at line 81 of file SolverAmesos.hpp.

Constructor & Destructor Documentation

◆ SolverAmesos()

SolverAmesos ( const commPtr_Type comm)

Default constructor.

Parameters
commThe communicator.

Definition at line 49 of file SolverAmesos.cpp.

+ Here is the caller graph for this function:

◆ ~SolverAmesos()

~SolverAmesos ( )
inline

Destructor.

Definition at line 96 of file SolverAmesos.hpp.

Member Function Documentation

◆ computeResidual()

Real computeResidual ( const vector_type solution,
const vector_type rhs 
)

Compute the residual.

Parameters
solutionSolution vector
rhsRight hand side of the system

Definition at line 62 of file SolverAmesos.cpp.

◆ solveSystem()

Int solveSystem ( vector_type rhsFull,
vector_type solution,
const matrix_ptrtype  
)

Solves the system and returns the number of iterations.

returns number of iterations. If negative, the solver did not converge, the preconditionar has been recomputed, and a second solution is tried

Parameters
rhsFullRight hand side vector
solutionVector to store the solution

Definition at line 77 of file SolverAmesos.cpp.

◆ printStatus()

void printStatus ( )

Display status of the solver.

Definition at line 106 of file SolverAmesos.cpp.

◆ isPreconditionerSet()

bool isPreconditionerSet ( ) const

Return true if the preconditioner is set.

Note: This method always return true!

Definition at line 142 of file SolverAmesos.cpp.

◆ resetPreconditioner()

void resetPreconditioner ( )

Delete the stored preconditioner.

Note: This method is empty

Definition at line 147 of file SolverAmesos.cpp.

◆ setupPreconditioner()

void setupPreconditioner ( const GetPot dataFile,
const std::string &  section 
)

Setup the preconditioner.

Note: This method is empty

Parameters
dataFileGetPot object which contains the data about the preconditioner
sectionSection the GetPot structure where to find the informations about the preconditioner

Definition at line 152 of file SolverAmesos.cpp.

◆ setReusePreconditioner()

void setReusePreconditioner ( const bool &  )

Specify if the preconditioner should be reuse or not.

Note: This method is empty

Parameters
reusePreconditionerIf set to true, do not recompute the preconditioner

Definition at line 157 of file SolverAmesos.cpp.

◆ showMe()

void showMe ( std::ostream &  output = std::cout) const

Print informations about the solver.

Definition at line 162 of file SolverAmesos.cpp.

◆ setMatrix()

Int setMatrix ( const matrix_type matrix)

Set matrix from MatrixEpetra.

Parameters
matrixMatrix of the system

Definition at line 170 of file SolverAmesos.cpp.

◆ setOperator()

void setOperator ( const Epetra_Operator oper)

Method to set a general linear operator (of class derived from Epetra_Operator) defining the linear system.

Parameters
operOperator for the system

Definition at line 182 of file SolverAmesos.cpp.

◆ setDataFromGetPot()

void setDataFromGetPot ( const GetPot dataFile,
const std::string &  section 
)

Method to setup the solver using GetPot.

Parameters
dataFileGetPot object which contains the data about the solver

Definition at line 187 of file SolverAmesos.cpp.

◆ setParameter()

void setParameter ( const std::string &  name,
const ParameterType  value 
)
inline

Set a parameter in the list.

Parameters
namename of the parameter
valuevalue of the parameter

Definition at line 188 of file SolverAmesos.hpp.

◆ setParameters()

void setParameters ( )

Set the current parameters with the internal parameters list.

Note: The parameter list is set using "setDataFromGetPot".

Parameters
cerrWarningIfUnusedIf true the solver return warning if some parameters are unused

Definition at line 211 of file SolverAmesos.cpp.

◆ setParametersList()

void setParametersList ( const Teuchos::ParameterList &  list)
inline

Set the current parameters list.

Parameters
listTeuchos parameters list

Definition at line 204 of file SolverAmesos.hpp.

◆ setTolerance()

void setTolerance ( const Real  tolerance)

Set the tolerance of the solver.

Parameters
toleranceTolerance for the solver

◆ setMaxNumIterations()

void setMaxNumIterations ( const Int  maxIter = -1)

Set the tolerance and the maximum number of iterations.

Parameters
maxIterMaximum number of iteration

◆ numIterations()

Int numIterations ( )

Return the total number of iterations.

Definition at line 227 of file SolverAmesos.cpp.

◆ trueResidual()

Real trueResidual ( )

Return the true residual.

Definition at line 233 of file SolverAmesos.cpp.

◆ parametersList()

const Teuchos::ParameterList& parametersList ( ) const
inline

Get the current parameters list.

Returns
Teuchos parameters list

Definition at line 237 of file SolverAmesos.hpp.

◆ createSolver()

void createSolver ( const std::string &  solverType)
private

Create a solver using a factory.

Parameters
solverTypeString containing the name of the solver

Definition at line 241 of file SolverAmesos.cpp.

Field Documentation

◆ M_matrix

matrix_type::matrix_ptrtype M_matrix
private

Definition at line 257 of file SolverAmesos.hpp.

◆ M_problem

Epetra_LinearProblem M_problem
private

Definition at line 259 of file SolverAmesos.hpp.

◆ M_solver

Amesos_BaseSolver* M_solver
private

Definition at line 261 of file SolverAmesos.hpp.

◆ M_trilinosParameterList

Teuchos::ParameterList M_trilinosParameterList
private

Definition at line 263 of file SolverAmesos.hpp.

◆ M_displayer

Displayer M_displayer
private

Definition at line 265 of file SolverAmesos.hpp.


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