// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
class PreconditionRelaxation : public Subscriptor
{
public:
+ /**
+ * Class for parameters.
+ */
+ class AdditionalData
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ AdditionalData (const double relaxation = 1.);
+
+ /**
+ * Relaxation parameter.
+ */
+ double relaxation;
+ };
+
/**
* Initialize matrix and
* relaxation parameter. The
* than 2 for numerical
* reasons. It defaults to 1.
*/
- void initialize (const MATRIX& A, const double omega = 1.);
+ void initialize (const MATRIX& A,
+ AdditionalData parameters = AdditionalData());
protected:
/**
/**
* Relaxation parameter.
*/
- double omega;
+ double relaxation;
};
template <class MATRIX>
inline void
PreconditionRelaxation<MATRIX>::initialize (const MATRIX &rA,
- const double o)
+ AdditionalData parameters)
{
A = &rA;
- omega = o;
+ relaxation = parameters.relaxation;
}
//----------------------------------------------------------------------//
PreconditionJacobi<MATRIX>::vmult (VECTOR& dst, const VECTOR& src) const
{
Assert (this->A!=0, ExcNotInitialized());
- this->A->precondition_Jacobi (dst, src, this->omega);
+ this->A->precondition_Jacobi (dst, src, this->relaxation);
}
PreconditionJacobi<MATRIX>::Tvmult (VECTOR& dst, const VECTOR& src) const
{
Assert (this->A!=0, ExcNotInitialized());
- this->A->precondition_Jacobi (dst, src, this->omega);
+ this->A->precondition_Jacobi (dst, src, this->relaxation);
}
PreconditionSOR<MATRIX>::vmult (VECTOR& dst, const VECTOR& src) const
{
Assert (this->A!=0, ExcNotInitialized());
- this->A->precondition_SOR (dst, src, this->omega);
+ this->A->precondition_SOR (dst, src, this->relaxation);
}
PreconditionSOR<MATRIX>::Tvmult (VECTOR& dst, const VECTOR& src) const
{
Assert (this->A!=0, ExcNotInitialized());
- this->A->precondition_TSOR (dst, src, this->omega);
+ this->A->precondition_TSOR (dst, src, this->relaxation);
}
PreconditionSSOR<MATRIX>::vmult (VECTOR& dst, const VECTOR& src) const
{
Assert (this->A!=0, ExcNotInitialized());
- this->A->precondition_SSOR (dst, src, this->omega);
+ this->A->precondition_SSOR (dst, src, this->relaxation);
}
PreconditionSSOR<MATRIX>::Tvmult (VECTOR& dst, const VECTOR& src) const
{
Assert (this->A!=0, ExcNotInitialized());
- this->A->precondition_SSOR (dst, src, this->omega);
+ this->A->precondition_SSOR (dst, src, this->relaxation);
}
(matrix.*precondition)(dst, src);
}
+//----------------------------------------------------------------------//
+
+template<class MATRIX>
+inline
+PreconditionRelaxation<MATRIX>::AdditionalData::
+AdditionalData (const double relaxation)
+ :
+ relaxation (relaxation)
+{}
+
+
+
//////////////////////////////////////////////////////////////////////
template<class SOLVER, class MATRIX, class PRECONDITION>
typedef typename MATRIX::value_type number;
public:
+ /**
+ * Parameters for block preconditioners.
+ */
+ class AdditionalData
+ {
+ public:
+ /**
+ * Constructor. Block size
+ * must be given since there
+ * is no reasonable default
+ * parameter.
+ */
+ AdditionalData (const unsigned int block_size,
+ const double relaxation = 1.);
+
+ /**
+ * Relaxation parameter.
+ */
+ double relaxation;
+
+ /**
+ * Block size.
+ */
+ unsigned int block_size;
+ };
+
+
/**
* Constructor.
*/
* parameter for derived classes
* may be provided.
*/
- void initialize (const MATRIX& A,
- const unsigned int block_size,
- const double relaxation = 1.);
+ void initialize (const MATRIX& A, AdditionalData parameters);
/**
* Deletes the inverse diagonal
//----------------------------------------------------------------------//
+template<class MATRIX, typename inverse_type>
+inline
+PreconditionBlock<MATRIX, inverse_type>::AdditionalData::
+AdditionalData (const unsigned int block_size,
+ const double relaxation)
+ :
+ relaxation (relaxation),
+ block_size(block_size)
+{}
+
+
template<class MATRIX, typename inverse_type>
inline bool
PreconditionBlock<MATRIX, inverse_type>::empty () const
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
template <class MATRIX, typename inverse_type>
-void PreconditionBlock<MATRIX,inverse_type>::initialize (const MATRIX &M,
- const unsigned int bsize,
- const double relax)
+void PreconditionBlock<MATRIX,inverse_type>::initialize (
+ const MATRIX &M,
+ AdditionalData parameters)
{
+ const unsigned int bsize = parameters.block_size;
+
clear();
Assert (M.m() == M.n(), ExcMatrixNotSquare());
A = &M;
Assert (bsize>0, ExcIndexRange(bsize, 1, M.m()));
Assert (A->m()%bsize==0, ExcWrongBlockSize(bsize, A->m()));
blocksize=bsize;
- relaxation = relax;
+ relaxation = parameters.relaxation;
}