Feel++ 0.91.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

Feel::SolverLinear< T > Class Template Reference

#include <solverlinear.hpp>

Inheritance diagram for Feel::SolverLinear< T >:
Feel::SolverLinearPetsc< T >

List of all members.

Public Types

typedef SolverLinear< T > self_type
typedef boost::shared_ptr
< SolverLinear< T > > 
self_ptrtype
typedef T value_type
typedef type_traits< T >::real_type real_type

Public Member Functions

 SolverLinear ()
virtual ~SolverLinear ()
bool initialized () const
virtual void clear ()
virtual void init ()=0
value_type rTolerance () const
value_type dTolerance () const
value_type aTolerance () const
SolverType solverType () const
size_type maxIterations () const
 BOOST_PARAMETER_MEMBER_FUNCTION ((void), setTolerances, tag,(required(rtolerance,(double)))(optional(maxit,(size_type), 1000)(atolerance,(double), 1e-50)(dtolerance,(double), 1e5)))
void setSolverType (const SolverType st)
PreconditionerType preconditionerType () const
void setPreconditionerType (const PreconditionerType pct)
virtual MatrixStructure precMatrixStructure () const
virtual void setPrecMatrixStructure (MatrixStructure mstruct)
virtual std::pair< unsigned
int, real_type > 
solve (MatrixSparse< T > const &mat, Vector< T > &x, Vector< T > const &b, const double tolerance, const unsigned int maxit, bool transpose)=0
virtual std::pair< unsigned
int, real_type > 
solve (MatrixSparse< T > const &mat, MatrixSparse< T > const &prec, Vector< T > &x, Vector< T > const &b, const double tolerance, const unsigned int maxit, bool transpose)=0

Protected Member Functions

void setInitialized (bool init)

Protected Attributes

double M_rtolerance
 relative tolerance
double M_dtolerance
 divergence tolerance
double M_atolerance
 absolute tolerance
size_type M_maxit
 maximum number of iterations
SolverType _M_solver_type
PreconditionerType _M_preconditioner_type
bool _M_is_initialized
MatrixStructure M_prec_matrix_structure

Detailed Description

template<typename T>
class Feel::SolverLinear< T >

This class provides a uniform interface for linear solvers. This base class is overloaded to provide linear solvers from different packages like FEEL, GMM or PETSC

Author:
Benjamin Kirk, 2003
Christophe Prud'homme, 2005

Constructor & Destructor Documentation

template<typename T >
Feel::SolverLinear< T >::SolverLinear ( ) [inline]

Constructor. Initializes Solver data structures

template<typename T >
Feel::SolverLinear< T >::~SolverLinear ( ) [inline, virtual]

Destructor.


Member Function Documentation

template<typename T>
value_type Feel::SolverLinear< T >::aTolerance ( ) const [inline]
Returns:
the absolute tolerance
template<typename T>
Feel::SolverLinear< T >::BOOST_PARAMETER_MEMBER_FUNCTION ( (void)  ,
setTolerances  ,
tag  ,
(required(rtolerance,(double)))(optional(maxit,(size_type), 1000)(atolerance,(double), 1e-50)(dtolerance,(double), 1e5))   
) [inline]

set tolerances: relative tolerance rtol, divergence tolerance dtol and absolute tolerance atol

template<typename T>
virtual void Feel::SolverLinear< T >::clear ( ) [inline, virtual]

Release all memory and clear data structures.

Reimplemented in Feel::SolverLinearPetsc< T >, and Feel::SolverLinearPetsc< double >.

template<typename T>
value_type Feel::SolverLinear< T >::dTolerance ( ) const [inline]
Returns:
the divergence tolerance
template<typename T>
virtual void Feel::SolverLinear< T >::init ( ) [pure virtual]

Initialize data structures if not done so already.

Implemented in Feel::SolverLinearPetsc< T >, and Feel::SolverLinearPetsc< double >.

Referenced by Feel::SolverLinear< double >::setInitialized().

