Classes | |
class | ExcNoMatrixGivenToUse |
Public Member Functions | |
PreconditionSelector (const std::string &preconditioning, const typename Vector::value_type &omega=1.) | |
virtual | ~PreconditionSelector () |
void | use_matrix (const Matrix &M) |
virtual void | vmult (Vector &dst, const Vector &src) const |
Static Public Member Functions | |
static std::string | get_precondition_names () |
Protected Attributes | |
std::string | preconditioning |
Private Attributes | |
SmartPointer< const Matrix > | A |
const Vector::value_type | omega |
omega
of the preconditioning and the use_matrix
function takes the matrix that is used by the matrix-builtin precondition functions. Each time, the operator()
function is called, this preselected preconditioner, this matrix and this omega
is used for the preconditioning. This class is designed for being used as argument of the solve
function of a Solver
and it covers the selection of all matrix-builtin precondition functions. The selection of other preconditioners, like BlockSOR or ILU should be handled in derived classes by the user.
The simplest use of this class is the following:
* // generate a @p SolverControl and * // a @p VectorMemory * SolverControl control; * VectorMemory<Vector<double> > memory; * // generate a solver * SolverCG<SparseMatrix<double>, Vector<double> > solver(control, memory); * // generate a @p PreconditionSelector * PreconditionSelector<SparseMatrix<double>, Vector<double> > * preconditioning("jacobi", 1.); * // give a matrix whose diagonal entries * // are to be used for the preconditioning. * // Generally the matrix of the linear * // equation system Ax=b. * preconditioning.use_matrix(A); * // call the @p solve function with this * // preconditioning as last argument * solver.solve(A,x,b,preconditioning); *
SolverSelector
class is used reads * // generate a @p SolverControl and * // a @p VectorMemory * SolverControl control; * VectorMemory<Vector<double> > memory; * // generate a @p SolverSelector that * // calls the @p SolverCG * SolverSelector<SparseMatrix<double>, Vector<double> > * solver_selector("cg", control, memory); * // generate a @p PreconditionSelector * PreconditionSelector<SparseMatrix<double>, Vector<double> > * preconditioning("jacobi", 1.); * * preconditioning.use_matrix(A); * * solver_selector.solve(A,x,b,preconditioning); *
SolverSelector
in combination with the PreconditionSelector
allows the user to select both, the solver and the preconditioner, at the beginning of his program and each time the solver is started (that is several times e.g. in a nonlinear iteration) this preselected solver and preconditioner is called.
PreconditionSelector< Matrix, Vector >::PreconditionSelector | ( | const std::string & | preconditioning, | |
const typename Vector::value_type & | omega = 1. | |||
) | [inline] |
Constructor. omega
denotes the damping parameter of the preconditioning.
PreconditionSelector< Matrix, Vector >::~PreconditionSelector | ( | ) | [inline, virtual] |
Destructor.
References PreconditionSelector< Matrix, Vector >::A.
void PreconditionSelector< Matrix, Vector >::use_matrix | ( | const Matrix & | M | ) | [inline] |
Takes the matrix that is needed for preconditionings that involves a matrix. e.g. for precondition_jacobi
, ~_sor
, ~_ssor
.
References PreconditionSelector< Matrix, Vector >::A.
void PreconditionSelector< Matrix, Vector >::vmult | ( | Vector & | dst, | |
const Vector & | src | |||
) | const [inline, virtual] |
Precondition procedure. Calls the preconditioning that was specified in the constructor.
References PreconditionSelector< Matrix, Vector >::A, Assert, PreconditionSelector< Matrix, Vector >::omega, and PreconditionSelector< Matrix, Vector >::preconditioning.
std::string PreconditionSelector< Matrix, Vector >::get_precondition_names | ( | ) | [inline, static] |
Get the names of all implemented preconditionings.
std::string PreconditionSelector< Matrix, Vector >::preconditioning [protected] |
Stores the name of the preconditioning.
Referenced by PreconditionSelector< Matrix, Vector >::vmult().
SmartPointer<const Matrix> PreconditionSelector< Matrix, Vector >::A [private] |
Matrix that is used for the matrix-builtin preconditioning function. cf. also PreconditionUseMatrix
.
Referenced by PreconditionSelector< Matrix, Vector >::use_matrix(), PreconditionSelector< Matrix, Vector >::vmult(), and PreconditionSelector< Matrix, Vector >::~PreconditionSelector().
const Vector::value_type PreconditionSelector< Matrix, Vector >::omega [private] |
Stores the damping parameter of the preconditioner.
Referenced by PreconditionSelector< Matrix, Vector >::vmult().