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
typedef boost::shared_ptr
< Preconditioner< T > > 
preconditioner_ptrtype

Public Member Functions

 SolverLinear ()
 SolverLinear (po::variables_map const &vm)
virtual ~SolverLinear ()
WorldComm const & worldComm () const
void setWorldComm (WorldComm const &worldComm)
bool initialized () const
virtual void clear ()
virtual void init ()=0
po::variables_map vm () const
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)
void attachPreconditioner (preconditioner_ptrtype preconditioner)
void setFieldSplitType (const FieldSplitType fst)
FieldSplitType fieldSplitType () const
void setMatSolverPackageType (const MatSolverPackageType mspackt)
MatSolverPackageType matSolverPackageType () const
virtual MatrixStructure precMatrixStructure () const
virtual void setPrecMatrixStructure (MatrixStructure mstruct)
virtual boost::tuple< bool,
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 boost::tuple< bool,
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

po::variables_map M_vm
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
preconditioner_ptrtype M_preconditioner
FieldSplitType _M_fieldSplit_type
MatSolverPackageType M_matSolverPackage_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 ( po::variables_map const &  vm) [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>
void Feel::SolverLinear< T >::attachPreconditioner ( preconditioner_ptrtype  preconditioner) [inline]

Attaches a Preconditioner object to be used by the solver

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>
MatSolverPackageType Feel::SolverLinear< T >::matSolverPackageType ( ) const [inline]

Returns the type of preconditioner to use.

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>
void Feel::SolverLinear< T >::setMatSolverPackageType ( const MatSolverPackageType  mspackt) [inline]

Sets the type of preconditioner to use.

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.

Referenced by Feel::SolverLinearPetsc< T >::SolverLinearPetsc().

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

Sets the type of solver to use.

template<typename T>
virtual boost::tuple<bool,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>
virtual boost::tuple<bool,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>
SolverType Feel::SolverLinear< T >::solverType ( ) const [inline]

Returns the type of solver to use.

template<typename T>
po::variables_map Feel::SolverLinear< T >::vm ( ) const [inline]

return variables_map


Member Data Documentation

template<typename T>
bool Feel::SolverLinear< T >::_M_is_initialized [protected]
template<typename T>
PreconditionerType Feel::SolverLinear< T >::_M_preconditioner_type [protected]
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().

template<typename T>
MatSolverPackageType Feel::SolverLinear< T >::M_matSolverPackage_type [protected]

Enum the software that is used to perform the factorization

Referenced by Feel::SolverLinear< double >::matSolverPackageType(), and Feel::SolverLinear< double >::setMatSolverPackageType().

template<typename T>
preconditioner_ptrtype Feel::SolverLinear< T >::M_preconditioner [protected]