Logo  0.95.0-final
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ community
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Feel::SolverLinear< T > Class Template Referenceabstract

#include <solverlinear.hpp>

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

Public Types

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

Public Member Functions

value_type aTolerance () const
 
void attachPreconditioner (preconditioner_ptrtype preconditioner)
 
virtual void clear ()
 
value_type dTolerance () const
 
FieldSplitType fieldSplitType () const
 
virtual void init ()=0
 
bool initialized () const
 
MatSolverPackageType matSolverPackageType () const
 
size_type maxIterations () const
 
virtual MatrixStructure precMatrixStructure () const
 
PreconditionerType preconditionerType () const
 
std::string const & prefix () const
 
value_type rTolerance () const
 
void setFieldSplitType (const FieldSplitType fst)
 
void setMatSolverPackageType (const MatSolverPackageType mspackt)
 
virtual void setPrecMatrixStructure (MatrixStructure mstruct)
 
void setPreconditionerType (const PreconditionerType pct)
 
void setPrefix (std::string const &p)
 
void setShowKSPConvergedReason (bool b)
 
void setShowKSPMonitor (bool b)
 
void setSolverType (const SolverType st)
 
void setWorldComm (WorldComm const &worldComm)
 
bool showKSPConvergedReason () const
 
bool showKSPMonitor () const
 
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
 
 SolverLinear (WorldComm const &worldComm=Environment::worldComm())
 
 SolverLinear (po::variables_map const &vm, WorldComm const &worldComm=Environment::worldComm())
 
SolverType solverType () const
 
po::variables_map vm () const
 
WorldComm const & worldComm () const
 
virtual ~SolverLinear ()
 

Protected Member Functions

void setInitialized (bool init)
 

Protected Attributes

double M_atolerance
 absolute tolerance
 
double M_dtolerance
 divergence tolerance
 
FieldSplitType M_fieldSplit_type
 
bool M_is_initialized
 
MatSolverPackageType M_matSolverPackage_type
 
size_type M_maxit
 maximum number of iterations
 
MatrixStructure M_prec_matrix_structure
 
preconditioner_ptrtype M_preconditioner
 
PreconditionerType M_preconditioner_type
 
std::string M_prefix
 
double M_rtolerance
 relative tolerance
 
bool M_showKSPConvergedReason
 
bool M_showKSPMonitor
 
SolverType M_solver_type
 
po::variables_map M_vm
 

Constructor & Destructor Documentation

template<typename T >
Feel::SolverLinear< T >::SolverLinear ( WorldComm const &  worldComm = Environment::worldComm())
inline

Constructor. Initializes Solver data structures

template<typename T >
Feel::SolverLinear< T >::SolverLinear ( po::variables_map const &  vm,
WorldComm const &  worldComm = Environment::worldComm() 
)
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 >
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.

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, and Feel::SolverLinear< T >::M_preconditioner_type.

template<typename T >
std::string const& Feel::SolverLinear< T >::prefix ( ) const
inline
Returns
the prefix
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 >::init(), and Feel::SolverLinear< T >::M_is_initialized.

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

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

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, and Feel::SolverLinear< T >::M_preconditioner_type.

template<typename T >
void Feel::SolverLinear< T >::setPrefix ( std::string const &  p)
inline

set the prefix of the solver (typically for command line options)

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 >
bool Feel::SolverLinear< T >::showKSPConvergedReason ( ) const
inline

show KSP converged reason

template<typename T >
bool Feel::SolverLinear< T >::showKSPMonitor ( ) const
inline

show KSP monitor

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.

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

Enum the software that is used to perform the factorization

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

Holds the Preconditioner object to be used for the linear solves.

template<typename T >
PreconditionerType Feel::SolverLinear< T >::M_preconditioner_type
protected

Enum statitng with type of preconditioner to use.

template<typename T >
SolverType Feel::SolverLinear< T >::M_solver_type
protected

Enum stating which type of iterative solver to use.


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

Generated on Sun Dec 22 2013 13:11:21 for Feel++ by doxygen 1.8.5