* Initialization function. Provide a matrix and preconditioner for the
* solve in vmult().
*/
- template <typename MatrixType, class PRECONDITION>
- void initialize (const MatrixType &, const PRECONDITION &);
+ template <typename MatrixType, typename PreconditionerType>
+ void initialize (const MatrixType &, const PreconditionerType &);
/**
* Delete the pointers to matrix and preconditioner.
template <typename VectorType>
-template <typename MatrixType, class PRECONDITION>
+template <typename MatrixType, typename PreconditionerType>
inline
void
-IterativeInverse<VectorType>::initialize(const MatrixType &m, const PRECONDITION &p)
+IterativeInverse<VectorType>::initialize(const MatrixType &m, const PreconditionerType &p)
{
// dummy variable
VectorType *v = 0;
* Initialization function. Provide a solver object, a matrix, and another
* preconditioner for this.
*/
- template <typename MatrixType, class PRECONDITION>
+ template <typename MatrixType, typename PreconditionerType>
void initialize (const MatrixType &,
- const PRECONDITION &);
+ const PreconditionerType &);
/**
* Access to the SolverControl object used by the solver.
//-----------------------------------------------------------------------//
template <typename VectorType>
-template <typename MatrixType, class PRECONDITION>
+template <typename MatrixType, typename PreconditionerType>
inline void
-InverseMatrixRichardson<VectorType>::initialize (const MatrixType &m, const PRECONDITION &p)
+InverseMatrixRichardson<VectorType>::initialize (const MatrixType &m,
+ const PreconditionerType &p)
{
if (matrix != 0)
delete matrix;
matrix = new PointerMatrix<MatrixType, VectorType>(&m);
if (precondition != 0)
delete precondition;
- precondition = new PointerMatrix<PRECONDITION, VectorType>(&p);
+ precondition = new PointerMatrix<PreconditionerType, VectorType>(&p);
}
/**
* Solve primal problem only.
*/
- template<typename MatrixType, class PRECONDITIONER>
+ template<typename MatrixType, typename PreconditionerType>
void
- solve (const MatrixType &A,
- VectorType &x,
- const VectorType &b,
- const PRECONDITIONER &precondition);
+ solve (const MatrixType &A,
+ VectorType &x,
+ const VectorType &b,
+ const PreconditionerType &precondition);
protected:
/**
* The iteration loop itself. The function returns a structure indicating
* what happened in this function.
*/
- template<typename MatrixType, class PRECONDITIONER>
+ template<typename MatrixType, typename PreconditionerType>
IterationResult
- iterate(const MatrixType &A,
- const PRECONDITIONER &precondition);
+ iterate(const MatrixType &A,
+ const PreconditionerType &precondition);
};
/*@}*/
template<typename VectorType>
-template<typename MatrixType, class PRECONDITIONER>
+template<typename MatrixType, typename PreconditionerType>
typename SolverBicgstab<VectorType>::IterationResult
-SolverBicgstab<VectorType>::iterate(const MatrixType &A,
- const PRECONDITIONER &precondition)
+SolverBicgstab<VectorType>::iterate(const MatrixType &A,
+ const PreconditionerType &precondition)
{
//TODO:[GK] Implement "use the length of the computed orthogonal residual" in the BiCGStab method.
SolverControl::State state = SolverControl::iterate;
template<typename VectorType>
-template<typename MatrixType, class PRECONDITIONER>
+template<typename MatrixType, typename PreconditionerType>
void
-SolverBicgstab<VectorType>::solve(const MatrixType &A,
- VectorType &x,
- const VectorType &b,
- const PRECONDITIONER &precondition)
+SolverBicgstab<VectorType>::solve(const MatrixType &A,
+ VectorType &x,
+ const VectorType &b,
+ const PreconditionerType &precondition)
{
deallog.push("Bicgstab");
Vr = this->memory.alloc();
/**
* Solve the linear system $Ax=b$ for x.
*/
- template <typename MatrixType, class PRECONDITIONER>
+ template <typename MatrixType, typename PreconditionerType>
void
- solve (const MatrixType &A,
- VectorType &x,
- const VectorType &b,
- const PRECONDITIONER &precondition);
+ solve (const MatrixType &A,
+ VectorType &x,
+ const VectorType &b,
+ const PreconditionerType &precondition);
/**
* Connect a slot to retrieve the CG coefficients. The slot will be called
template <typename VectorType>
-template <typename MatrixType, class PRECONDITIONER>
+template <typename MatrixType, typename PreconditionerType>
void
-SolverCG<VectorType>::solve (const MatrixType &A,
- VectorType &x,
- const VectorType &b,
- const PRECONDITIONER &precondition)
+SolverCG<VectorType>::solve (const MatrixType &A,
+ VectorType &x,
+ const VectorType &b,
+ const PreconditionerType &precondition)
{
SolverControl::State conv=SolverControl::iterate;
return;
}
- if (types_are_equal<PRECONDITIONER,PreconditionIdentity>::value == false)
+ if (types_are_equal<PreconditionerType,PreconditionIdentity>::value == false)
{
precondition.vmult(h,g);
if (conv != SolverControl::iterate)
break;
- if (types_are_equal<PRECONDITIONER,PreconditionIdentity>::value
+ if (types_are_equal<PreconditionerType,PreconditionIdentity>::value
== false)
{
precondition.vmult(h,g);
/**
* Solve the linear system $Ax=b$ for x.
*/
- template<typename MatrixType, class PRECONDITIONER>
+ template<typename MatrixType, typename PreconditionerType>
void
- solve (const MatrixType &A,
- VectorType &x,
- const VectorType &b,
- const PRECONDITIONER &precondition);
+ solve (const MatrixType &A,
+ VectorType &x,
+ const VectorType &b,
+ const PreconditionerType &precondition);
/**
* Connect a slot to retrieve the estimated condition number.
/**
* Solve the linear system $Ax=b$ for x.
*/
- template<typename MatrixType, class PRECONDITIONER>
+ template<typename MatrixType, typename PreconditionerType>
void
- solve (const MatrixType &A,
- VectorType &x,
- const VectorType &b,
- const PRECONDITIONER &precondition);
+ solve (const MatrixType &A,
+ VectorType &x,
+ const VectorType &b,
+ const PreconditionerType &precondition);
private:
template<class VectorType>
-template<typename MatrixType, class PRECONDITIONER>
+template<typename MatrixType, typename PreconditionerType>
void
-SolverGMRES<VectorType>::solve (const MatrixType &A,
- VectorType &x,
- const VectorType &b,
- const PRECONDITIONER &precondition)
+SolverGMRES<VectorType>::solve (const MatrixType &A,
+ VectorType &x,
+ const VectorType &b,
+ const PreconditionerType &precondition)
{
// this code was written a very long time ago by people not associated with
// deal.II. we don't make any guarantees to its optimality or that it even
template<class VectorType>
-template<typename MatrixType, class PRECONDITIONER>
+template<typename MatrixType, typename PreconditionerType>
void
-SolverFGMRES<VectorType>::solve (const MatrixType &A,
- VectorType &x,
- const VectorType &b,
- const PRECONDITIONER &precondition)
+SolverFGMRES<VectorType>::solve (const MatrixType &A,
+ VectorType &x,
+ const VectorType &b,
+ const PreconditionerType &precondition)
{
deallog.push("FGMRES");
/**
* Solve the linear system $Ax=b$ for x.
*/
- template<typename MatrixType, class PRECONDITIONER>
+ template<typename MatrixType, typename PreconditionerType>
void
- solve (const MatrixType &A,
- VectorType &x,
- const VectorType &b,
- const PRECONDITIONER &precondition);
+ solve (const MatrixType &A,
+ VectorType &x,
+ const VectorType &b,
+ const PreconditionerType &precondition);
/**
* @addtogroup Exceptions
template<class VectorType>
-template<typename MatrixType, class PRECONDITIONER>
+template<typename MatrixType, typename PreconditionerType>
void
-SolverMinRes<VectorType>::solve (const MatrixType &A,
- VectorType &x,
- const VectorType &b,
- const PRECONDITIONER &precondition)
+SolverMinRes<VectorType>::solve (const MatrixType &A,
+ VectorType &x,
+ const VectorType &b,
+ const PreconditionerType &precondition)
{
SolverControl::State conv=SolverControl::iterate;
/**
* Solve the linear system $Ax=b$ for x.
*/
- template<typename MatrixType, class PRECONDITIONER>
+ template<typename MatrixType, typename PreconditionerType>
void
- solve (const MatrixType &A,
- VectorType &x,
- const VectorType &b,
- const PRECONDITIONER &precondition);
+ solve (const MatrixType &A,
+ VectorType &x,
+ const VectorType &b,
+ const PreconditionerType &precondition);
/**
* Interface for derived class. This function gets the current iteration
* The iteration loop itself. The function returns a structure indicating
* what happened in this function.
*/
- template<typename MatrixType, class PRECONDITIONER>
+ template<typename MatrixType, typename PreconditionerType>
IterationResult
- iterate (const MatrixType &A,
- const PRECONDITIONER &precondition);
+ iterate (const MatrixType &A,
+ const PreconditionerType &precondition);
/**
* Number of the current iteration (accumulated over restarts)
template<class VectorType>
-template<typename MatrixType, class PRECONDITIONER>
+template<typename MatrixType, typename PreconditionerType>
void
-SolverQMRS<VectorType>::solve (const MatrixType &A,
- VectorType &x,
- const VectorType &b,
- const PRECONDITIONER &precondition)
+SolverQMRS<VectorType>::solve (const MatrixType &A,
+ VectorType &x,
+ const VectorType &b,
+ const PreconditionerType &precondition)
{
deallog.push("QMRS");
template<class VectorType>
-template<typename MatrixType, class PRECONDITIONER>
+template<typename MatrixType, typename PreconditionerType>
typename SolverQMRS<VectorType>::IterationResult
-SolverQMRS<VectorType>::iterate(const MatrixType &A,
- const PRECONDITIONER &precondition)
+SolverQMRS<VectorType>::iterate(const MatrixType &A,
+ const PreconditionerType &precondition)
{
/* Remark: the matrix A in the article is the preconditioned matrix.
* Therefore, we have to precondition x before we compute the first residual.
/**
* Solve the linear system $Ax=b$ for x.
*/
- template<typename MatrixType, class PRECONDITIONER>
+ template<typename MatrixType, typename PreconditionerType>
void
- solve (const MatrixType &A,
- VectorType &x,
- const VectorType &b,
- const PRECONDITIONER &precondition);
+ solve (const MatrixType &A,
+ VectorType &x,
+ const VectorType &b,
+ const PreconditionerType &precondition);
/**
* Solve $A^Tx=b$ for $x$.
*/
- template<typename MatrixType, class PRECONDITIONER>
+ template<typename MatrixType, typename PreconditionerType>
void
- Tsolve (const MatrixType &A,
- VectorType &x,
- const VectorType &b,
- const PRECONDITIONER &precondition);
+ Tsolve (const MatrixType &A,
+ VectorType &x,
+ const VectorType &b,
+ const PreconditionerType &precondition);
/**
* Set the damping-coefficient. Default is 1., i.e. no damping.
template <class VectorType>
-template <typename MatrixType, class PRECONDITIONER>
+template <typename MatrixType, typename PreconditionerType>
void
-SolverRichardson<VectorType>::solve (const MatrixType &A,
- VectorType &x,
- const VectorType &b,
- const PRECONDITIONER &precondition)
+SolverRichardson<VectorType>::solve (const MatrixType &A,
+ VectorType &x,
+ const VectorType &b,
+ const PreconditionerType &precondition)
{
SolverControl::State conv=SolverControl::iterate;
template <class VectorType>
-template <typename MatrixType, class PRECONDITIONER>
+template <typename MatrixType, typename PreconditionerType>
void
-SolverRichardson<VectorType>::Tsolve (const MatrixType &A,
- VectorType &x,
- const VectorType &b,
- const PRECONDITIONER &precondition)
+SolverRichardson<VectorType>::Tsolve (const MatrixType &A,
+ VectorType &x,
+ const VectorType &b,
+ const PreconditionerType &precondition)
{
SolverControl::State conv=SolverControl::iterate;
double last_criterion = -std::numeric_limits<double>::max();
* Constructor. Store solver, matrix and preconditioning method for later
* use.
*/
- template<typename MatrixType, class PRECOND>
+ template<typename MatrixType, typename PreconditionerType>
MGCoarseGridLACIteration (SolverType &,
const MatrixType &,
- const PRECOND &);
+ const PreconditionerType &);
/**
* Destructor freeing the pointers.
/**
* Initialize new data.
*/
- template<typename MatrixType, class PRECOND>
+ template<typename MatrixType, typename PreconditionerType>
void initialize (SolverType &,
const MatrixType &,
- const PRECOND &);
+ const PreconditionerType &);
/**
* Clear all pointers.
template<typename SolverType, class VectorType>
-template<typename MatrixType, class PRECOND>
+template<typename MatrixType, typename PreconditionerType>
MGCoarseGridLACIteration<SolverType, VectorType>
-::MGCoarseGridLACIteration (SolverType &s,
- const MatrixType &m,
- const PRECOND &p)
+::MGCoarseGridLACIteration (SolverType &s,
+ const MatrixType &m,
+ const PreconditionerType &p)
:
solver(&s, typeid(*this).name())
{
matrix = new PointerMatrix<MatrixType, VectorType>(&m);
- precondition = new PointerMatrix<PRECOND, VectorType>(&p);
+ precondition = new PointerMatrix<PreconditionerType, VectorType>(&p);
}
template<typename SolverType, class VectorType>
-template<typename MatrixType, class PRECOND>
+template<typename MatrixType, typename PreconditionerType>
void
MGCoarseGridLACIteration<SolverType, VectorType>
-::initialize (SolverType &s,
- const MatrixType &m,
- const PRECOND &p)
+::initialize (SolverType &s,
+ const MatrixType &m,
+ const PreconditionerType &p)
{
solver = &s;
if (matrix)
matrix = new PointerMatrix<MatrixType, VectorType>(&m);
if (precondition)
delete precondition;
- precondition = new PointerMatrix<PRECOND, VectorType>(&p);
+ precondition = new PointerMatrix<PreconditionerType, VectorType>(&p);
}
*
* @author Guido Kanschat, 2009
*/
-template<typename MatrixType, class PRECONDITIONER, typename VectorType>
+template<typename MatrixType, typename PreconditionerType, typename VectorType>
class MGSmootherPrecondition : public MGSmoother<VectorType>
{
public:
* matrices and initializes the smoothing operator with the same smoother
* for each level.
*
- * @p additional_data is an object of type @p PRECONDITIONER::AdditionalData
+ * @p additional_data is an object of type @p PreconditionerType::AdditionalData
* and is handed to the initialization function of the relaxation method.
*/
template <typename MatrixType2>
void initialize (const MGLevelObject<MatrixType2> &matrices,
- const typename PRECONDITIONER::AdditionalData &additional_data = typename PRECONDITIONER::AdditionalData());
+ const typename PreconditionerType::AdditionalData &additional_data = typename PreconditionerType::AdditionalData());
/**
* Initialize for matrices. This function stores pointers to the level
* matrices and initializes the smoothing operator with the according
* smoother for each level.
*
- * @p additional_data is an object of type @p PRECONDITIONER::AdditionalData
+ * @p additional_data is an object of type @p PreconditionerType::AdditionalData
* and is handed to the initialization function of the relaxation method.
*/
template <typename MatrixType2, class DATA>
* This function stores pointers to the level matrices and initializes the
* smoothing operator with the same smoother for each level.
*
- * @p additional_data is an object of type @p PRECONDITIONER::AdditionalData
+ * @p additional_data is an object of type @p PreconditionerType::AdditionalData
* and is handed to the initialization function of the relaxation method.
*/
template <typename MatrixType2, class DATA>
* This function stores pointers to the level matrices and initializes the
* smoothing operator with the according smoother for each level.
*
- * @p additional_data is an object of type @p PRECONDITIONER::AdditionalData
+ * @p additional_data is an object of type @p PreconditionerType::AdditionalData
* and is handed to the initialization function of the relaxation method.
*/
template <typename MatrixType2, class DATA>
/**
* Object containing relaxation methods.
*/
- MGLevelObject<PRECONDITIONER> smoothers;
+ MGLevelObject<PreconditionerType> smoothers;
/**
* Memory used by this object.
//----------------------------------------------------------------------//
-template <typename MatrixType, class PRECONDITIONER, typename VectorType>
+template <typename MatrixType, typename PreconditionerType, typename VectorType>
inline
-MGSmootherPrecondition<MatrixType, PRECONDITIONER, VectorType>::MGSmootherPrecondition
+MGSmootherPrecondition<MatrixType, PreconditionerType, VectorType>::MGSmootherPrecondition
(const unsigned int steps,
const bool variable,
const bool symmetric,
-template <typename MatrixType, class PRECONDITIONER, typename VectorType>
+template <typename MatrixType, typename PreconditionerType, typename VectorType>
inline void
-MGSmootherPrecondition<MatrixType, PRECONDITIONER, VectorType>::clear ()
+MGSmootherPrecondition<MatrixType, PreconditionerType, VectorType>::clear ()
{
smoothers.clear();
-template <typename MatrixType, class PRECONDITIONER, typename VectorType>
+template <typename MatrixType, typename PreconditionerType, typename VectorType>
template <typename MatrixType2>
inline void
-MGSmootherPrecondition<MatrixType, PRECONDITIONER, VectorType>::initialize
+MGSmootherPrecondition<MatrixType, PreconditionerType, VectorType>::initialize
(const MGLevelObject<MatrixType2> &m,
- const typename PRECONDITIONER::AdditionalData &data)
+ const typename PreconditionerType::AdditionalData &data)
{
const unsigned int min = m.min_level();
const unsigned int max = m.max_level();
-template <typename MatrixType, class PRECONDITIONER, typename VectorType>
+template <typename MatrixType, typename PreconditionerType, typename VectorType>
template <typename MatrixType2, class DATA>
inline void
-MGSmootherPrecondition<MatrixType, PRECONDITIONER, VectorType>::initialize
+MGSmootherPrecondition<MatrixType, PreconditionerType, VectorType>::initialize
(const MGLevelObject<MatrixType2> &m,
const MGLevelObject<DATA> &data)
{
-template <typename MatrixType, class PRECONDITIONER, typename VectorType>
+template <typename MatrixType, typename PreconditionerType, typename VectorType>
template <typename MatrixType2, class DATA>
inline void
-MGSmootherPrecondition<MatrixType, PRECONDITIONER, VectorType>::initialize
+MGSmootherPrecondition<MatrixType, PreconditionerType, VectorType>::initialize
(const MGLevelObject<MatrixType2> &m,
const DATA &data,
const unsigned int row,
-template <typename MatrixType, class PRECONDITIONER, typename VectorType>
+template <typename MatrixType, typename PreconditionerType, typename VectorType>
template <typename MatrixType2, class DATA>
inline void
-MGSmootherPrecondition<MatrixType, PRECONDITIONER, VectorType>::initialize
+MGSmootherPrecondition<MatrixType, PreconditionerType, VectorType>::initialize
(const MGLevelObject<MatrixType2> &m,
const MGLevelObject<DATA> &data,
const unsigned int row,
-template <typename MatrixType, class PRECONDITIONER, typename VectorType>
+template <typename MatrixType, typename PreconditionerType, typename VectorType>
inline void
-MGSmootherPrecondition<MatrixType, PRECONDITIONER, VectorType>::smooth
+MGSmootherPrecondition<MatrixType, PreconditionerType, VectorType>::smooth
(const unsigned int level,
VectorType &u,
const VectorType &rhs) const
-template <typename MatrixType, class PRECONDITIONER, typename VectorType>
+template <typename MatrixType, typename PreconditionerType, typename VectorType>
inline
std::size_t
-MGSmootherPrecondition<MatrixType, PRECONDITIONER, VectorType>::
+MGSmootherPrecondition<MatrixType, PreconditionerType, VectorType>::
memory_consumption () const
{
return sizeof(*this)