Feel++  0.91.4
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
Feel::SolverLinear< T > Class Template Reference

#include <solverlinear.hpp>

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

Destructor.


Member Function Documentation

template<typename T >
value_type Feel::SolverLinear< T >::aTolerance ( ) const
inline
Returns:
the absolute tolerance

References Feel::SolverLinear< T >::M_atolerance.

template<typename T >
void Feel::SolverLinear< T >::attachPreconditioner ( preconditioner_ptrtype  preconditioner)
inline
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

References Feel::SolverLinear< T >::M_atolerance, Feel::SolverLinear< T >::M_dtolerance, Feel::SolverLinear< T >::M_maxit, and Feel::SolverLinear< T >::M_rtolerance.

template<typename T >
virtual void Feel::SolverLinear< T >::clear ( )
inlinevirtual

Release all memory and clear data structures.

template<typename T >
value_type Feel::SolverLinear< T >::dTolerance ( ) const
inline
Returns:
the divergence tolerance

References Feel::SolverLinear< T >::M_dtolerance.

template<typename T >
virtual void Feel::SolverLinear< T >::init ( )
pure virtual

Initialize data structures if not done so already.

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

template<typename T >
bool Feel::SolverLinear< T >::initialized ( ) const
inline
Returns:
true if the data structures are initialized, false otherwise.

References Feel::SolverLinear< T >::_M_is_initialized.

template<typename T >
MatSolverPackageType Feel::SolverLinear< T >::matSolverPackageType ( ) const
inline

Returns the type of preconditioner to use.

References Feel::SolverLinear< T >::M_matSolverPackage_type.

template<typename T >
size_type Feel::SolverLinear< T >::maxIterations ( ) const
inline
Returns:
the maximum number of iterations

References Feel::SolverLinear< T >::M_maxit.

template<typename T >
virtual MatrixStructure Feel::SolverLinear< T >::precMatrixStructure ( ) const
inlinevirtual
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.

References Feel::SolverLinear< T >::_M_preconditioner_type, and Feel::SolverLinear< T >::M_preconditioner.

template<typename T >
value_type Feel::SolverLinear< T >::rTolerance ( ) const
inline
Returns:
the relative tolerance

References Feel::SolverLinear< T >::M_rtolerance.

template<typename T >
void Feel::SolverLinear< T >::setInitialized ( bool  init)
inlineprotected

set initialized only for subclasses

References Feel::SolverLinear< T >::_M_is_initialized, and Feel::SolverLinear< T >::init().

template<typename T >
void Feel::SolverLinear< T >::setMatSolverPackageType ( const MatSolverPackageType  mspackt)
inline

Sets the type of preconditioner to use.

References Feel::SolverLinear< T >::M_matSolverPackage_type.

template<typename T >
virtual void Feel::SolverLinear< T >::setPrecMatrixStructure ( MatrixStructure  mstruct)
inlinevirtual
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.

References Feel::SolverLinear< T >::_M_preconditioner_type, and Feel::SolverLinear< T >::M_preconditioner.

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

Sets the type of solver to use.

References Feel::SolverLinear< T >::_M_solver_type.

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
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
template<typename T >
SolverType Feel::SolverLinear< T >::solverType ( ) const
inline

Returns the type of solver to use.

References Feel::SolverLinear< T >::_M_solver_type.

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

Flag indicating if the data structures have been initialized.

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

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< T >::setSolverType(), and Feel::SolverLinear< T >::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< T >::matSolverPackageType(), and Feel::SolverLinear< T >::setMatSolverPackageType().

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