LifeV
SolverAztecOO Class Reference

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

#include <SolverAztecOO.hpp>

+ Collaboration diagram for SolverAztecOO:

Private Attributes

matrix_type::matrix_ptrtype M_matrix
 
prec_type M_preconditioner
 
AztecOO M_solver
 
Teuchos::ParameterList M_TrilinosParameterList
 
std::shared_ptr< DisplayerM_displayer
 
Real M_tolerance
 
Int M_maxIter
 
Int M_maxIterForReuse
 
bool M_reusePreconditioner
 

Public Types

typedef Real value_type
 
typedef SolverAztecOO solver_type
 
typedef MatrixEpetra< Realmatrix_type
 
typedef VectorEpetra vector_type
 
typedef Preconditioner prec_raw_type
 
typedef std::shared_ptr< prec_raw_typeprec_type
 
typedef std::shared_ptr< Epetra_Operatorcomp_prec_type
 
typedef std::shared_ptr< matrix_typematrix_ptrtype
 
typedef std::shared_ptr< VectorEpetravector_ptrtype
 

Constructors & Destructor

 LIFEV_DEPRECATED (SolverAztecOO())
 Empty constructor. More...
 
 LIFEV_DEPRECATED (SolverAztecOO(const std::shared_ptr< Epetra_Comm > &comm))
 Constructor. More...
 

Methods

Int solve (vector_type &solution, const vector_type &rhs)
 Solve the problem $ A x = b $. More...
 
Real computeResidual (vector_type &solution, vector_type &rhs)
 Compute the residual. More...
 
std::string printStatus ()
 return the Aztec status More...
 
Int solveSystem (const vector_type &rhsFull, vector_type &solution, matrix_ptrtype &baseMatrixForPreconditioner)
 Solves the system and returns the number of iterations. More...
 
template<typename PrecPtrOperator >
Int solveSystem (const vector_type &rhsFull, vector_type &solution, PrecPtrOperator preconditionerPtr)
 Solves the system and returns the number of iterations. More...
 
void setupPreconditioner (const GetPot &dataFile, const std::string &section)
 Setup the preconditioner. More...
 
void buildPreconditioner (matrix_ptrtype &baseMatrixForPreconditioner)
 Builds the preconditioner starting from the matrix "baseMatrixForPreconditioner". More...
 
void resetPreconditioner ()
 Delete the stored preconditioner. More...
 
bool isPreconditionerSet () const
 Return true if preconditioner has been setted. More...
 
void showMe (std::ostream &output=std::cout) const
 Print informations about the solver. More...
 

Set Method

void setCommunicator (const std::shared_ptr< Epetra_Comm > &comm)
 Method to set communicator for Displayer (for empty constructor) More...
 
void setMatrix (matrix_type &matrix)
 Method to set matrix from MatrixEpetra. More...
 
void setOperator (Epetra_Operator &oper)
 Method to set a general linear operator (of class derived from Epetra_Operator) defining the linear system. More...
 
void setPreconditioner (prec_type &preconditioner)
 Method to set an Preconditioner preconditioner. More...
 
void setPreconditioner (comp_prec_type &preconditioner)
 Method to set a general Epetra_Operator as preconditioner. More...
 
void setDataFromGetPot (const GetPot &dataFile, const std::string &section)
 Method to setup the solver using GetPot. More...
 
void setParameters (bool cerrWarningIfUnused=false)
 Set the current parameters with the internal 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...
 
void setReusePreconditioner (const bool reusePreconditioner)
 Specify if the preconditioner should be reuse or not. More...
 
std::shared_ptr< Displayerdisplayer ()
 Return the displayer. More...
 

Get Method

Int numIterations () const
 Return the total number of iterations. More...
 
Int maxNumIterations () const
 Return the maximum total number of iterations. More...
 
Real trueResidual ()
 Return the true residual. More...
 
prec_typepreconditioner ()
 Method to get a shared pointer to the preconditioner (of type derived from Preconditioner)*/. More...
 
void aztecStatus (Real status[AZ_STATUS_SIZE])
 Return the AztecStatus. More...
 
Teuchos::ParameterList & getParametersList ()
 Return a Teuchos parameters list. More...
 
AztecOO & solver ()
 Return a reference on the AztecOO solver. More...
 

Detailed Description

SolverAztecOO - Class to wrap linear solver.

By default the solver is gmres and the preconditioner is ilu.

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 78 of file SolverAztecOO.hpp.

Member Typedef Documentation

◆ value_type

typedef Real value_type

Definition at line 85 of file SolverAztecOO.hpp.

