Feel++ 0.91.0
|
#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 |
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 |
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 | ( | ) | [inline, virtual] |
Destructor.
value_type Feel::SolverLinear< T >::aTolerance | ( | ) | const [inline] |
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
virtual void Feel::SolverLinear< T >::clear | ( | ) | [inline, virtual] |
Release all memory and clear data structures.
Reimplemented in Feel::SolverLinearPetsc< T >, and Feel::SolverLinearPetsc< double >.
value_type Feel::SolverLinear< T >::dTolerance | ( | ) | const [inline] |
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().
bool Feel::SolverLinear< T >::initialized | ( | ) | const [inline] |
size_type Feel::SolverLinear< T >::maxIterations | ( | ) | const [inline] |
virtual MatrixStructure Feel::SolverLinear< T >::precMatrixStructure | ( | ) | const [inline, virtual] |
PreconditionerType Feel::SolverLinear< T >::preconditionerType | ( | ) | const [inline] |
Returns the type of preconditioner to use.
value_type Feel::SolverLinear< T >::rTolerance | ( | ) | const [inline] |
void Feel::SolverLinear< T >::setInitialized | ( | bool | init | ) | [inline, protected] |
set initialized only for subclasses
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.
void Feel::SolverLinear< T >::setSolverType | ( | const SolverType | st | ) | [inline] |
Sets the type of solver to use.
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.
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 |
Implemented in Feel::SolverLinearPetsc< T >, and Feel::SolverLinearPetsc< double >.
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.
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 |
Implemented in Feel::SolverLinearPetsc< T >, and Feel::SolverLinearPetsc< double >.
SolverType Feel::SolverLinear< T >::solverType | ( | ) | const [inline] |
Returns the type of solver to use.
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().
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().
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().