Classes | |
struct | AdditionalData |
Public Member Functions | |
SolverRichardson (SolverControl &cn, VectorMemory< VECTOR > &mem, const AdditionalData &data=AdditionalData()) | |
SolverRichardson (SolverControl &cn, const AdditionalData &data=AdditionalData()) | |
virtual | ~SolverRichardson () |
template<class MATRIX , class PRECONDITIONER > | |
void | solve (const MATRIX &A, VECTOR &x, const VECTOR &b, const PRECONDITIONER &precondition) |
template<class MATRIX , class PRECONDITIONER > | |
void | Tsolve (const MATRIX &A, VECTOR &x, const VECTOR &b, const PRECONDITIONER &precondition) |
void | set_omega (const double om=1.) |
virtual void | print_vectors (const unsigned int step, const VECTOR &x, const VECTOR &r, const VECTOR &d) const |
Protected Member Functions | |
virtual VECTOR::value_type | criterion () |
Protected Attributes | |
VECTOR * | Vr |
VECTOR * | Vd |
AdditionalData | additional_data |
VECTOR::value_type | res |
Implementation of the richardson iteration method. The stopping criterion is the norm of the residual.
For the requirements on matrices and vectors in order to work with this class, see the documentation of the Solver base class.
Like all other solver classes, this class has a local structure called AdditionalData
which is used to pass additional parameters to the solver, like damping parameters or the number of temporary vectors. We use this additional structure instead of passing these values directly to the constructor because this makes the use of the SolverSelector
and other classes much easier and guarantees that these will continue to work even if number or type of the additional parameters for a certain solver changes.
For the Richardson method, the additional data is the damping parameter, which is the only content of the AdditionalData
structure. By default, the constructor of the structure sets it to one.
SolverRichardson< VECTOR >::SolverRichardson | ( | SolverControl & | cn, | |
VectorMemory< VECTOR > & | mem, | |||
const AdditionalData & | data = AdditionalData() | |||
) |
Constructor.
SolverRichardson< VECTOR >::SolverRichardson | ( | SolverControl & | cn, | |
const AdditionalData & | data = AdditionalData() | |||
) |
Constructor. Use an object of type GrowingVectorMemory as a default to allocate memory.
virtual SolverRichardson< VECTOR >::~SolverRichardson | ( | ) | [virtual] |
Virtual destructor.
void SolverRichardson< VECTOR >::solve | ( | const MATRIX & | A, | |
VECTOR & | x, | |||
const VECTOR & | b, | |||
const PRECONDITIONER & | precondition | |||
) | [inline] |
Solve the linear system for x.
Referenced by SolverSelector< VECTOR >::solve().
void SolverRichardson< VECTOR >::Tsolve | ( | const MATRIX & | A, | |
VECTOR & | x, | |||
const VECTOR & | b, | |||
const PRECONDITIONER & | precondition | |||
) | [inline] |
Solve for
.
void SolverRichardson< VECTOR >::set_omega | ( | const double | om = 1. |
) |
Set the damping-coefficient. Default is 1., i.e. no damping.
virtual void SolverRichardson< VECTOR >::print_vectors | ( | const unsigned int | step, | |
const VECTOR & | x, | |||
const VECTOR & | r, | |||
const VECTOR & | d | |||
) | const [virtual] |
Interface for derived class. This function gets the current iteration vector, the residual and the update vector in each step. It can be used for a graphical output of the convergence history.
virtual VECTOR::value_type SolverRichardson< VECTOR >::criterion | ( | ) | [protected, virtual] |
Implementation of the computation of the norm of the residual.
VECTOR* SolverRichardson< VECTOR >::Vr [protected] |
Residual. Temporary vector allocated through the VectorMemory object at the start of the actual solution process and deallocated at the end.
VECTOR* SolverRichardson< VECTOR >::Vd [protected] |
Preconditioned residual. Temporary vector allocated through the VectorMemory object at the start of the actual solution process and deallocated at the end.
AdditionalData SolverRichardson< VECTOR >::additional_data [protected] |
Control parameters.
VECTOR::value_type SolverRichardson< VECTOR >::res [protected] |
Within the iteration loop, the norm of the residual is stored in this variable. The function criterion
uses this variable to compute the convergence value, which in this class is the norm of the residual vector and thus the square root of the res2
value.