◆ solver_type

Definition at line 87 of file SolverAztecOO.hpp.

◆ matrix_type

Definition at line 89 of file SolverAztecOO.hpp.

◆ vector_type

Definition at line 90 of file SolverAztecOO.hpp.

◆ prec_raw_type

Definition at line 92 of file SolverAztecOO.hpp.

◆ prec_type

typedef std::shared_ptr<prec_raw_type> prec_type

Definition at line 93 of file SolverAztecOO.hpp.

◆ comp_prec_type

typedef std::shared_ptr<Epetra_Operator> comp_prec_type

Definition at line 94 of file SolverAztecOO.hpp.

◆ matrix_ptrtype

typedef std::shared_ptr<matrix_type> matrix_ptrtype

Definition at line 95 of file SolverAztecOO.hpp.

◆ vector_ptrtype

typedef std::shared_ptr<VectorEpetra> vector_ptrtype

Definition at line 96 of file SolverAztecOO.hpp.

Member Function Documentation

◆ LIFEV_DEPRECATED() [1/2]

LIFEV_DEPRECATED ( SolverAztecOO()  )

Empty constructor.

◆ LIFEV_DEPRECATED() [2/2]

LIFEV_DEPRECATED ( SolverAztecOO(const std::shared_ptr< Epetra_Comm > &comm)  )

Constructor.

Parameters
commCommunicator

◆ solve()

Int solve ( vector_type solution,
const vector_type rhs 
)

Solve the problem $ A x = b $.

A has been entered via setMatrix.

Parameters
solutionVector to store the solution rhs Right hand side of the problem
Returns
Number of iterations, M_maxIter+1 if solve failed.

Definition at line 86 of file SolverAztecOO.cpp.

+ Here is the caller graph for this function:

◆ computeResidual()

Real computeResidual ( vector_type solution,
vector_type rhs 
)

Compute the residual.

Parameters
solutionSolution of the system
rhsRight hand side of the problem

Definition at line 137 of file SolverAztecOO.cpp.

◆ printStatus()

std::string printStatus ( )

return the Aztec status

Definition at line 154 of file SolverAztecOO.cpp.

◆ solveSystem() [1/2]

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

Solves the system and returns the number of iterations.

The Matrix has already been passed by the method setMatrix or setOperator

The preconditioner is build starting from the matrix baseMatrixForPreconditioner by the preconditioner object passed in by the method setPreconditioner

Parameters
rhsFullRight hand side
solutionvector to store the solution
baseMatrixForPreconditionerBase matrix for the preconditioner construction
Returns
number of iterations. If negative, the solver did not converge, the preconditioner has been recomputed, and a second solution is tried

Definition at line 192 of file SolverAztecOO.cpp.

+ Here is the caller graph for this function:

◆ solveSystem() [2/2]

Int solveSystem ( const vector_type rhsFull,
vector_type solution,
PrecPtrOperator  preconditionerPtr 
)

Solves the system and returns the number of iterations.

The Matrix has already been passed by the method setMatrix or setOperator

Parameters
rhsFullRight hand side
solutionVector to store the solution
preconditionerPtrPointer on a preconditioner to use (templated parameter, can derive from Preconditioner class or from Epetra_Operator)

Definition at line 305 of file SolverAztecOO.hpp.

◆ setupPreconditioner()

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

Setup the preconditioner.

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 253 of file SolverAztecOO.cpp.

◆ buildPreconditioner()

void buildPreconditioner ( matrix_ptrtype baseMatrixForPreconditioner)

Builds the preconditioner starting from the matrix "baseMatrixForPreconditioner".

The preconditioner is build starting from the matrix baseMatrixForPreconditioner by the preconditioner object passed in by the method setPreconditioner

Parameters
baseMatrixForPreconditionerBase matrix for the preconditioner construction

Definition at line 263 of file SolverAztecOO.cpp.

+ Here is the caller graph for this function:

◆ resetPreconditioner()

void resetPreconditioner ( )

Delete the stored preconditioner.

Definition at line 281 of file SolverAztecOO.cpp.

+ Here is the caller graph for this function:

◆ isPreconditionerSet()

bool isPreconditionerSet ( ) const

Return true if preconditioner has been setted.

Definition at line 287 of file SolverAztecOO.cpp.

+ Here is the caller graph for this function:

◆ showMe()

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

Print informations about the solver.

Definition at line 293 of file SolverAztecOO.cpp.

◆ setCommunicator()

void setCommunicator ( const std::shared_ptr< Epetra_Comm > &  comm)

