Feel++
0.91.4
|
#include <solverlinear.hpp>
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 |
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
Feel::SolverLinear< T >::SolverLinear | ( | ) | [inline] |
Constructor. Initializes Solver data structures
Feel::SolverLinear< T >::SolverLinear | ( | po::variables_map const & | vm | ) | [inline] |
Constructor. Initializes Solver data structures
Feel::SolverLinear< T >::~SolverLinear | ( | ) | [inline, virtual] |
Destructor.
value_type Feel::SolverLinear< T >::aTolerance | ( | ) | const [inline] |
References Feel::SolverLinear< T >::M_atolerance.
void Feel::SolverLinear< T >::attachPreconditioner | ( | preconditioner_ptrtype | preconditioner | ) | [inline] |
Attaches a Preconditioner object to be used by the solver
References Feel::SolverLinear< T >::_M_is_initialized, Feel::SolverLinear< T >::_M_preconditioner_type, and Feel::SolverLinear< T >::M_preconditioner.
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.
virtual void Feel::SolverLinear< T >::clear | ( | ) | [inline, virtual] |
Release all memory and clear data structures.
value_type Feel::SolverLinear< T >::dTolerance | ( | ) | const [inline] |
References Feel::SolverLinear< T >::M_dtolerance.
virtual void Feel::SolverLinear< T >::init | ( | ) | [pure virtual] |
Initialize data structures if not done so already.
Referenced by Feel::SolverLinear< T >::setInitialized().
bool Feel::SolverLinear< T >::initialized | ( | ) | const [inline] |
References Feel::SolverLinear< T >::_M_is_initialized.
MatSolverPackageType Feel::SolverLinear< T >::matSolverPackageType | ( | ) | const [inline] |
Returns the type of preconditioner to use.
References Feel::SolverLinear< T >::M_matSolverPackage_type.
size_type Feel::SolverLinear< T >::maxIterations | ( | ) | const [inline] |
References Feel::SolverLinear< T >::M_maxit.
virtual MatrixStructure Feel::SolverLinear< T >::precMatrixStructure | ( | ) | const [inline, virtual] |
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.
value_type Feel::SolverLinear< T >::rTolerance | ( | ) | const [inline] |
References Feel::SolverLinear< T >::M_rtolerance.
void Feel::SolverLinear< T >::setInitialized | ( | bool | init | ) | [inline, protected] |
set initialized only for subclasses
References Feel::SolverLinear< T >::_M_is_initialized, and Feel::SolverLinear< T >::init().
void Feel::SolverLinear< T >::setMatSolverPackageType | ( | const MatSolverPackageType | mspackt | ) | [inline] |
Sets the type of preconditioner to use.
References Feel::SolverLinear< T >::M_matSolverPackage_type.
virtual void Feel::SolverLinear< T >::setPrecMatrixStructure | ( | MatrixStructure | mstruct | ) | [inline, virtual] |
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.
void Feel::SolverLinear< T >::setSolverType | ( | const SolverType | st | ) | [inline] |
Sets the type of solver to use.
References Feel::SolverLinear< T >::_M_solver_type.
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.
mat | System Matrix |
prec | Preconditioning Matrix |
x | Solution vector |
b | RHS vector |
tolerance | Stopping tolerance |
maxit | maximum Number of Iterations |
transpose | true to solve the transpose system, false otherwise |
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.
mat | System Matrix |
prec | Preconditioning Matrix |
x | Solution vector |
b | RHS vector |
tolerance | Stopping tolerance |
maxit | maximum Number of Iterations |
transpose | true to solve the transpose system, false otherwise |
SolverType Feel::SolverLinear< T >::solverType | ( | ) | const [inline] |
Returns the type of solver to use.
References Feel::SolverLinear< T >::_M_solver_type.
po::variables_map Feel::SolverLinear< T >::vm | ( | ) | const [inline] |
return variables_map
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().
PreconditionerType Feel::SolverLinear< T >::_M_preconditioner_type [protected] |
Enum statitng with type of preconditioner to use.
Referenced by Feel::SolverLinear< T >::attachPreconditioner(), Feel::SolverLinear< T >::preconditionerType(), and Feel::SolverLinear< T >::setPreconditionerType().
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().
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().
preconditioner_ptrtype Feel::SolverLinear< T >::M_preconditioner [protected] |
Holds the Preconditioner object to be used for the linear solves.
Referenced by Feel::SolverLinear< T >::attachPreconditioner(), Feel::SolverLinear< T >::preconditionerType(), and Feel::SolverLinear< T >::setPreconditionerType().