Public Member Functions | Static Public Member Functions | Protected Attributes | Private Attributes

PreconditionSelector< MATRIX, VECTOR > Class Template Reference
[Preconditioners and Relaxation Operators]

Inheritance diagram for PreconditionSelector< MATRIX, VECTOR >:
Inheritance graph
[legend]

List of all members.

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 ()
::ExceptionBaseExcNoMatrixGivenToUse ()

Protected Attributes

std::string preconditioning

Private Attributes

SmartPointer< const MATRIX,
PreconditionSelector< MATRIX,
VECTOR > > 
A
const VECTOR::value_type omega

Detailed Description

template<class MATRIX = SparseMatrix<double>, class VECTOR = ::Vector<double>>
class PreconditionSelector< MATRIX, VECTOR >

Selects the preconditioner. The constructor of this class takes the name of the preconditioning and the damping parameter 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.

Usage

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);
 * 

The same example where also the 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);
 * 

Now the use of the 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.

Author:
Ralf Hartmann, 1999

Definition at line 93 of file precondition_selector.h.


Constructor & Destructor Documentation

template<class MATRIX , class VECTOR >
PreconditionSelector< MATRIX, VECTOR >::PreconditionSelector ( const std::string &  preconditioning,
const typename VECTOR::value_type &  omega = 1. 
)

Constructor. omega denotes the damping parameter of the preconditioning.

Definition at line 170 of file precondition_selector.h.

template<class MATRIX , class VECTOR >
PreconditionSelector< MATRIX, VECTOR >::~PreconditionSelector (  ) [virtual]

Destructor.

Definition at line 177 of file precondition_selector.h.

References LAPACKSupport::A.


Member Function Documentation

template<class MATRIX , class VECTOR >
void PreconditionSelector< MATRIX, VECTOR >::use_matrix ( const MATRIX M )

Takes the matrix that is needed for preconditionings that involves a matrix. e.g. for precondition_jacobi, ~_sor, ~_ssor.

Definition at line 185 of file precondition_selector.h.

References LAPACKSupport::A.

template<class MATRIX , class VECTOR >
void PreconditionSelector< MATRIX, VECTOR >::vmult ( VECTOR &  dst,
const VECTOR &  src 
) const [virtual]

Precondition procedure. Calls the preconditioning that was specified in the constructor.

Definition at line 191 of file precondition_selector.h.

References LAPACKSupport::A, Assert, and StandardExceptions::ExcNotImplemented().

template<class MATRIX , class VECTOR >
std::string PreconditionSelector< MATRIX, VECTOR >::get_precondition_names (  ) [static]

Get the names of all implemented preconditionings.

Definition at line 221 of file precondition_selector.h.


Member Data Documentation

template<class MATRIX = SparseMatrix<double>, class VECTOR = ::Vector<double>>
std::string PreconditionSelector< MATRIX, VECTOR >::preconditioning [protected]

Stores the name of the preconditioning.

Definition at line 147 of file precondition_selector.h.

template<class MATRIX = SparseMatrix<double>, class VECTOR = ::Vector<double>>
SmartPointer<const MATRIX,PreconditionSelector<MATRIX,VECTOR> > PreconditionSelector< MATRIX, VECTOR >::A [private]

Matrix that is used for the matrix-builtin preconditioning function. cf. also PreconditionUseMatrix.

Definition at line 155 of file precondition_selector.h.

template<class MATRIX = SparseMatrix<double>, class VECTOR = ::Vector<double>>
const VECTOR::value_type PreconditionSelector< MATRIX, VECTOR >::omega [private]

Stores the damping parameter of the preconditioner.

Definition at line 161 of file precondition_selector.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

deal.II documentation generated on Fri Feb 3 2012 06:04:10 by doxygen 1.7.2