template<typename T>
bool Feel::SolverLinear< T >::initialized ( ) const [inline]
Returns:
true if the data structures are initialized, false otherwise.
template<typename T>
size_type Feel::SolverLinear< T >::maxIterations ( ) const [inline]
Returns:
the maximum number of iterations
template<typename T>
virtual MatrixStructure Feel::SolverLinear< T >::precMatrixStructure ( ) const [inline, virtual]
Returns:
the preconditioner matrix structure it may not be relevant to all non linear solvers
template<typename T>
PreconditionerType Feel::SolverLinear< T >::preconditionerType ( ) const [inline]

Returns the type of preconditioner to use.

template<typename T>
value_type Feel::SolverLinear< T >::rTolerance ( ) const [inline]
Returns:
the relative tolerance
template<typename T>
void Feel::SolverLinear< T >::setInitialized ( bool  init) [inline, protected]

set initialized only for subclasses

template<typename T>
virtual void Feel::SolverLinear< T >::setPrecMatrixStructure ( MatrixStructure  mstruct) [inline, virtual]
Returns:
the preconditioner matrix structure it may not be relevant to all non linear solvers
template<typename T>
void Feel::SolverLinear< T >::setPreconditionerType ( const PreconditionerType  pct) [inline]

Sets the type of preconditioner to use.

template<typename T>
void Feel::SolverLinear< T >::setSolverType ( const SolverType  st) [inline]

Sets the type of solver to use.

template<typename T>
virtual std::pair<unsigned int, real_type> Feel::SolverLinear< T >::solve ( MatrixSparse< T > const &  mat,
MatrixSparse< T > const &  prec,
Vector< T > &  x,
Vector< T > const &  b,
const double  tolerance,
const unsigned int  maxit,
bool  transpose 
) [pure virtual]

This function calls the solver "_M_solver_type" preconditioned with the "_M_preconditioner_type" preconditioner. Note that this method will compute the preconditioner from the system matrix.

Parameters:
matSystem Matrix
precPreconditioning Matrix
xSolution vector
bRHS vector
toleranceStopping tolerance
maxitmaximum Number of Iterations
transposetrue to solve the transpose system, false otherwise

Implemented in Feel::SolverLinearPetsc< T >, and Feel::SolverLinearPetsc< double >.

template<typename T>
virtual std::pair<unsigned int, real_type> Feel::SolverLinear< T >::solve ( MatrixSparse< T > const &  mat,
Vector< T > &  x,
Vector< T > const &  b,
const double  tolerance,
const unsigned int  maxit,
bool  transpose 
) [pure virtual]

This function calls the solver "_M_solver_type" preconditioned with the "_M_preconditioner_type" preconditioner. Note that this method will compute the preconditioner from the system matrix.

Parameters:
matSystem Matrix
precPreconditioning Matrix
xSolution vector
bRHS vector
toleranceStopping tolerance
maxitmaximum Number of Iterations
transposetrue to solve the transpose system, false otherwise

Implemented in Feel::SolverLinearPetsc< T >, and Feel::SolverLinearPetsc< double >.

template<typename T>
SolverType Feel::SolverLinear< T >::solverType ( ) const [inline]

Returns the type of solver to use.


Member Data Documentation

template<typename T>
bool Feel::SolverLinear< T >::_M_is_initialized [protected]

Flag indicating if the data structures have been initialized.

Referenced by Feel::SolverLinear< double >::initialized(), and Feel::SolverLinear< double >::setInitialized().

template<typename T>
PreconditionerType Feel::SolverLinear< T >::_M_preconditioner_type [protected]

Enum statitng with type of preconditioner to use.

Referenced by Feel::SolverLinear< double >::preconditionerType(), and Feel::SolverLinear< double >::setPreconditionerType().

template<typename T>
SolverType Feel::SolverLinear< T >::_M_solver_type [protected]

Enum stating which type of iterative solver to use.

Referenced by Feel::SolverLinear< double >::setSolverType(), and Feel::SolverLinear< double >::solverType().