Method to set communicator for Displayer (for empty constructor)

Parameters
commCommunicator for the displayer

Definition at line 302 of file SolverAztecOO.cpp.

◆ setMatrix()

void setMatrix ( matrix_type matrix)

Method to set matrix from MatrixEpetra.

Parameters
matrixMatrix of the system

Definition at line 307 of file SolverAztecOO.cpp.

◆ setOperator()

void setOperator ( 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 314 of file SolverAztecOO.cpp.

◆ setPreconditioner() [1/2]

void setPreconditioner ( prec_type preconditioner)

Method to set an Preconditioner preconditioner.

Parameters
preconditionerPreconditioner to be used to solve the system

Definition at line 320 of file SolverAztecOO.cpp.

◆ setPreconditioner() [2/2]

void setPreconditioner ( comp_prec_type preconditioner)

Method to set a general Epetra_Operator as preconditioner.

Parameters
preconditionerPreconditioner to be set of type Epetra_Operator

Definition at line 326 of file SolverAztecOO.cpp.

+ Here is the caller graph for this function:

◆ 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 332 of file SolverAztecOO.cpp.

◆ setParameters()

void setParameters ( bool  cerrWarningIfUnused = false)

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 376 of file SolverAztecOO.cpp.

+ Here is the caller graph for this function:

◆ setTolerance()

void setTolerance ( const Real  tolerance)

Set the tolerance of the solver.

Parameters
toleranceTolerance for the solver

Definition at line 382 of file SolverAztecOO.cpp.

◆ setMaxNumIterations()

void setMaxNumIterations ( const Int  maxIter = -1)

Set the tolerance and the maximum number of iterations.

Parameters
maxIterMaximum number of iteration

Definition at line 392 of file SolverAztecOO.cpp.

◆ setReusePreconditioner()

void setReusePreconditioner ( const bool  reusePreconditioner)

Specify if the preconditioner should be reuse or not.

Parameters
reusePreconditionerIf set to true, do not recompute the preconditioner

Definition at line 402 of file SolverAztecOO.cpp.

◆ displayer()

std::shared_ptr< Displayer > displayer ( )

Return the displayer.

Definition at line 408 of file SolverAztecOO.cpp.

◆ numIterations()

Int numIterations ( ) const

Return the total number of iterations.

Definition at line 417 of file SolverAztecOO.cpp.

◆ maxNumIterations()

Int maxNumIterations ( ) const

Return the maximum total number of iterations.

Definition at line 423 of file SolverAztecOO.cpp.

◆ trueResidual()

Real trueResidual ( )

Return the true residual.

Definition at line 430 of file SolverAztecOO.cpp.

◆ preconditioner()

SolverAztecOO::prec_type & preconditioner ( )

Method to get a shared pointer to the preconditioner (of type derived from Preconditioner)*/.

Definition at line 436 of file SolverAztecOO.cpp.

◆ aztecStatus()

void aztecStatus ( Real  status[AZ_STATUS_SIZE])

Return the AztecStatus.

Definition at line 442 of file SolverAztecOO.cpp.

◆ getParametersList()

Teuchos::ParameterList & getParametersList ( )

Return a Teuchos parameters list.

Definition at line 448 of file SolverAztecOO.cpp.

◆ solver()

AztecOO & solver ( )

Return a reference on the AztecOO solver.

Definition at line 454 of file SolverAztecOO.cpp.

Field Documentation

◆ M_matrix

matrix_type::matrix_ptrtype M_matrix
private

Definition at line 290 of file SolverAztecOO.hpp.

◆ M_preconditioner

prec_type M_preconditioner
private

Definition at line 291 of file SolverAztecOO.hpp.

◆ M_solver

AztecOO M_solver
private

Definition at line 293 of file SolverAztecOO.hpp.

◆ M_TrilinosParameterList

Teuchos::ParameterList M_TrilinosParameterList
private

Definition at line 295 of file SolverAztecOO.hpp.

◆ M_displayer

std::shared_ptr<Displayer> M_displayer
private

Definition at line 296 of file SolverAztecOO.hpp.

◆ M_tolerance

Real M_tolerance
private

Definition at line 298 of file SolverAztecOO.hpp.

◆ M_maxIter

Int M_maxIter
private

Definition at line 299 of file SolverAztecOO.hpp.

◆ M_maxIterForReuse

Int M_maxIterForReuse
private

Definition at line 300 of file SolverAztecOO.hpp.

◆ M_reusePreconditioner

bool M_reusePreconditioner
private

Definition at line 301 of file SolverAztecOO.hpp.


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