*
* @author Guido Kanschat, 2000
*/
-template <class VECTOR = Vector<double> >
-class EigenPower : private Solver<VECTOR>
+template <typename VectorType = Vector<double> >
+class EigenPower : private Solver<VectorType>
{
public:
/**
/**
* Constructor.
*/
- EigenPower (SolverControl &cn,
- VectorMemory<VECTOR> &mem,
- const AdditionalData &data=AdditionalData());
+ EigenPower (SolverControl &cn,
+ VectorMemory<VectorType> &mem,
+ const AdditionalData &data=AdditionalData());
/**
* Virtual destructor.
void
solve (double &value,
const MATRIX &A,
- VECTOR &x);
+ VectorType &x);
protected:
/**
*
* @author Guido Kanschat, 2000, 2003
*/
-template <class VECTOR = Vector<double> >
-class EigenInverse : private Solver<VECTOR>
+template <typename VectorType = Vector<double> >
+class EigenInverse : private Solver<VectorType>
{
public:
/**
/**
* Constructor.
*/
- EigenInverse (SolverControl &cn,
- VectorMemory<VECTOR> &mem,
- const AdditionalData &data=AdditionalData());
+ EigenInverse (SolverControl &cn,
+ VectorMemory<VectorType> &mem,
+ const AdditionalData &data=AdditionalData());
/**
void
solve (double &value,
const MATRIX &A,
- VECTOR &x);
+ VectorType &x);
protected:
/**
//---------------------------------------------------------------------------
-template <class VECTOR>
-EigenPower<VECTOR>::EigenPower (SolverControl &cn,
- VectorMemory<VECTOR> &mem,
- const AdditionalData &data)
+template <class VectorType>
+EigenPower<VectorType>::EigenPower (SolverControl &cn,
+ VectorMemory<VectorType> &mem,
+ const AdditionalData &data)
:
- Solver<VECTOR>(cn, mem),
+ Solver<VectorType>(cn, mem),
additional_data(data)
{}
-template <class VECTOR>
-EigenPower<VECTOR>::~EigenPower ()
+template <class VectorType>
+EigenPower<VectorType>::~EigenPower ()
{}
-template <class VECTOR>
+template <class VectorType>
template <class MATRIX>
void
-EigenPower<VECTOR>::solve (double &value,
- const MATRIX &A,
- VECTOR &x)
+EigenPower<VectorType>::solve (double &value,
+ const MATRIX &A,
+ VectorType &x)
{
SolverControl::State conv=SolverControl::iterate;
deallog.push("Power method");
- VECTOR *Vy = this->memory.alloc ();
- VECTOR &y = *Vy;
+ VectorType *Vy = this->memory.alloc ();
+ VectorType &y = *Vy;
y.reinit (x);
- VECTOR *Vr = this->memory.alloc ();
- VECTOR &r = *Vr;
+ VectorType *Vr = this->memory.alloc ();
+ VectorType &r = *Vr;
r.reinit (x);
double length = x.l2_norm ();
//---------------------------------------------------------------------------
-template <class VECTOR>
-EigenInverse<VECTOR>::EigenInverse (SolverControl &cn,
- VectorMemory<VECTOR> &mem,
- const AdditionalData &data)
+template <class VectorType>
+EigenInverse<VectorType>::EigenInverse (SolverControl &cn,
+ VectorMemory<VectorType> &mem,
+ const AdditionalData &data)
:
- Solver<VECTOR>(cn, mem),
+ Solver<VectorType>(cn, mem),
additional_data(data)
{}
-template <class VECTOR>
-EigenInverse<VECTOR>::~EigenInverse ()
+template <class VectorType>
+EigenInverse<VectorType>::~EigenInverse ()
{}
-template <class VECTOR>
+template <class VectorType>
template <class MATRIX>
void
-EigenInverse<VECTOR>::solve (double &value,
- const MATRIX &A,
- VECTOR &x)
+EigenInverse<VectorType>::solve (double &value,
+ const MATRIX &A,
+ VectorType &x)
{
deallog.push("Wielandt");
// Define solver
ReductionControl inner_control (5000, 1.e-16, 1.e-5, false, false);
PreconditionIdentity prec;
- SolverGMRES<VECTOR>
+ SolverGMRES<VectorType>
solver(inner_control, this->memory);
// Next step for recomputing the shift
unsigned int goal = additional_data.start_adaption;
// Auxiliary vector
- VECTOR *Vy = this->memory.alloc ();
- VECTOR &y = *Vy;
+ VectorType *Vy = this->memory.alloc ();
+ VectorType &y = *Vy;
y.reinit (x);
- VECTOR *Vr = this->memory.alloc ();
- VECTOR &r = *Vr;
+ VectorType *Vr = this->memory.alloc ();
+ VectorType &r = *Vr;
r.reinit (x);
double length = x.l2_norm ();
* Matrix-vector multiplication. For the present case, this of course
* amounts to simply copying the input vector to the output vector.
*/
- template <class VECTOR1, class VECTOR2>
- void vmult (VECTOR1 &out,
- const VECTOR2 &in) const;
+ template <typename OutVectorType, typename InVectorType>
+ void vmult (OutVectorType &out,
+ const InVectorType &in) const;
/**
* Matrix-vector multiplication with addition to the output vector. For the
* present case, this of course amounts to simply adding the input vector to
* the output vector.
*/
- template <class VECTOR1, class VECTOR2>
- void vmult_add (VECTOR1 &out,
- const VECTOR2 &in) const;
+ template <typename OutVectorType, typename InVectorType>
+ void vmult_add (OutVectorType &out,
+ const InVectorType &in) const;
/**
* Matrix-vector multiplication with the transpose matrix. For the present
* case, this of course amounts to simply copying the input vector to the
* output vector.
*/
- template <class VECTOR1, class VECTOR2>
- void Tvmult (VECTOR1 &out,
- const VECTOR2 &in) const;
+ template <typename OutVectorType, typename InVectorType>
+ void Tvmult (OutVectorType &out,
+ const InVectorType &in) const;
/**
* the output vector. For the present case, this of course amounts to simply
* adding the input vector to the output vector.
*/
- template <class VECTOR1, class VECTOR2>
- void Tvmult_add (VECTOR1 &out,
- const VECTOR2 &in) const;
+ template <typename OutVectorType, typename InVectorType>
+ void Tvmult_add (OutVectorType &out,
+ const InVectorType &in) const;
private:
/**
-template <class VECTOR1, class VECTOR2>
+template <typename OutVectorType, typename InVectorType>
inline
void
-IdentityMatrix::vmult (VECTOR1 &out,
- const VECTOR2 &in) const
+IdentityMatrix::vmult (OutVectorType &out,
+ const InVectorType &in) const
{
Assert (out.size() == size, ExcDimensionMismatch (out.size(), size));
Assert (in.size() == size, ExcDimensionMismatch (in.size(), size));
-template <class VECTOR1, class VECTOR2>
+template <typename OutVectorType, typename InVectorType>
inline
void
-IdentityMatrix::vmult_add (VECTOR1 &out,
- const VECTOR2 &in) const
+IdentityMatrix::vmult_add (OutVectorType &out,
+ const InVectorType &in) const
{
Assert (out.size() == size, ExcDimensionMismatch (out.size(), size));
Assert (in.size() == size, ExcDimensionMismatch (in.size(), size));
-template <class VECTOR1, class VECTOR2>
+template <typename OutVectorType, typename InVectorType>
inline
void
-IdentityMatrix::Tvmult (VECTOR1 &out,
- const VECTOR2 &in) const
+IdentityMatrix::Tvmult (OutVectorType &out,
+ const InVectorType &in) const
{
Assert (out.size() == size, ExcDimensionMismatch (out.size(), size));
Assert (in.size() == size, ExcDimensionMismatch (in.size(), size));
-template <class VECTOR1, class VECTOR2>
+template <typename OutVectorType, typename InVectorType>
inline
void
-IdentityMatrix::Tvmult_add (VECTOR1 &out,
- const VECTOR2 &in) const
+IdentityMatrix::Tvmult_add (OutVectorType &out,
+ const InVectorType &in) const
{
Assert (out.size() == size, ExcDimensionMismatch (out.size(), size));
Assert (in.size() == size, ExcDimensionMismatch (in.size(), size));
DEAL_II_NAMESPACE_CLOSE
#endif
-
* vectors given to this function have different type from the vectors used
* by the inner solver.
*/
- template <class VECTOR2>
- void vmult (VECTOR2 &dst, const VECTOR2 &src) const;
+ template <class OtherVectorType>
+ void vmult (OtherVectorType &dst, const OtherVectorType &src) const;
/**
* The solver, which allows selection of the actual solver as well as
template <typename VectorType>
-template <class VECTOR2>
+template <class OtherVectorType>
inline void
-IterativeInverse<VectorType>::vmult (VECTOR2 &dst, const VECTOR2 &src) const
+IterativeInverse<VectorType>::vmult (OtherVectorType &dst, const OtherVectorType &src) const
{
Assert(matrix.get() != 0, ExcNotInitialized());
Assert(preconditioner.get() != 0, ExcNotInitialized());
*
* @author Guido Kanschat, 2000, 2001, 2002, 2005
*/
-template<class VECTOR>
-class ProductMatrix : public PointerMatrixBase<VECTOR>
+template<typename VectorType>
+class ProductMatrix : public PointerMatrixBase<VectorType>
{
public:
/**
* Constructor only assigning the memory pool. Matrices must be added by
* reinit() later.
*/
- ProductMatrix(VectorMemory<VECTOR> &mem);
+ ProductMatrix(VectorMemory<VectorType> &mem);
/**
* Constructor. Additionally to the two constituting matrices, a memory
* pool for the auxiliary vector must be provided.
*/
template <class MATRIX1, class MATRIX2>
- ProductMatrix(const MATRIX1 &m1,
- const MATRIX2 &m2,
- VectorMemory<VECTOR> &mem);
+ ProductMatrix (const MATRIX1 &m1,
+ const MATRIX2 &m2,
+ VectorMemory<VectorType> &mem);
/**
* Destructor.
*/
template <class MATRIX1, class MATRIX2>
void initialize(const MATRIX1 &m1, const MATRIX2 &m2,
- VectorMemory<VECTOR> &mem);
+ VectorMemory<VectorType> &mem);
// Doc in PointerMatrixBase
void clear();
/**
* Matrix-vector product <i>w = m1 * m2 * v</i>.
*/
- virtual void vmult (VECTOR &w,
- const VECTOR &v) const;
+ virtual void vmult (VectorType &w,
+ const VectorType &v) const;
/**
* Transposed matrix-vector product <i>w = m2<sup>T</sup> * m1<sup>T</sup> *
* v</i>.
*/
- virtual void Tvmult (VECTOR &w,
- const VECTOR &v) const;
+ virtual void Tvmult (VectorType &w,
+ const VectorType &v) const;
/**
* Adding matrix-vector product <i>w += m1 * m2 * v</i>
*/
- virtual void vmult_add (VECTOR &w,
- const VECTOR &v) const;
+ virtual void vmult_add (VectorType &w,
+ const VectorType &v) const;
/**
* Adding, transposed matrix-vector product <i>w += m2<sup>T</sup> *
* m1<sup>T</sup> * v</i>.
*/
- virtual void Tvmult_add (VECTOR &w,
- const VECTOR &v) const;
+ virtual void Tvmult_add (VectorType &w,
+ const VectorType &v) const;
private:
/**
* The left matrix of the product.
*/
- PointerMatrixBase<VECTOR> *m1;
+ PointerMatrixBase<VectorType> *m1;
/**
* The right matrix of the product.
*/
- PointerMatrixBase<VECTOR> *m2;
+ PointerMatrixBase<VectorType> *m2;
/**
* Memory for auxiliary vector.
*/
- SmartPointer<VectorMemory<VECTOR>,ProductMatrix<VECTOR> > mem;
+ SmartPointer<VectorMemory<VectorType>,ProductMatrix<VectorType> > mem;
};
*
* @author Guido Kanschat, 2007
*/
-template<class VECTOR>
+template<typename VectorType>
class ScaledMatrix : public Subscriptor
{
public:
/**
* Matrix-vector product.
*/
- void vmult (VECTOR &w, const VECTOR &v) const;
+ void vmult (VectorType &w, const VectorType &v) const;
/**
* Transposed matrix-vector product.
*/
- void Tvmult (VECTOR &w, const VECTOR &v) const;
+ void Tvmult (VectorType &w, const VectorType &v) const;
private:
/**
* The matrix.
*/
- PointerMatrixBase<VECTOR> *m;
+ PointerMatrixBase<VectorType> *m;
/**
* The scaling factor;
*/
* Constructor. Additionally to the two constituting matrices, a memory
* pool for the auxiliary vector must be provided.
*/
- ProductSparseMatrix(const MatrixType &m1,
- const MatrixType &m2,
- VectorMemory<VectorType> &mem);
+ ProductSparseMatrix (const MatrixType &m1,
+ const MatrixType &m2,
+ VectorMemory<VectorType> &mem);
/**
* Constructor leaving an uninitialized matrix. initialize() must be called,
*/
ProductSparseMatrix();
- void initialize(const MatrixType &m1,
- const MatrixType &m2,
- VectorMemory<VectorType> &mem);
+ void initialize (const MatrixType &m1,
+ const MatrixType &m2,
+ VectorMemory<VectorType> &mem);
// Doc in PointerMatrixBase
void clear();
* Return the source vector with subtracted mean value.
*/
template <typename number>
- void vmult (Vector<number> &dst,
+ void vmult (Vector<number> &dst,
const Vector<number> &src) const;
/**
* Add source vector with subtracted mean value to dest.
*/
template <typename number>
- void vmult_add (Vector<number> &dst,
+ void vmult_add (Vector<number> &dst,
const Vector<number> &src) const;
/**
* component.
*/
template <typename number>
- void vmult (BlockVector<number> &dst,
+ void vmult (BlockVector<number> &dst,
const BlockVector<number> &src) const;
/**
* subtracted.
*/
template <typename number>
- void vmult_add (BlockVector<number> &dst,
+ void vmult_add (BlockVector<number> &dst,
const BlockVector<number> &src) const;
/**
* Not implemented.
*/
- template <typename VECTOR>
- void Tvmult(VECTOR &, const VECTOR &) const;
+ template <typename VectorType>
+ void Tvmult(VectorType &, const VectorType &) const;
/**
* Not implemented.
*/
- template <typename VECTOR>
- void Tvmult_add(VECTOR &, const VECTOR &) const;
+ template <typename VectorType>
+ void Tvmult_add(VectorType &, const VectorType &) const;
private:
/**
*
* @author Guido Kanschat, 2005
*/
-template<class VECTOR>
+template<typename VectorType>
class InverseMatrixRichardson : public Subscriptor
{
public:
* Constructor, initializing the solver with a control and memory object.
* The inverted matrix and the preconditioner are added in initialize().
*/
- InverseMatrixRichardson (SolverControl &control,
- VectorMemory<VECTOR> &mem);
+ InverseMatrixRichardson (SolverControl &control,
+ VectorMemory<VectorType> &mem);
/**
* Since we use two pointers, we must implement a destructor.
*/
/**
* Execute solver.
*/
- void vmult (VECTOR &, const VECTOR &) const;
+ void vmult (VectorType &, const VectorType &) const;
/**
* Execute solver.
*/
- void vmult_add (VECTOR &, const VECTOR &) const;
+ void vmult_add (VectorType &, const VectorType &) const;
/**
* Execute transpose solver.
*/
- void Tvmult (VECTOR &, const VECTOR &) const;
+ void Tvmult (VectorType &, const VectorType &) const;
/**
* Execute transpose solver.
*/
- void Tvmult_add (VECTOR &, const VECTOR &) const;
+ void Tvmult_add (VectorType &, const VectorType &) const;
private:
/**
* A reference to the provided VectorMemory object.
*/
- VectorMemory<VECTOR> &mem;
+ VectorMemory<VectorType> &mem;
/**
* The solver object.
*/
- mutable SolverRichardson<VECTOR> solver;
+ mutable SolverRichardson<VectorType> solver;
/**
* The matrix in use.
*/
- PointerMatrixBase<VECTOR> *matrix;
+ PointerMatrixBase<VectorType> *matrix;
/**
* The preconditioner to use.
*/
- PointerMatrixBase<VECTOR> *precondition;
+ PointerMatrixBase<VectorType> *precondition;
};
//---------------------------------------------------------------------------
-template<class VECTOR>
+template<typename VectorType>
inline
-ScaledMatrix<VECTOR>::ScaledMatrix()
+ScaledMatrix<VectorType>::ScaledMatrix()
:
m(0)
{}
-template<class VECTOR>
+template<typename VectorType>
template<class MATRIX>
inline
-ScaledMatrix<VECTOR>::ScaledMatrix(const MATRIX &mat, const double factor)
+ScaledMatrix<VectorType>::ScaledMatrix(const MATRIX &mat, const double factor)
:
- m(new_pointer_matrix_base(mat, VECTOR())),
+ m(new_pointer_matrix_base(mat, VectorType())),
factor(factor)
{}
-template<class VECTOR>
+template<typename VectorType>
template<class MATRIX>
inline
void
-ScaledMatrix<VECTOR>::initialize(const MATRIX &mat, const double f)
+ScaledMatrix<VectorType>::initialize(const MATRIX &mat, const double f)
{
if (m) delete m;
- m = new_pointer_matrix_base(mat, VECTOR());
+ m = new_pointer_matrix_base(mat, VectorType());
factor = f;
}
-template<class VECTOR>
+template<typename VectorType>
inline
void
-ScaledMatrix<VECTOR>::clear()
+ScaledMatrix<VectorType>::clear()
{
if (m) delete m;
m = 0;
-template<class VECTOR>
+template<typename VectorType>
inline
-ScaledMatrix<VECTOR>::~ScaledMatrix()
+ScaledMatrix<VectorType>::~ScaledMatrix()
{
clear ();
}
-template<class VECTOR>
+template<typename VectorType>
inline
void
-ScaledMatrix<VECTOR>::vmult (VECTOR &w, const VECTOR &v) const
+ScaledMatrix<VectorType>::vmult (VectorType &w, const VectorType &v) const
{
m->vmult(w, v);
w *= factor;
}
-template<class VECTOR>
+template<typename VectorType>
inline
void
-ScaledMatrix<VECTOR>::Tvmult (VECTOR &w, const VECTOR &v) const
+ScaledMatrix<VectorType>::Tvmult (VectorType &w, const VectorType &v) const
{
m->Tvmult(w, v);
w *= factor;
//---------------------------------------------------------------------------
-template<class VECTOR>
-ProductMatrix<VECTOR>::ProductMatrix ()
+template<typename VectorType>
+ProductMatrix<VectorType>::ProductMatrix ()
: m1(0), m2(0), mem(0)
{}
-template<class VECTOR>
-ProductMatrix<VECTOR>::ProductMatrix (VectorMemory<VECTOR> &m)
+template<typename VectorType>
+ProductMatrix<VectorType>::ProductMatrix (VectorMemory<VectorType> &m)
: m1(0), m2(0), mem(&m)
{}
-template<class VECTOR>
+template<typename VectorType>
template<class MATRIX1, class MATRIX2>
-ProductMatrix<VECTOR>::ProductMatrix (
- const MATRIX1 &mat1,
- const MATRIX2 &mat2,
- VectorMemory<VECTOR> &m)
+ProductMatrix<VectorType>::ProductMatrix (const MATRIX1 &mat1,
+ const MATRIX2 &mat2,
+ VectorMemory<VectorType> &m)
: mem(&m)
{
- m1 = new PointerMatrix<MATRIX1, VECTOR>(&mat1, typeid(*this).name());
- m2 = new PointerMatrix<MATRIX2, VECTOR>(&mat2, typeid(*this).name());
+ m1 = new PointerMatrix<MATRIX1, VectorType>(&mat1, typeid(*this).name());
+ m2 = new PointerMatrix<MATRIX2, VectorType>(&mat2, typeid(*this).name());
}
-template<class VECTOR>
+template<typename VectorType>
template<class MATRIX1, class MATRIX2>
void
-ProductMatrix<VECTOR>::reinit (
- const MATRIX1 &mat1,
- const MATRIX2 &mat2)
+ProductMatrix<VectorType>::reinit (const MATRIX1 &mat1, const MATRIX2 &mat2)
{
if (m1) delete m1;
if (m2) delete m2;
- m1 = new PointerMatrix<MATRIX1, VECTOR>(&mat1, typeid(*this).name());
- m2 = new PointerMatrix<MATRIX2, VECTOR>(&mat2, typeid(*this).name());
+ m1 = new PointerMatrix<MATRIX1, VectorType>(&mat1, typeid(*this).name());
+ m2 = new PointerMatrix<MATRIX2, VectorType>(&mat2, typeid(*this).name());
}
-template<class VECTOR>
+template<typename VectorType>
template<class MATRIX1, class MATRIX2>
void
-ProductMatrix<VECTOR>::initialize (
- const MATRIX1 &mat1,
- const MATRIX2 &mat2,
- VectorMemory<VECTOR> &memory)
+ProductMatrix<VectorType>::initialize (const MATRIX1 &mat1,
+ const MATRIX2 &mat2,
+ VectorMemory<VectorType> &memory)
{
mem = &memory;
if (m1) delete m1;
if (m2) delete m2;
- m1 = new PointerMatrix<MATRIX1, VECTOR>(&mat1, typeid(*this).name());
- m2 = new PointerMatrix<MATRIX2, VECTOR>(&mat2, typeid(*this).name());
+ m1 = new PointerMatrix<MATRIX1, VectorType>(&mat1, typeid(*this).name());
+ m2 = new PointerMatrix<MATRIX2, VectorType>(&mat2, typeid(*this).name());
}
-template<class VECTOR>
-ProductMatrix<VECTOR>::~ProductMatrix ()
+template<typename VectorType>
+ProductMatrix<VectorType>::~ProductMatrix ()
{
if (m1) delete m1;
if (m2) delete m2;
}
-template<class VECTOR>
+template<typename VectorType>
void
-ProductMatrix<VECTOR>::clear ()
+ProductMatrix<VectorType>::clear ()
{
if (m1) delete m1;
m1 = 0;
}
-template<class VECTOR>
+template<typename VectorType>
void
-ProductMatrix<VECTOR>::vmult (VECTOR &dst, const VECTOR &src) const
+ProductMatrix<VectorType>::vmult (VectorType &dst, const VectorType &src) const
{
Assert (mem != 0, ExcNotInitialized());
Assert (m1 != 0, ExcNotInitialized());
Assert (m2 != 0, ExcNotInitialized());
- VECTOR *v = mem->alloc();
+ VectorType *v = mem->alloc();
v->reinit(dst);
m2->vmult (*v, src);
m1->vmult (dst, *v);
}
-template<class VECTOR>
+template<typename VectorType>
void
-ProductMatrix<VECTOR>::vmult_add (VECTOR &dst, const VECTOR &src) const
+ProductMatrix<VectorType>::vmult_add (VectorType &dst, const VectorType &src) const
{
Assert (mem != 0, ExcNotInitialized());
Assert (m1 != 0, ExcNotInitialized());
Assert (m2 != 0, ExcNotInitialized());
- VECTOR *v = mem->alloc();
+ VectorType *v = mem->alloc();
v->reinit(dst);
m2->vmult (*v, src);
m1->vmult_add (dst, *v);
}
-template<class VECTOR>
+template<typename VectorType>
void
-ProductMatrix<VECTOR>::Tvmult (VECTOR &dst, const VECTOR &src) const
+ProductMatrix<VectorType>::Tvmult (VectorType &dst, const VectorType &src) const
{
Assert (mem != 0, ExcNotInitialized());
Assert (m1 != 0, ExcNotInitialized());
Assert (m2 != 0, ExcNotInitialized());
- VECTOR *v = mem->alloc();
+ VectorType *v = mem->alloc();
v->reinit(dst);
m1->Tvmult (*v, src);
m2->Tvmult (dst, *v);
}
-template<class VECTOR>
+template<typename VectorType>
void
-ProductMatrix<VECTOR>::Tvmult_add (VECTOR &dst, const VECTOR &src) const
+ProductMatrix<VectorType>::Tvmult_add (VectorType &dst, const VectorType &src) const
{
Assert (mem != 0, ExcNotInitialized());
Assert (m1 != 0, ExcNotInitialized());
Assert (m2 != 0, ExcNotInitialized());
- VECTOR *v = mem->alloc();
+ VectorType *v = mem->alloc();
v->reinit(dst);
m1->Tvmult (*v, src);
m2->Tvmult_add (dst, *v);
//---------------------------------------------------------------------------
-template <class VECTOR>
+template <typename VectorType>
inline void
-MeanValueFilter::Tvmult(VECTOR &, const VECTOR &) const
+MeanValueFilter::Tvmult(VectorType &, const VectorType &) const
{
Assert(false, ExcNotImplemented());
}
-template <class VECTOR>
+template <typename VectorType>
inline void
-MeanValueFilter::Tvmult_add(VECTOR &, const VECTOR &) const
+MeanValueFilter::Tvmult_add(VectorType &, const VectorType &) const
{
Assert(false, ExcNotImplemented());
}
//-----------------------------------------------------------------------//
-template <class VECTOR>
+template <typename VectorType>
template <class MATRIX, class PRECONDITION>
inline void
-InverseMatrixRichardson<VECTOR>::initialize (const MATRIX &m, const PRECONDITION &p)
+InverseMatrixRichardson<VectorType>::initialize (const MATRIX &m, const PRECONDITION &p)
{
if (matrix != 0)
delete matrix;
- matrix = new PointerMatrix<MATRIX, VECTOR>(&m);
+ matrix = new PointerMatrix<MATRIX, VectorType>(&m);
if (precondition != 0)
delete precondition;
- precondition = new PointerMatrix<PRECONDITION, VECTOR>(&p);
+ precondition = new PointerMatrix<PRECONDITION, VectorType>(&p);
}
//----------------------------------------------------------------------//
-template <class VECTOR>
-InverseMatrixRichardson<VECTOR>::InverseMatrixRichardson(
+template <typename VectorType>
+InverseMatrixRichardson<VectorType>::InverseMatrixRichardson(
SolverControl &c,
- VectorMemory<VECTOR> &m)
+ VectorMemory<VectorType> &m)
:
mem(m),
solver(c,m),
{}
-template <class VECTOR>
-InverseMatrixRichardson<VECTOR>::~InverseMatrixRichardson()
+template <typename VectorType>
+InverseMatrixRichardson<VectorType>::~InverseMatrixRichardson()
{
if (matrix != 0) delete matrix;
if (precondition != 0) delete precondition;
}
-template <class VECTOR>
+template <typename VectorType>
void
-InverseMatrixRichardson<VECTOR>::vmult(VECTOR &dst, const VECTOR &src) const
+InverseMatrixRichardson<VectorType>::vmult(VectorType &dst, const VectorType &src) const
{
Assert (matrix != 0, ExcNotInitialized());
Assert (precondition != 0, ExcNotInitialized());
-template <class VECTOR>
+template <typename VectorType>
void
-InverseMatrixRichardson<VECTOR>::vmult_add(VECTOR &dst, const VECTOR &src) const
+InverseMatrixRichardson<VectorType>::vmult_add(VectorType &dst, const VectorType &src) const
{
Assert (matrix != 0, ExcNotInitialized());
Assert (precondition != 0, ExcNotInitialized());
- VECTOR *aux = mem.alloc();
+ VectorType *aux = mem.alloc();
aux->reinit(dst);
solver.solve(*matrix, *aux, src, *precondition);
-template <class VECTOR>
+template <typename VectorType>
void
-InverseMatrixRichardson<VECTOR>::Tvmult(VECTOR &dst, const VECTOR &src) const
+InverseMatrixRichardson<VectorType>::Tvmult(VectorType &dst, const VectorType &src) const
{
Assert (matrix != 0, ExcNotInitialized());
Assert (precondition != 0, ExcNotInitialized());
-template <class VECTOR>
+template <typename VectorType>
void
-InverseMatrixRichardson<VECTOR>::Tvmult_add(VECTOR &dst, const VECTOR &src) const
+InverseMatrixRichardson<VectorType>::Tvmult_add(VectorType &dst, const VectorType &src) const
{
Assert (matrix != 0, ExcNotInitialized());
Assert (precondition != 0, ExcNotInitialized());
- VECTOR *aux = mem.alloc();
+ VectorType *aux = mem.alloc();
aux->reinit(dst);
solver.Tsolve(*matrix, *aux, src, *precondition);
/**
* Apply preconditioner.
*/
- template<class VECTOR>
- void vmult (VECTOR &, const VECTOR &) const;
+ template<class VectorType>
+ void vmult (VectorType &, const VectorType &) const;
/**
* Apply transpose preconditioner. Since this is the identity, this function
* is the same as vmult().
*/
- template<class VECTOR>
- void Tvmult (VECTOR &, const VECTOR &) const;
+ template<class VectorType>
+ void Tvmult (VectorType &, const VectorType &) const;
/**
* Apply preconditioner, adding to the previous value.
*/
- template<class VECTOR>
- void vmult_add (VECTOR &, const VECTOR &) const;
+ template<class VectorType>
+ void vmult_add (VectorType &, const VectorType &) const;
/**
* Apply transpose preconditioner, adding. Since this is the identity, this
* function is the same as vmult_add().
*/
- template<class VECTOR>
- void Tvmult_add (VECTOR &, const VECTOR &) const;
+ template<class VectorType>
+ void Tvmult_add (VectorType &, const VectorType &) const;
/**
* This function is only present to provide the interface of a
/**
* Apply preconditioner.
*/
- template<class VECTOR>
- void vmult (VECTOR &, const VECTOR &) const;
+ template<class VectorType>
+ void vmult (VectorType &, const VectorType &) const;
/**
* Apply transpose preconditioner. Since this is the identity, this function
* is the same as vmult().
*/
- template<class VECTOR>
- void Tvmult (VECTOR &, const VECTOR &) const;
+ template<class VectorType>
+ void Tvmult (VectorType &, const VectorType &) const;
/**
* Apply preconditioner, adding to the previous value.
*/
- template<class VECTOR>
- void vmult_add (VECTOR &, const VECTOR &) const;
+ template<class VectorType>
+ void vmult_add (VectorType &, const VectorType &) const;
/**
* Apply transpose preconditioner, adding. Since this is the identity, this
* function is the same as vmult_add().
*/
- template<class VECTOR>
- void Tvmult_add (VECTOR &, const VECTOR &) const;
+ template<class VectorType>
+ void Tvmult_add (VectorType &, const VectorType &) const;
/**
* This function is only present to provide the interface of a
*
* @author Guido Kanschat, Wolfgang Bangerth, 1999
*/
-template<class MATRIX = SparseMatrix<double>, class VECTOR = Vector<double> >
+template<class MATRIX = SparseMatrix<double>, class VectorType = Vector<double> >
class PreconditionUseMatrix : public Subscriptor
{
public:
/**
* Type of the preconditioning function of the matrix.
*/
- typedef void ( MATRIX::* function_ptr)(VECTOR &, const VECTOR &) const;
+ typedef void ( MATRIX::* function_ptr)(VectorType &, const VectorType &) const;
/**
* Constructor. This constructor stores a reference to the matrix object
* Execute preconditioning. Calls the function passed to the constructor of
* this object with the two arguments given here.
*/
- void vmult (VECTOR &dst,
- const VECTOR &src) const;
+ void vmult (VectorType &dst,
+ const VectorType &src) const;
private:
/**
/**
* Jacobi preconditioner using matrix built-in function. The <tt>MATRIX</tt>
- * class used is required to have a function <tt>precondition_Jacobi(VECTOR&,
- * const VECTOR&, double</tt>)
+ * class used is required to have a function <tt>precondition_Jacobi(VectorType&,
+ * const VectorType&, double</tt>)
*
* @code
* // Declare related objects
/**
* Apply preconditioner.
*/
- template<class VECTOR>
- void vmult (VECTOR &, const VECTOR &) const;
+ template<class VectorType>
+ void vmult (VectorType &, const VectorType &) const;
/**
* Apply transpose preconditioner. Since this is a symmetric preconditioner,
* this function is the same as vmult().
*/
- template<class VECTOR>
- void Tvmult (VECTOR &, const VECTOR &) const;
+ template<class VectorType>
+ void Tvmult (VectorType &, const VectorType &) const;
/**
* Perform one step of the preconditioned Richardson iteration.
*/
- template<class VECTOR>
- void step (VECTOR &x, const VECTOR &rhs) const;
+ template<class VectorType>
+ void step (VectorType &x, const VectorType &rhs) const;
/**
* Perform one transposed step of the preconditioned Richardson iteration.
*/
- template<class VECTOR>
- void Tstep (VECTOR &x, const VECTOR &rhs) const;
+ template<class VectorType>
+ void Tstep (VectorType &x, const VectorType &rhs) const;
};
* is the operation implemented by step().
*
* The MATRIX class used is required to have functions
- * <tt>precondition_SOR(VECTOR&, const VECTOR&, double)</tt> and
- * <tt>precondition_TSOR(VECTOR&, const VECTOR&, double)</tt>.
+ * <tt>precondition_SOR(VectorType&, const VectorType&, double)</tt> and
+ * <tt>precondition_TSOR(VectorType&, const VectorType&, double)</tt>.
*
* @code
* // Declare related objects
/**
* Apply preconditioner.
*/
- template<class VECTOR>
- void vmult (VECTOR &, const VECTOR &) const;
+ template<class VectorType>
+ void vmult (VectorType &, const VectorType &) const;
/**
* Apply transpose preconditioner.
*/
- template<class VECTOR>
- void Tvmult (VECTOR &, const VECTOR &) const;
+ template<class VectorType>
+ void Tvmult (VectorType &, const VectorType &) const;
/**
* Perform one step of the preconditioned Richardson iteration.
*/
- template<class VECTOR>
- void step (VECTOR &x, const VECTOR &rhs) const;
+ template<class VectorType>
+ void step (VectorType &x, const VectorType &rhs) const;
/**
* Perform one transposed step of the preconditioned Richardson iteration.
*/
- template<class VECTOR>
- void Tstep (VECTOR &x, const VECTOR &rhs) const;
+ template<class VectorType>
+ void Tstep (VectorType &x, const VectorType &rhs) const;
};
/**
* SSOR preconditioner using matrix built-in function. The <tt>MATRIX</tt>
- * class used is required to have a function <tt>precondition_SSOR(VECTOR&,
- * const VECTOR&, double)</tt>
+ * class used is required to have a function <tt>precondition_SSOR(VectorType&,
+ * const VectorType&, double)</tt>
*
* @code
* // Declare related objects
/**
* Apply preconditioner.
*/
- template<class VECTOR>
- void vmult (VECTOR &, const VECTOR &) const;
+ template<class VectorType>
+ void vmult (VectorType &, const VectorType &) const;
/**
* Apply transpose preconditioner. Since this is a symmetric preconditioner,
* this function is the same as vmult().
*/
- template<class VECTOR>
- void Tvmult (VECTOR &, const VECTOR &) const;
+ template<class VectorType>
+ void Tvmult (VectorType &, const VectorType &) const;
/**
* Perform one step of the preconditioned Richardson iteration
*/
- template<class VECTOR>
- void step (VECTOR &x, const VECTOR &rhs) const;
+ template<class VectorType>
+ void step (VectorType &x, const VectorType &rhs) const;
/**
* Perform one transposed step of the preconditioned Richardson iteration.
*/
- template<class VECTOR>
- void Tstep (VECTOR &x, const VECTOR &rhs) const;
+ template<class VectorType>
+ void Tstep (VectorType &x, const VectorType &rhs) const;
private:
/**
/**
* Permuted SOR preconditioner using matrix built-in function. The
- * <tt>MATRIX</tt> class used is required to have functions <tt>PSOR(VECTOR&,
- * const VECTOR&, double)</tt> and <tt>TPSOR(VECTOR&, const VECTOR&,
+ * <tt>MATRIX</tt> class used is required to have functions <tt>PSOR(VectorType&,
+ * const VectorType&, double)</tt> and <tt>TPSOR(VectorType&, const VectorType&,
* double)</tt>.
*
* @code
/**
* Apply preconditioner.
*/
- template<class VECTOR>
- void vmult (VECTOR &, const VECTOR &) const;
+ template<class VectorType>
+ void vmult (VectorType &, const VectorType &) const;
/**
* Apply transpose preconditioner.
*/
- template<class VECTOR>
- void Tvmult (VECTOR &, const VECTOR &) const;
+ template<class VectorType>
+ void Tvmult (VectorType &, const VectorType &) const;
private:
/**
* Storage for the permutation vector.
* @author Martin Kronbichler, 2009; extension for full compatibility with
* LinearOperator class: Jean-Paul Pelteret, 2015
*/
-template <class MATRIX=SparseMatrix<double>, class VECTOR=Vector<double> >
+template <class MATRIX=SparseMatrix<double>, class VectorType=Vector<double> >
class PreconditionChebyshev : public Subscriptor
{
public:
/**
* Stores the inverse of the diagonal of the underlying matrix.
*/
- VECTOR matrix_diagonal_inverse;
+ VectorType matrix_diagonal_inverse;
};
PreconditionChebyshev ();
* Computes the action of the preconditioner on <tt>src</tt>, storing the
* result in <tt>dst</tt>.
*/
- void vmult (VECTOR &dst,
- const VECTOR &src) const;
+ void vmult (VectorType &dst,
+ const VectorType &src) const;
/**
* Computes the action of the transposed preconditioner on <tt>src</tt>,
* storing the result in <tt>dst</tt>.
*/
- void Tvmult (VECTOR &dst,
- const VECTOR &src) const;
+ void Tvmult (VectorType &dst,
+ const VectorType &src) const;
/**
* Resets the preconditioner.
/**
* A pointer to the underlying matrix.
*/
- SmartPointer<const MATRIX,PreconditionChebyshev<MATRIX,VECTOR> > matrix_ptr;
+ SmartPointer<const MATRIX,PreconditionChebyshev<MATRIX,VectorType> > matrix_ptr;
/**
* Internal vector used for the <tt>vmult</tt> operation.
*/
- mutable VECTOR update1;
+ mutable VectorType update1;
/**
* Internal vector used for the <tt>vmult</tt> operation.
*/
- mutable VECTOR update2;
+ mutable VectorType update2;
/**
* Stores the additional data provided to the initialize function.
}
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionIdentity::vmult (VECTOR &dst, const VECTOR &src) const
+PreconditionIdentity::vmult (VectorType &dst, const VectorType &src) const
{
dst = src;
}
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionIdentity::Tvmult (VECTOR &dst, const VECTOR &src) const
+PreconditionIdentity::Tvmult (VectorType &dst, const VectorType &src) const
{
dst = src;
}
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionIdentity::vmult_add (VECTOR &dst, const VECTOR &src) const
+PreconditionIdentity::vmult_add (VectorType &dst, const VectorType &src) const
{
dst.add(src);
}
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionIdentity::Tvmult_add (VECTOR &dst, const VECTOR &src) const
+PreconditionIdentity::Tvmult_add (VectorType &dst, const VectorType &src) const
{
dst.add(src);
}
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionRichardson::vmult (VECTOR &dst, const VECTOR &src) const
+PreconditionRichardson::vmult (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<size_type, typename VECTOR::size_type>::value,
- "PreconditionRichardson and VECTOR must have the same size_type.");
+ std::is_same<size_type, typename VectorType::size_type>::value,
+ "PreconditionRichardson and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
dst.equ(relaxation,src);
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionRichardson::Tvmult (VECTOR &dst, const VECTOR &src) const
+PreconditionRichardson::Tvmult (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<size_type, typename VECTOR::size_type>::value,
- "PreconditionRichardson and VECTOR must have the same size_type.");
+ std::is_same<size_type, typename VectorType::size_type>::value,
+ "PreconditionRichardson and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
dst.equ(relaxation,src);
}
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionRichardson::vmult_add (VECTOR &dst, const VECTOR &src) const
+PreconditionRichardson::vmult_add (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<size_type, typename VECTOR::size_type>::value,
- "PreconditionRichardson and VECTOR must have the same size_type.");
+ std::is_same<size_type, typename VectorType::size_type>::value,
+ "PreconditionRichardson and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
dst.add(relaxation,src);
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionRichardson::Tvmult_add (VECTOR &dst, const VECTOR &src) const
+PreconditionRichardson::Tvmult_add (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<size_type, typename VECTOR::size_type>::value,
- "PreconditionRichardson and VECTOR must have the same size_type.");
+ std::is_same<size_type, typename VectorType::size_type>::value,
+ "PreconditionRichardson and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
dst.add(relaxation,src);
//---------------------------------------------------------------------------
template <class MATRIX>
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionJacobi<MATRIX>::vmult (VECTOR &dst, const VECTOR &src) const
+PreconditionJacobi<MATRIX>::vmult (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<typename PreconditionJacobi<MATRIX>::size_type, typename VECTOR::size_type>::value,
- "PreconditionJacobi and VECTOR must have the same size_type.");
+ std::is_same<typename PreconditionJacobi<MATRIX>::size_type, typename VectorType::size_type>::value,
+ "PreconditionJacobi and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
template <class MATRIX>
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionJacobi<MATRIX>::Tvmult (VECTOR &dst, const VECTOR &src) const
+PreconditionJacobi<MATRIX>::Tvmult (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<typename PreconditionJacobi<MATRIX>::size_type, typename VECTOR::size_type>::value,
- "PreconditionJacobi and VECTOR must have the same size_type.");
+ std::is_same<typename PreconditionJacobi<MATRIX>::size_type, typename VectorType::size_type>::value,
+ "PreconditionJacobi and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
template <class MATRIX>
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionJacobi<MATRIX>::step (VECTOR &dst, const VECTOR &src) const
+PreconditionJacobi<MATRIX>::step (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<typename PreconditionJacobi<MATRIX>::size_type, typename VECTOR::size_type>::value,
- "PreconditionJacobi and VECTOR must have the same size_type.");
+ std::is_same<typename PreconditionJacobi<MATRIX>::size_type, typename VectorType::size_type>::value,
+ "PreconditionJacobi and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
template <class MATRIX>
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionJacobi<MATRIX>::Tstep (VECTOR &dst, const VECTOR &src) const
+PreconditionJacobi<MATRIX>::Tstep (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<typename PreconditionJacobi<MATRIX>::size_type, typename VECTOR::size_type>::value,
- "PreconditionJacobi and VECTOR must have the same size_type.");
+ std::is_same<typename PreconditionJacobi<MATRIX>::size_type, typename VectorType::size_type>::value,
+ "PreconditionJacobi and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
step (dst, src);
//---------------------------------------------------------------------------
template <class MATRIX>
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionSOR<MATRIX>::vmult (VECTOR &dst, const VECTOR &src) const
+PreconditionSOR<MATRIX>::vmult (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<typename PreconditionSOR<MATRIX>::size_type, typename VECTOR::size_type>::value,
- "PreconditionSOR and VECTOR must have the same size_type.");
+ std::is_same<typename PreconditionSOR<MATRIX>::size_type, typename VectorType::size_type>::value,
+ "PreconditionSOR and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
template <class MATRIX>
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionSOR<MATRIX>::Tvmult (VECTOR &dst, const VECTOR &src) const
+PreconditionSOR<MATRIX>::Tvmult (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<typename PreconditionSOR<MATRIX>::size_type, typename VECTOR::size_type>::value,
- "PreconditionSOR and VECTOR must have the same size_type.");
+ std::is_same<typename PreconditionSOR<MATRIX>::size_type, typename VectorType::size_type>::value,
+ "PreconditionSOR and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
template <class MATRIX>
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionSOR<MATRIX>::step (VECTOR &dst, const VECTOR &src) const
+PreconditionSOR<MATRIX>::step (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<typename PreconditionSOR<MATRIX>::size_type, typename VECTOR::size_type>::value,
- "PreconditionSOR and VECTOR must have the same size_type.");
+ std::is_same<typename PreconditionSOR<MATRIX>::size_type, typename VectorType::size_type>::value,
+ "PreconditionSOR and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
template <class MATRIX>
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionSOR<MATRIX>::Tstep (VECTOR &dst, const VECTOR &src) const
+PreconditionSOR<MATRIX>::Tstep (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<typename PreconditionSOR<MATRIX>::size_type, typename VECTOR::size_type>::value,
- "PreconditionSOR and VECTOR must have the same size_type.");
+ std::is_same<typename PreconditionSOR<MATRIX>::size_type, typename VectorType::size_type>::value,
+ "PreconditionSOR and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
template <class MATRIX>
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionSSOR<MATRIX>::vmult (VECTOR &dst, const VECTOR &src) const
+PreconditionSSOR<MATRIX>::vmult (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<typename PreconditionSSOR<MATRIX>::size_type, typename VECTOR::size_type>::value,
- "PreconditionSSOR and VECTOR must have the same size_type.");
+ std::is_same<typename PreconditionSSOR<MATRIX>::size_type, typename VectorType::size_type>::value,
+ "PreconditionSSOR and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
template <class MATRIX>
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionSSOR<MATRIX>::Tvmult (VECTOR &dst, const VECTOR &src) const
+PreconditionSSOR<MATRIX>::Tvmult (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<typename PreconditionSSOR<MATRIX>::size_type, typename VECTOR::size_type>::value,
- "PreconditionSSOR and VECTOR must have the same size_type.");
+ std::is_same<typename PreconditionSSOR<MATRIX>::size_type, typename VectorType::size_type>::value,
+ "PreconditionSSOR and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
template <class MATRIX>
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionSSOR<MATRIX>::step (VECTOR &dst, const VECTOR &src) const
+PreconditionSSOR<MATRIX>::step (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<typename PreconditionSSOR<MATRIX>::size_type, typename VECTOR::size_type>::value,
- "PreconditionSSOR and VECTOR must have the same size_type.");
+ std::is_same<typename PreconditionSSOR<MATRIX>::size_type, typename VectorType::size_type>::value,
+ "PreconditionSSOR and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
template <class MATRIX>
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionSSOR<MATRIX>::Tstep (VECTOR &dst, const VECTOR &src) const
+PreconditionSSOR<MATRIX>::Tstep (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<typename PreconditionSSOR<MATRIX>::size_type, typename VECTOR::size_type>::value,
- "PreconditionSSOR and VECTOR must have the same size_type.");
+ std::is_same<typename PreconditionSSOR<MATRIX>::size_type, typename VectorType::size_type>::value,
+ "PreconditionSSOR and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
step (dst, src);
template <class MATRIX>
-template<class VECTOR>
+template <typename VectorType>
inline void
-PreconditionPSOR<MATRIX>::vmult (VECTOR &dst, const VECTOR &src) const
+PreconditionPSOR<MATRIX>::vmult (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<typename PreconditionPSOR<MATRIX>::size_type, typename VECTOR::size_type>::value,
- "PreconditionPSOR and VECTOR must have the same size_type.");
+ std::is_same<typename PreconditionPSOR<MATRIX>::size_type, typename VectorType::size_type>::value,
+ "PreconditionPSOR and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
template <class MATRIX>
-template<class VECTOR>
+template<class VectorType>
inline void
-PreconditionPSOR<MATRIX>::Tvmult (VECTOR &dst, const VECTOR &src) const
+PreconditionPSOR<MATRIX>::Tvmult (VectorType &dst, const VectorType &src) const
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<typename PreconditionPSOR<MATRIX>::size_type, typename VECTOR::size_type>::value,
- "PreconditionPSOR and VECTOR must have the same size_type.");
+ std::is_same<typename PreconditionPSOR<MATRIX>::size_type, typename VectorType::size_type>::value,
+ "PreconditionPSOR and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
//---------------------------------------------------------------------------
-template<class MATRIX, class VECTOR>
-PreconditionUseMatrix<MATRIX,VECTOR>::PreconditionUseMatrix(const MATRIX &M,
- const function_ptr method)
+template<class MATRIX, class VectorType>
+PreconditionUseMatrix<MATRIX,VectorType>::PreconditionUseMatrix(const MATRIX &M,
+ const function_ptr method)
:
matrix(M), precondition(method)
{}
-template<class MATRIX, class VECTOR>
+template<class MATRIX, class VectorType>
void
-PreconditionUseMatrix<MATRIX,VECTOR>::vmult (VECTOR &dst,
- const VECTOR &src) const
+PreconditionUseMatrix<MATRIX,VectorType>::vmult (VectorType &dst,
+ const VectorType &src) const
{
(matrix.*precondition)(dst, src);
}
// size of the vector
// generic part for non-deal.II vectors
- template <typename VECTOR>
+ template <typename VectorType>
inline
void
- vector_updates (const VECTOR &src,
- const VECTOR &matrix_diagonal_inverse,
- const bool start_zero,
- const double factor1,
- const double factor2,
- VECTOR &update1,
- VECTOR &update2,
- VECTOR &dst)
+ vector_updates (const VectorType &src,
+ const VectorType &matrix_diagonal_inverse,
+ const bool start_zero,
+ const double factor1,
+ const double factor2,
+ VectorType &update1,
+ VectorType &update2,
+ VectorType &dst)
{
if (start_zero)
{
VectorUpdatesRange<Number>(upd, src.local_size());
}
- template <typename VECTOR>
+ template <typename VectorType>
struct DiagonalPreconditioner
{
- DiagonalPreconditioner (const VECTOR &vector)
+ DiagonalPreconditioner (const VectorType &vector)
:
diagonal_vector(vector)
{}
- void vmult (VECTOR &dst,
- const VECTOR &src) const
+ void vmult (VectorType &dst,
+ const VectorType &src) const
{
dst = src;
dst.scale(diagonal_vector);
}
- const VECTOR &diagonal_vector;
+ const VectorType &diagonal_vector;
};
struct EigenvalueTracker
-template <class MATRIX, class VECTOR>
+template <class MATRIX, class VectorType>
inline
-PreconditionChebyshev<MATRIX,VECTOR>::AdditionalData::
+PreconditionChebyshev<MATRIX,VectorType>::AdditionalData::
AdditionalData (const unsigned int degree,
const double smoothing_range,
const bool nonzero_starting,
-template <class MATRIX, class VECTOR>
+template <class MATRIX, class VectorType>
inline
-PreconditionChebyshev<MATRIX,VECTOR>::PreconditionChebyshev ()
+PreconditionChebyshev<MATRIX,VectorType>::PreconditionChebyshev ()
:
is_initialized (false)
{
#ifdef DEAL_II_WITH_CXX11
static_assert(
- std::is_same<size_type, typename VECTOR::size_type>::value,
- "PreconditionChebyshev and VECTOR must have the same size_type.");
+ std::is_same<size_type, typename VectorType::size_type>::value,
+ "PreconditionChebyshev and VectorType must have the same size_type.");
#endif // DEAL_II_WITH_CXX11
}
-template <class MATRIX, class VECTOR>
+template <class MATRIX, class VectorType>
inline
void
-PreconditionChebyshev<MATRIX,VECTOR>::initialize (const MATRIX &matrix,
- const AdditionalData &additional_data)
+PreconditionChebyshev<MATRIX,VectorType>::initialize (const MATRIX &matrix,
+ const AdditionalData &additional_data)
{
matrix_ptr = &matrix;
data = additional_data;
// set a very strict tolerance to force at least two iterations
ReductionControl control (data.eig_cg_n_iterations, 1e-35, 1e-10);
- GrowingVectorMemory<VECTOR> memory;
- VECTOR *rhs = memory.alloc();
- VECTOR *dummy = memory.alloc();
+ GrowingVectorMemory<VectorType> memory;
+ VectorType *rhs = memory.alloc();
+ VectorType *dummy = memory.alloc();
rhs->reinit(data.matrix_diagonal_inverse);
dummy->reinit(data.matrix_diagonal_inverse);
rhs->compress(VectorOperation::insert);
internal::PreconditionChebyshev::EigenvalueTracker eigenvalue_tracker;
- SolverCG<VECTOR> solver (control, memory);
+ SolverCG<VectorType> solver (control, memory);
solver.connect_eigenvalues_slot(std_cxx11::bind(&internal::PreconditionChebyshev::EigenvalueTracker::slot,
&eigenvalue_tracker,
std_cxx11::_1));
- internal::PreconditionChebyshev::DiagonalPreconditioner<VECTOR>
+ internal::PreconditionChebyshev::DiagonalPreconditioner<VectorType>
preconditioner(data.matrix_diagonal_inverse);
try
{
-template <class MATRIX, class VECTOR>
+template <class MATRIX, class VectorType>
inline
void
-PreconditionChebyshev<MATRIX,VECTOR>::vmult (VECTOR &dst,
- const VECTOR &src) const
+PreconditionChebyshev<MATRIX,VectorType>::vmult (VectorType &dst,
+ const VectorType &src) const
{
Assert (is_initialized, ExcMessage("Preconditioner not initialized"));
double rhok = delta / theta, sigma = theta / delta;
-template <class MATRIX, class VECTOR>
+template <class MATRIX, class VectorType>
inline
void
-PreconditionChebyshev<MATRIX,VECTOR>::Tvmult (VECTOR &dst,
- const VECTOR &src) const
+PreconditionChebyshev<MATRIX,VectorType>::Tvmult (VectorType &dst,
+ const VectorType &src) const
{
Assert (is_initialized, ExcMessage("Preconditioner not initialized"));
double rhok = delta / theta, sigma = theta / delta;
-template <class MATRIX, class VECTOR>
+template <class MATRIX, typename VectorType>
inline
-void PreconditionChebyshev<MATRIX,VECTOR>::clear ()
+void PreconditionChebyshev<MATRIX,VectorType>::clear ()
{
is_initialized = false;
matrix_ptr = 0;
}
-template <class MATRIX, class VECTOR>
+template <class MATRIX, typename VectorType>
inline
-typename PreconditionChebyshev<MATRIX,VECTOR>::size_type
-PreconditionChebyshev<MATRIX,VECTOR>::m () const
+typename PreconditionChebyshev<MATRIX,VectorType>::size_type
+PreconditionChebyshev<MATRIX,VectorType>::m () const
{
Assert (matrix_ptr!=0, ExcNotInitialized());
return matrix_ptr->m();
}
-template <class MATRIX, class VECTOR>
+template <class MATRIX, typename VectorType>
inline
-typename PreconditionChebyshev<MATRIX,VECTOR>::size_type
-PreconditionChebyshev<MATRIX,VECTOR>::n () const
+typename PreconditionChebyshev<MATRIX,VectorType>::size_type
+PreconditionChebyshev<MATRIX,VectorType>::n () const
{
Assert (matrix_ptr!=0, ExcNotInitialized());
return matrix_ptr->n();
*
* @author W. Bangerth, G. Kanschat, R. Becker and F.-T. Suttmeier
*/
-template <class VECTOR = Vector<double> >
-class SolverCG : public Solver<VECTOR>
+template <typename VectorType = Vector<double> >
+class SolverCG : public Solver<VectorType>
{
public:
/**
/**
* Constructor.
*/
- SolverCG (SolverControl &cn,
- VectorMemory<VECTOR> &mem,
- const AdditionalData &data = AdditionalData());
+ SolverCG (SolverControl &cn,
+ VectorMemory<VectorType> &mem,
+ const AdditionalData &data = AdditionalData());
/**
* Constructor. Use an object of type GrowingVectorMemory as a default to
template <class MATRIX, class PRECONDITIONER>
void
solve (const MATRIX &A,
- VECTOR &x,
- const VECTOR &b,
+ VectorType &x,
+ const VectorType &b,
const PRECONDITIONER &precondition);
/**
* for a graphical output of the convergence history.
*/
virtual void print_vectors(const unsigned int step,
- const VECTOR &x,
- const VECTOR &r,
- const VECTOR &d) const;
+ const VectorType &x,
+ const VectorType &r,
+ const VectorType &d) const;
/**
* Estimates the eigenvalues from diagonal and offdiagonal. Uses
* Temporary vectors, allocated through the @p VectorMemory object at the
* start of the actual solution process and deallocated at the end.
*/
- VECTOR *Vr;
- VECTOR *Vp;
- VECTOR *Vz;
+ VectorType *Vr;
+ VectorType *Vp;
+ VectorType *Vz;
/**
* Within the iteration loop, the square of the residual vector is stored in
#ifndef DOXYGEN
-template <class VECTOR>
+template <typename VectorType>
inline
-SolverCG<VECTOR>::AdditionalData::
+SolverCG<VectorType>::AdditionalData::
AdditionalData (const bool log_coefficients,
const bool compute_condition_number,
const bool compute_all_condition_numbers,
-template <class VECTOR>
+template <typename VectorType>
inline
-SolverCG<VECTOR>::AdditionalData::
+SolverCG<VectorType>::AdditionalData::
AdditionalData ()
:
log_coefficients (false),
-template <class VECTOR>
-SolverCG<VECTOR>::SolverCG (SolverControl &cn,
- VectorMemory<VECTOR> &mem,
- const AdditionalData &data)
+template <typename VectorType>
+SolverCG<VectorType>::SolverCG (SolverControl &cn,
+ VectorMemory<VectorType> &mem,
+ const AdditionalData &data)
:
- Solver<VECTOR>(cn,mem),
+ Solver<VectorType>(cn,mem),
additional_data(data)
{}
-template <class VECTOR>
-SolverCG<VECTOR>::SolverCG (SolverControl &cn,
- const AdditionalData &data)
+template <typename VectorType>
+SolverCG<VectorType>::SolverCG (SolverControl &cn,
+ const AdditionalData &data)
:
- Solver<VECTOR>(cn),
+ Solver<VectorType>(cn),
additional_data(data)
{}
-template <class VECTOR>
-SolverCG<VECTOR>::~SolverCG ()
+template <typename VectorType>
+SolverCG<VectorType>::~SolverCG ()
{}
-template <class VECTOR>
+template <typename VectorType>
double
-SolverCG<VECTOR>::criterion()
+SolverCG<VectorType>::criterion()
{
return std::sqrt(res2);
}
-template <class VECTOR>
+template <typename VectorType>
void
-SolverCG<VECTOR>::cleanup()
+SolverCG<VectorType>::cleanup()
{
this->memory.free(Vr);
this->memory.free(Vp);
-template <class VECTOR>
+template <typename VectorType>
void
-SolverCG<VECTOR>::print_vectors(const unsigned int,
- const VECTOR &,
- const VECTOR &,
- const VECTOR &) const
+SolverCG<VectorType>::print_vectors(const unsigned int,
+ const VectorType &,
+ const VectorType &,
+ const VectorType &) const
{}
-template <class VECTOR>
+template <typename VectorType>
inline void
-SolverCG<VECTOR>::compute_eigs_and_cond(
- const std::vector<double> &diagonal,
- const std::vector<double> &offdiagonal,
- const boost::signals2::signal<void (const std::vector<double> &)> &eigenvalues_signal,
- const boost::signals2::signal<void (double)> &cond_signal,
- const bool log_eigenvalues,
- const bool log_cond)
+SolverCG<VectorType>::compute_eigs_and_cond
+(const std::vector<double> &diagonal,
+ const std::vector<double> &offdiagonal,
+ const boost::signals2::signal<void (const std::vector<double> &)> &eigenvalues_signal,
+ const boost::signals2::signal<void (double)> &cond_signal,
+ const bool log_eigenvalues,
+ const bool log_cond)
{
//Avoid computing eigenvalues unless they are needed.
if (!cond_signal.empty()|| !eigenvalues_signal.empty() || log_cond ||
-template <class VECTOR>
+template <typename VectorType>
template <class MATRIX, class PRECONDITIONER>
void
-SolverCG<VECTOR>::solve (const MATRIX &A,
- VECTOR &x,
- const VECTOR &b,
- const PRECONDITIONER &precondition)
+SolverCG<VectorType>::solve (const MATRIX &A,
+ VectorType &x,
+ const VectorType &b,
+ const PRECONDITIONER &precondition)
{
SolverControl::State conv=SolverControl::iterate;
try
{
// define some aliases for simpler access
- VECTOR &g = *Vr;
- VECTOR &d = *Vz;
- VECTOR &h = *Vp;
+ VectorType &g = *Vr;
+ VectorType &d = *Vz;
+ VectorType &h = *Vp;
// resize the vectors, but do not set
// the values since they'd be overwritten
// soon anyway.
-template<class VECTOR>
+template<typename VectorType>
boost::signals2::connection
-SolverCG<VECTOR>::connect_coefficients_slot(
- const std_cxx11::function<void(double,double)> &slot)
+SolverCG<VectorType>::connect_coefficients_slot
+(const std_cxx11::function<void(double,double)> &slot)
{
return coefficients_signal.connect(slot);
}
-template<class VECTOR>
+template<typename VectorType>
boost::signals2::connection
-SolverCG<VECTOR>::connect_condition_number_slot(
- const std_cxx11::function<void(double)> &slot,
- const bool every_iteration)
+SolverCG<VectorType>::connect_condition_number_slot
+(const std_cxx11::function<void(double)> &slot,
+ const bool every_iteration)
{
if (every_iteration)
{
-template<class VECTOR>
+template<typename VectorType>
boost::signals2::connection
-SolverCG<VECTOR>::connect_eigenvalues_slot(
- const std_cxx11::function<void (const std::vector<double> &)> &slot,
- const bool every_iteration)
+SolverCG<VectorType>::connect_eigenvalues_slot
+(const std_cxx11::function<void (const std::vector<double> &)> &slot,
+ const bool every_iteration)
{
if (every_iteration)
{
*
* @author Ralf Hartmann
*/
-template <class VECTOR = Vector<double> >
-class SolverRichardson : public Solver<VECTOR>
+template <class VectorType = Vector<double> >
+class SolverRichardson : public Solver<VectorType>
{
public:
/**
/**
* Constructor.
*/
- SolverRichardson (SolverControl &cn,
- VectorMemory<VECTOR> &mem,
- const AdditionalData &data=AdditionalData());
+ SolverRichardson (SolverControl &cn,
+ VectorMemory<VectorType> &mem,
+ const AdditionalData &data=AdditionalData());
/**
* Constructor. Use an object of type GrowingVectorMemory as a default to
template<class MATRIX, class PRECONDITIONER>
void
solve (const MATRIX &A,
- VECTOR &x,
- const VECTOR &b,
+ VectorType &x,
+ const VectorType &b,
const PRECONDITIONER &precondition);
/**
template<class MATRIX, class PRECONDITIONER>
void
Tsolve (const MATRIX &A,
- VECTOR &x,
- const VECTOR &b,
+ VectorType &x,
+ const VectorType &b,
const PRECONDITIONER &precondition);
/**
* vector, the residual and the update vector in each step. It can be used
* for a graphical output of the convergence history.
*/
- virtual void print_vectors(const unsigned int step,
- const VECTOR &x,
- const VECTOR &r,
- const VECTOR &d) const;
+ virtual void print_vectors (const unsigned int step,
+ const VectorType &x,
+ const VectorType &r,
+ const VectorType &d) const;
protected:
/**
* Implementation of the computation of the norm of the residual.
*/
- virtual typename VECTOR::value_type criterion();
+ virtual typename VectorType::value_type criterion();
/**
* Residual. Temporary vector allocated through the VectorMemory object at
* the start of the actual solution process and deallocated at the end.
*/
- VECTOR *Vr;
+ VectorType *Vr;
/**
* Preconditioned residual. Temporary vector allocated through the
* VectorMemory object at the start of the actual solution process and
* deallocated at the end.
*/
- VECTOR *Vd;
+ VectorType *Vd;
/**
* Control parameters.
* convergence value, which in this class is the norm of the residual vector
* and thus the square root of the @p res2 value.
*/
- typename VECTOR::value_type res;
+ typename VectorType::value_type res;
};
/*@}*/
#ifndef DOXYGEN
-template <class VECTOR>
+template <class VectorType>
inline
-SolverRichardson<VECTOR>::AdditionalData::
+SolverRichardson<VectorType>::AdditionalData::
AdditionalData (const double omega,
const bool use_preconditioned_residual)
:
{}
-template <class VECTOR>
-SolverRichardson<VECTOR>::SolverRichardson(SolverControl &cn,
- VectorMemory<VECTOR> &mem,
- const AdditionalData &data)
+template <class VectorType>
+SolverRichardson<VectorType>::SolverRichardson(SolverControl &cn,
+ VectorMemory<VectorType> &mem,
+ const AdditionalData &data)
:
- Solver<VECTOR> (cn,mem),
+ Solver<VectorType> (cn,mem),
additional_data(data)
{}
-template <class VECTOR>
-SolverRichardson<VECTOR>::SolverRichardson(SolverControl &cn,
- const AdditionalData &data)
+template <class VectorType>
+SolverRichardson<VectorType>::SolverRichardson(SolverControl &cn,
+ const AdditionalData &data)
:
- Solver<VECTOR> (cn),
+ Solver<VectorType> (cn),
additional_data(data)
{}
-template <class VECTOR>
-SolverRichardson<VECTOR>::~SolverRichardson()
+template <class VectorType>
+SolverRichardson<VectorType>::~SolverRichardson()
{}
-template <class VECTOR>
+template <class VectorType>
template <class MATRIX, class PRECONDITIONER>
void
-SolverRichardson<VECTOR>::solve (const MATRIX &A,
- VECTOR &x,
- const VECTOR &b,
- const PRECONDITIONER &precondition)
+SolverRichardson<VectorType>::solve (const MATRIX &A,
+ VectorType &x,
+ const VectorType &b,
+ const PRECONDITIONER &precondition)
{
SolverControl::State conv=SolverControl::iterate;
// Memory allocation
Vr = this->memory.alloc();
- VECTOR &r = *Vr;
+ VectorType &r = *Vr;
r.reinit(x);
Vd = this->memory.alloc();
- VECTOR &d = *Vd;
+ VectorType &d = *Vd;
d.reinit(x);
deallog.push("Richardson");
}
-template <class VECTOR>
+template <class VectorType>
template <class MATRIX, class PRECONDITIONER>
void
-SolverRichardson<VECTOR>::Tsolve (const MATRIX &A,
- VECTOR &x,
- const VECTOR &b,
- const PRECONDITIONER &precondition)
+SolverRichardson<VectorType>::Tsolve (const MATRIX &A,
+ VectorType &x,
+ const VectorType &b,
+ const PRECONDITIONER &precondition)
{
SolverControl::State conv=SolverControl::iterate;
double last_criterion = -std::numeric_limits<double>::max();
// Memory allocation
Vr = this->memory.alloc();
- VECTOR &r = *Vr;
+ VectorType &r = *Vr;
r.reinit(x);
Vd =this-> memory.alloc();
- VECTOR &d = *Vd;
+ VectorType &d = *Vd;
d.reinit(x);
deallog.push("RichardsonT");
}
-template <class VECTOR>
+template <class VectorType>
void
-SolverRichardson<VECTOR>::print_vectors(const unsigned int,
- const VECTOR &,
- const VECTOR &,
- const VECTOR &) const
+SolverRichardson<VectorType>::print_vectors(const unsigned int,
+ const VectorType &,
+ const VectorType &,
+ const VectorType &) const
{}
-template <class VECTOR>
-inline typename VECTOR::value_type
-SolverRichardson<VECTOR>::criterion()
+template <class VectorType>
+inline typename VectorType::value_type
+SolverRichardson<VectorType>::criterion()
{
if (!additional_data.use_preconditioned_residual)
res = Vr->l2_norm();
}
-template <class VECTOR>
+template <class VectorType>
inline void
-SolverRichardson<VECTOR>::set_omega (const double om)
+SolverRichardson<VectorType>::set_omega (const double om)
{
additional_data.omega=om;
}
*
* @author Ralf Hartmann, 1999
*/
-template <class VECTOR = Vector<double> >
+template <typename VectorType = Vector<double> >
class SolverSelector : public Subscriptor
{
public:
/**
* A typedef for the underlying vector type
*/
- typedef VECTOR vector_type;
+ typedef VectorType vector_type;
/**
* Constructor, filling in default values
*
*/
template<class Matrix, class Preconditioner>
- void solve(const Matrix &A,
- VECTOR &x,
- const VECTOR &b,
- const Preconditioner &precond) const;
+ void solve (const Matrix &A,
+ VectorType &x,
+ const VectorType &b,
+ const Preconditioner &precond) const;
/**
* Select a new solver. Note that all solver names used in this class are
/**
* Set the additional data. For more info see the @p Solver class.
*/
- void set_data(const typename SolverRichardson<VECTOR>
+ void set_data(const typename SolverRichardson<VectorType>
::AdditionalData &data);
/**
* Set the additional data. For more info see the @p Solver class.
*/
- void set_data(const typename SolverCG<VECTOR>
+ void set_data(const typename SolverCG<VectorType>
::AdditionalData &data);
/**
* Set the additional data. For more info see the @p Solver class.
*/
- void set_data(const typename SolverMinRes<VECTOR>
+ void set_data(const typename SolverMinRes<VectorType>
::AdditionalData &data);
/**
* Set the additional data. For more info see the @p Solver class.
*/
- void set_data(const typename SolverBicgstab<VECTOR>
+ void set_data(const typename SolverBicgstab<VectorType>
::AdditionalData &data);
/**
* Set the additional data. For more info see the @p Solver class.
*/
- void set_data(const typename SolverGMRES<VECTOR>
+ void set_data(const typename SolverGMRES<VectorType>
::AdditionalData &data);
/**
* Set the additional data. For more info see the @p Solver class.
*/
- void set_data(const typename SolverFGMRES<VECTOR>
+ void set_data(const typename SolverFGMRES<VectorType>
::AdditionalData &data);
/**
* Stores the @p SolverControl that is needed in the constructor of each @p
* Solver class. This can be changed with @p set_control().
*/
- SmartPointer< SolverControl, SolverSelector< VECTOR > > control;
+ SmartPointer< SolverControl, SolverSelector< VectorType > > control;
/**
* Stores the name of the solver.
/**
* Stores the additional data.
*/
- typename SolverRichardson<VECTOR>::AdditionalData richardson_data;
+ typename SolverRichardson<VectorType>::AdditionalData richardson_data;
/**
* Stores the additional data.
*/
- typename SolverCG<VECTOR>::AdditionalData cg_data;
+ typename SolverCG<VectorType>::AdditionalData cg_data;
/**
* Stores the additional data.
*/
- typename SolverMinRes<VECTOR>::AdditionalData minres_data;
+ typename SolverMinRes<VectorType>::AdditionalData minres_data;
/**
* Stores the additional data.
*/
- typename SolverBicgstab<VECTOR>::AdditionalData bicgstab_data;
+ typename SolverBicgstab<VectorType>::AdditionalData bicgstab_data;
/**
* Stores the additional data.
*/
- typename SolverGMRES<VECTOR>::AdditionalData gmres_data;
+ typename SolverGMRES<VectorType>::AdditionalData gmres_data;
/**
* Stores the additional data.
*/
- typename SolverFGMRES<VECTOR>::AdditionalData fgmres_data;
+ typename SolverFGMRES<VectorType>::AdditionalData fgmres_data;
};
/*@}*/
/* --------------------- Inline and template functions ------------------- */
-template <class VECTOR>
-SolverSelector<VECTOR>::SolverSelector()
+template <typename VectorType>
+SolverSelector<VectorType>::SolverSelector()
{}
-template <class VECTOR>
-SolverSelector<VECTOR>::~SolverSelector()
+template <typename VectorType>
+SolverSelector<VectorType>::~SolverSelector()
{}
-template <class VECTOR>
+template <typename VectorType>
void
-SolverSelector<VECTOR>::select(const std::string &name)
+SolverSelector<VectorType>::select(const std::string &name)
{
solver_name = name;
}
-template <class VECTOR>
+template <typename VectorType>
template<class Matrix, class Preconditioner>
void
-SolverSelector<VECTOR>::solve(const Matrix &A,
- VECTOR &x,
- const VECTOR &b,
- const Preconditioner &precond) const
+SolverSelector<VectorType>::solve (const Matrix &A,
+ VectorType &x,
+ const VectorType &b,
+ const Preconditioner &precond) const
{
if (solver_name=="richardson")
{
- SolverRichardson<VECTOR> solver(*control, richardson_data);
+ SolverRichardson<VectorType> solver(*control, richardson_data);
solver.solve(A,x,b,precond);
}
else if (solver_name=="cg")
{
- SolverCG<VECTOR> solver(*control, cg_data);
+ SolverCG<VectorType> solver(*control, cg_data);
solver.solve(A,x,b,precond);
}
else if (solver_name=="minres")
{
- SolverMinRes<VECTOR> solver(*control, minres_data);
+ SolverMinRes<VectorType> solver(*control, minres_data);
solver.solve(A,x,b,precond);
}
else if (solver_name=="bicgstab")
{
- SolverBicgstab<VECTOR> solver(*control, bicgstab_data);
+ SolverBicgstab<VectorType> solver(*control, bicgstab_data);
solver.solve(A,x,b,precond);
}
else if (solver_name=="gmres")
{
- SolverGMRES<VECTOR> solver(*control, gmres_data);
+ SolverGMRES<VectorType> solver(*control, gmres_data);
solver.solve(A,x,b,precond);
}
else if (solver_name=="fgmres")
{
- SolverFGMRES<VECTOR> solver(*control, fgmres_data);
+ SolverFGMRES<VectorType> solver(*control, fgmres_data);
solver.solve(A,x,b,precond);
}
else
}
-template <class VECTOR>
-void SolverSelector<VECTOR>::set_control(
- SolverControl &ctrl)
+template <typename VectorType>
+void SolverSelector<VectorType>::set_control (SolverControl &ctrl)
{
control=&ctrl;
}
-template <class VECTOR>
-std::string SolverSelector<VECTOR>::get_solver_names()
+template <typename VectorType>
+std::string SolverSelector<VectorType>::get_solver_names()
{
return "richardson|cg|bicgstab|gmres|fgmres|minres";
}
-template <class VECTOR>
-void SolverSelector<VECTOR>::set_data(
- const typename SolverGMRES<VECTOR>::AdditionalData &data)
+template <typename VectorType>
+void SolverSelector<VectorType>::set_data
+(const typename SolverGMRES<VectorType>::AdditionalData &data)
{
gmres_data=data;
}
-template <class VECTOR>
-void SolverSelector<VECTOR>::set_data(
- const typename SolverFGMRES<VECTOR>::AdditionalData &data)
+template <typename VectorType>
+void SolverSelector<VectorType>::set_data
+(const typename SolverFGMRES<VectorType>::AdditionalData &data)
{
fgmres_data=data;
}
-template <class VECTOR>
-void SolverSelector<VECTOR>::set_data(
- const typename SolverRichardson<VECTOR>::AdditionalData &data)
+template <typename VectorType>
+void SolverSelector<VectorType>::set_data
+(const typename SolverRichardson<VectorType>::AdditionalData &data)
{
richardson_data=data;
}
-template <class VECTOR>
-void SolverSelector<VECTOR>::set_data(
- const typename SolverCG<VECTOR>::AdditionalData &data)
+template <typename VectorType>
+void SolverSelector<VectorType>::set_data(
+ const typename SolverCG<VectorType>::AdditionalData &data)
{
cg_data=data;
}
-template <class VECTOR>
-void SolverSelector<VECTOR>::set_data(
- const typename SolverMinRes<VECTOR>::AdditionalData &data)
+template <typename VectorType>
+void SolverSelector<VectorType>::set_data
+(const typename SolverMinRes<VectorType>::AdditionalData &data)
{
minres_data=data;
}
-template <class VECTOR>
-void SolverSelector<VECTOR>::set_data(
- const typename SolverBicgstab<VECTOR>::AdditionalData &data)
+template <typename VectorType>
+void SolverSelector<VectorType>::set_data
+(const typename SolverBicgstab<VectorType>::AdditionalData &data)
{
bicgstab_data=data;
}
*
* @author Guido Kanschat, 1998-2003
*/
-template<class VECTOR = dealii::Vector<double> >
+template<typename VectorType = dealii::Vector<double> >
class VectorMemory : public Subscriptor
{
public:
* function should reset vectors to their proper size. The same holds for
* the contents of vectors: they are unspecified.
*/
- virtual VECTOR *alloc () = 0;
+ virtual VectorType *alloc () = 0;
/**
* Return a vector and indicate that it is not going to be used any further
* by the instance that called alloc() to get a pointer to it.
*/
- virtual void free (const VECTOR *const) = 0;
+ virtual void free (const VectorType *const) = 0;
/**
* @addtogroup Exceptions
/**
* Constructor, automatically allocating a vector from @p mem.
*/
- Pointer(VectorMemory<VECTOR> &mem);
+ Pointer(VectorMemory<VectorType> &mem);
/**
* Destructor, automatically releasing the vector from the memory #pool.
*/
/**
* Conversion to regular pointer.
*/
- operator VECTOR *() const;
+ operator VectorType *() const;
/**
* Dereferencing operator.
*/
- VECTOR &operator * () const;
+ VectorType &operator * () const;
/**
* Dereferencing operator.
*/
- VECTOR *operator -> () const;
+ VectorType *operator -> () const;
private:
/**
* The memory pool used.
*/
- SmartPointer<VectorMemory<VECTOR>,Pointer> pool;
+ SmartPointer<VectorMemory<VectorType>,Pointer> pool;
/**
* The pointer to the vector.
*/
- VECTOR *v;
+ VectorType *v;
};
};
* This class allocates and deletes vectors as needed from the global heap,
* i.e. performs no specially adapted actions for memory management.
*/
-template<class VECTOR = dealii::Vector<double> >
-class PrimitiveVectorMemory : public VectorMemory<VECTOR>
+template<typename VectorType = dealii::Vector<double> >
+class PrimitiveVectorMemory : public VectorMemory<VectorType>
{
public:
/**
* For the present class, calling this function will allocate a new vector
* on the heap and returning a pointer to it.
*/
- virtual VECTOR *alloc ()
+ virtual VectorType *alloc ()
{
- return new VECTOR();
+ return new VectorType();
}
/**
* For the present class, this means that the vector is returned to the
* global heap.
*/
- virtual void free (const VECTOR *const v)
+ virtual void free (const VectorType *const v)
{
delete v;
}
*
* @author Guido Kanschat, 1999, 2007
*/
-template<class VECTOR = dealii::Vector<double> >
-class GrowingVectorMemory : public VectorMemory<VECTOR>
+template<typename VectorType = dealii::Vector<double> >
+class GrowingVectorMemory : public VectorMemory<VectorType>
{
public:
/**
* function should reset vectors to their proper size. The same holds for
* the contents of vectors: they are unspecified.
*/
- virtual VECTOR *alloc ();
+ virtual VectorType *alloc ();
/**
* Return a vector and indicate that it is not going to be used any further
* For the present class, this means retaining the vector for later reuse by
* the alloc() method.
*/
- virtual void free (const VECTOR *const);
+ virtual void free (const VectorType *const);
/**
* Release all vectors that are not currently in use.
* Type to enter into the array. First component will be a flag telling
* whether the vector is used, second the vector itself.
*/
- typedef std::pair<bool, VECTOR *> entry_type;
+ typedef std::pair<bool, VectorType *> entry_type;
/**
* The class providing the actual storage for the memory pool.
/* --------------------- inline functions ---------------------- */
-template <typename VECTOR>
+template <typename VectorType>
inline
-VectorMemory<VECTOR>::Pointer::Pointer(VectorMemory<VECTOR> &mem)
+VectorMemory<VectorType>::Pointer::Pointer(VectorMemory<VectorType> &mem)
:
pool(&mem, typeid(*this).name()), v(0)
{
}
-template <typename VECTOR>
+template <typename VectorType>
inline
-VectorMemory<VECTOR>::Pointer::~Pointer()
+VectorMemory<VectorType>::Pointer::~Pointer()
{
pool->free(v);
}
-template <typename VECTOR>
+template <typename VectorType>
inline
-VectorMemory<VECTOR>::Pointer::operator VECTOR *() const
+VectorMemory<VectorType>::Pointer::operator VectorType *() const
{
return v;
}
-template <typename VECTOR>
+template <typename VectorType>
inline
-VECTOR &VectorMemory<VECTOR>::Pointer::operator * () const
+VectorType &VectorMemory<VectorType>::Pointer::operator * () const
{
return *v;
}
-template <typename VECTOR>
+template <typename VectorType>
inline
-VECTOR *VectorMemory<VECTOR>::Pointer::operator -> () const
+VectorType *VectorMemory<VectorType>::Pointer::operator -> () const
{
return v;
}
* @ingroup MeshWorker
* @author Guido Kanschat, 2009
*/
- template <class VECTOR>
+ template <typename VectorType>
class ResidualLocalBlocksToGlobalBlocks
{
public:
/**
* Assemble a single local residual into the global.
*/
- void assemble(VECTOR &global,
- const BlockVector<double> &local,
+ void assemble(VectorType &global,
+ const BlockVector<double> &local,
const std::vector<types::global_dof_index> &dof);
/**
* A pointer to the object containing the block structure.
*/
SmartPointer<const BlockInfo,
- ResidualLocalBlocksToGlobalBlocks<VECTOR> > block_info;
+ ResidualLocalBlocksToGlobalBlocks<VectorType> > block_info;
/**
* A pointer to the object containing constraints.
*/
SmartPointer<const ConstraintMatrix,
- ResidualLocalBlocksToGlobalBlocks<VECTOR> > constraints;
+ ResidualLocalBlocksToGlobalBlocks<VectorType> > constraints;
};
//----------------------------------------------------------------------//
- template <class VECTOR>
+ template <typename VectorType>
inline void
- ResidualLocalBlocksToGlobalBlocks<VECTOR>::initialize(const BlockInfo *b,
- AnyData &m)
+ ResidualLocalBlocksToGlobalBlocks<VectorType>::initialize(const BlockInfo *b,
+ AnyData &m)
{
block_info = b;
residuals = m;
}
- template <class VECTOR>
+ template <typename VectorType>
inline void
- ResidualLocalBlocksToGlobalBlocks<VECTOR>::initialize(
- const ConstraintMatrix &c)
+ ResidualLocalBlocksToGlobalBlocks<VectorType>::initialize
+ (const ConstraintMatrix &c)
{
constraints = &c;
}
- template <class VECTOR>
+ template <typename VectorType>
template <class DOFINFO>
inline void
- ResidualLocalBlocksToGlobalBlocks<VECTOR>::initialize_info(
- DOFINFO &info, bool) const
+ ResidualLocalBlocksToGlobalBlocks<VectorType>::initialize_info
+ (DOFINFO &info, bool) const
{
info.initialize_vectors(residuals.size());
}
- template <class VECTOR>
+ template <typename VectorType>
inline void
- ResidualLocalBlocksToGlobalBlocks<VECTOR>::assemble(
- VECTOR &global,
- const BlockVector<double> &local,
- const std::vector<types::global_dof_index> &dof)
+ ResidualLocalBlocksToGlobalBlocks<VectorType>::assemble
+ (VectorType &global,
+ const BlockVector<double> &local,
+ const std::vector<types::global_dof_index> &dof)
{
if (constraints == 0)
{
}
- template <class VECTOR>
+ template <typename VectorType>
template <class DOFINFO>
inline void
- ResidualLocalBlocksToGlobalBlocks<VECTOR>::assemble(
- const DOFINFO &info)
+ ResidualLocalBlocksToGlobalBlocks<VectorType>::assemble
+ (const DOFINFO &info)
{
for (unsigned int i=0; i<residuals.size(); ++i)
assemble(*residuals(i), info.vector(i), info.indices);
}
- template <class VECTOR>
+ template <typename VectorType>
template <class DOFINFO>
inline void
- ResidualLocalBlocksToGlobalBlocks<VECTOR>::assemble(
- const DOFINFO &info1,
- const DOFINFO &info2)
+ ResidualLocalBlocksToGlobalBlocks<VectorType>::assemble
+ (const DOFINFO &info1,
+ const DOFINFO &info2)
{
for (unsigned int i=0; i<residuals.size(); ++i)
{
* Objects of this class contain one or more objects of type FEValues,
* FEFaceValues or FESubfaceValues to be used in local integration. They are
* stored in an array of pointers to the base classes FEValuesBase. The
- * template parameter VECTOR allows the use of different data types for the
+ * template parameter VectorType allows the use of different data types for the
* global system.
*
* Additionally, this function contains space to store the values of finite
* and also set uninitialized quadrature rules to Gauss formulas, which
* integrate polynomial bilinear forms exactly.
*/
- template <typename VECTOR>
+ template <typename VectorType>
void initialize(const FiniteElement<dim, spacedim> &el,
- const Mapping<dim, spacedim> &mapping,
- const AnyData &data,
- const VECTOR &dummy,
- const BlockInfo *block_info = 0);
+ const Mapping<dim, spacedim> &mapping,
+ const AnyData &data,
+ const VectorType &dummy,
+ const BlockInfo *block_info = 0);
/**
* Initialize the IntegrationInfo objects contained.
*
* and also set uninitialized quadrature rules to Gauss formulas, which
* integrate polynomial bilinear forms exactly.
*/
- template <typename VECTOR>
+ template <typename VectorType>
void initialize(const FiniteElement<dim, spacedim> &el,
- const Mapping<dim, spacedim> &mapping,
- const AnyData &data,
- const MGLevelObject<VECTOR> &dummy,
- const BlockInfo *block_info = 0);
+ const Mapping<dim, spacedim> &mapping,
+ const AnyData &data,
+ const MGLevelObject<VectorType> &dummy,
+ const BlockInfo *block_info = 0);
/**
* @name FEValues setup
*/
template <int dim, int sdim>
- template <typename VECTOR>
+ template <typename VectorType>
void
- IntegrationInfoBox<dim,sdim>::initialize(
- const FiniteElement<dim,sdim> &el,
- const Mapping<dim,sdim> &mapping,
- const AnyData &data,
- const VECTOR &,
- const BlockInfo *block_info)
+ IntegrationInfoBox<dim,sdim>::initialize
+ (const FiniteElement<dim,sdim> &el,
+ const Mapping<dim,sdim> &mapping,
+ const AnyData &data,
+ const VectorType &,
+ const BlockInfo *block_info)
{
initialize(el, mapping, block_info);
- std_cxx11::shared_ptr<VectorData<VECTOR, dim, sdim> > p;
+ std_cxx11::shared_ptr<VectorData<VectorType, dim, sdim> > p;
VectorDataBase<dim,sdim> *pp;
- p = std_cxx11::shared_ptr<VectorData<VECTOR, dim, sdim> >(new VectorData<VECTOR, dim, sdim> (cell_selector));
+ p = std_cxx11::shared_ptr<VectorData<VectorType, dim, sdim> >(new VectorData<VectorType, dim, sdim> (cell_selector));
// Public member function of parent class was not found without
// explicit cast
pp = &*p;
cell_data = p;
cell.initialize_data(p);
- p = std_cxx11::shared_ptr<VectorData<VECTOR, dim, sdim> >(new VectorData<VECTOR, dim, sdim> (boundary_selector));
+ p = std_cxx11::shared_ptr<VectorData<VectorType, dim, sdim> >(new VectorData<VectorType, dim, sdim> (boundary_selector));
pp = &*p;
pp->initialize(data);
boundary_data = p;
boundary.initialize_data(p);
- p = std_cxx11::shared_ptr<VectorData<VECTOR, dim, sdim> >(new VectorData<VECTOR, dim, sdim> (face_selector));
+ p = std_cxx11::shared_ptr<VectorData<VectorType, dim, sdim> >(new VectorData<VectorType, dim, sdim> (face_selector));
pp = &*p;
pp->initialize(data);
face_data = p;
}
template <int dim, int sdim>
- template <typename VECTOR>
+ template <typename VectorType>
void
- IntegrationInfoBox<dim,sdim>::initialize(
- const FiniteElement<dim,sdim> &el,
- const Mapping<dim,sdim> &mapping,
- const AnyData &data,
- const MGLevelObject<VECTOR> &,
- const BlockInfo *block_info)
+ IntegrationInfoBox<dim,sdim>::initialize
+ (const FiniteElement<dim,sdim> &el,
+ const Mapping<dim,sdim> &mapping,
+ const AnyData &data,
+ const MGLevelObject<VectorType> &,
+ const BlockInfo *block_info)
{
initialize(el, mapping, block_info);
- std_cxx11::shared_ptr<MGVectorData<VECTOR, dim, sdim> > p;
+ std_cxx11::shared_ptr<MGVectorData<VectorType, dim, sdim> > p;
VectorDataBase<dim,sdim> *pp;
- p = std_cxx11::shared_ptr<MGVectorData<VECTOR, dim, sdim> >(new MGVectorData<VECTOR, dim, sdim> (cell_selector));
+ p = std_cxx11::shared_ptr<MGVectorData<VectorType, dim, sdim> >(new MGVectorData<VectorType, dim, sdim> (cell_selector));
// Public member function of parent class was not found without
// explicit cast
pp = &*p;
cell_data = p;
cell.initialize_data(p);
- p = std_cxx11::shared_ptr<MGVectorData<VECTOR, dim, sdim> >(new MGVectorData<VECTOR, dim, sdim> (boundary_selector));
+ p = std_cxx11::shared_ptr<MGVectorData<VectorType, dim, sdim> >(new MGVectorData<VectorType, dim, sdim> (boundary_selector));
pp = &*p;
pp->initialize(data);
boundary_data = p;
boundary.initialize_data(p);
- p = std_cxx11::shared_ptr<MGVectorData<VECTOR, dim, sdim> >(new MGVectorData<VECTOR, dim, sdim> (face_selector));
+ p = std_cxx11::shared_ptr<MGVectorData<VectorType, dim, sdim> >(new MGVectorData<VectorType, dim, sdim> (face_selector));
pp = &*p;
pp->initialize(data);
face_data = p;
* @ingroup MeshWorker
* @author Guido Kanschat, 2009
*/
- template <class VECTOR>
+ template <typename VectorType>
class ResidualSimple
{
public:
/**
* A pointer to the object containing constraints.
*/
- SmartPointer<const ConstraintMatrix,ResidualSimple<VECTOR> > constraints;
+ SmartPointer<const ConstraintMatrix,ResidualSimple<VectorType> > constraints;
};
* @ingroup MeshWorker
* @author Guido Kanschat, 2009
*/
- template <class MATRIX, class VECTOR>
+ template <class MATRIX, typename VectorType>
class SystemSimple :
private MatrixSimple<MATRIX>,
- private ResidualSimple<VECTOR>
+ private ResidualSimple<VectorType>
{
public:
/**
/**
* Store the two objects data is assembled into.
*/
- void initialize(MATRIX &m, VECTOR &rhs);
+ void initialize(MATRIX &m, VectorType &rhs);
/**
* Initialize the constraints. After this function has been called with
//----------------------------------------------------------------------//
- template <class VECTOR>
+ template <typename VectorType>
inline void
- ResidualSimple<VECTOR>::initialize(AnyData &results)
+ ResidualSimple<VectorType>::initialize(AnyData &results)
{
residuals = results;
}
- template <class VECTOR>
+ template <typename VectorType>
inline void
- ResidualSimple<VECTOR>::initialize(const ConstraintMatrix &c)
+ ResidualSimple<VectorType>::initialize(const ConstraintMatrix &c)
{
constraints = &c;
}
{}
- template <class VECTOR>
+ template <typename VectorType>
template <class DOFINFO>
inline void
- ResidualSimple<VECTOR>::initialize_info(DOFINFO &info, bool) const
+ ResidualSimple<VectorType>::initialize_info(DOFINFO &info, bool) const
{
info.initialize_vectors(residuals.size());
}
- template <class VECTOR>
+ template <typename VectorType>
template <class DOFINFO>
inline void
- ResidualSimple<VECTOR>::assemble(const DOFINFO &info)
+ ResidualSimple<VectorType>::assemble(const DOFINFO &info)
{
for (unsigned int k=0; k<residuals.size(); ++k)
{
- VECTOR *v = residuals.entry<VECTOR *>(k);
+ VectorType *v = residuals.entry<VectorType *>(k);
if (constraints == 0)
{
for (unsigned int i=0; i<info.vector(k).block(0).size(); ++i)
}
}
- template <class VECTOR>
+ template <typename VectorType>
template <class DOFINFO>
inline void
- ResidualSimple<VECTOR>::assemble(const DOFINFO &info1,
- const DOFINFO &info2)
+ ResidualSimple<VectorType>::assemble(const DOFINFO &info1,
+ const DOFINFO &info2)
{
for (unsigned int k=0; k<residuals.size(); ++k)
{
- VECTOR *v = residuals.entry<VECTOR *>(k);
+ VectorType *v = residuals.entry<VectorType *>(k);
if (constraints == 0)
{
for (unsigned int i=0; i<info1.vector(k).block(0).size(); ++i)
//----------------------------------------------------------------------//
- template <class MATRIX, class VECTOR>
- SystemSimple<MATRIX,VECTOR>::SystemSimple(double t)
+ template <class MATRIX, typename VectorType>
+ SystemSimple<MATRIX,VectorType>::SystemSimple(double t)
:
MatrixSimple<MATRIX>(t)
{}
- template <class MATRIX, class VECTOR>
+ template <class MATRIX, typename VectorType>
inline void
- SystemSimple<MATRIX,VECTOR>::initialize(MATRIX &m, VECTOR &rhs)
+ SystemSimple<MATRIX,VectorType>::initialize(MATRIX &m, VectorType &rhs)
{
AnyData data;
- VECTOR *p = &rhs;
+ VectorType *p = &rhs;
data.add(p, "right hand side");
MatrixSimple<MATRIX>::initialize(m);
- ResidualSimple<VECTOR>::initialize(data);
+ ResidualSimple<VectorType>::initialize(data);
}
- template <class MATRIX, class VECTOR>
+ template <class MATRIX, typename VectorType>
inline void
- SystemSimple<MATRIX,VECTOR>::initialize(const ConstraintMatrix &c)
+ SystemSimple<MATRIX,VectorType>::initialize(const ConstraintMatrix &c)
{
MatrixSimple<MATRIX>::initialize(c);
- ResidualSimple<VECTOR>::initialize(c);
+ ResidualSimple<VectorType>::initialize(c);
}
- template <class MATRIX, class VECTOR>
+ template <class MATRIX, typename VectorType>
template <class DOFINFO>
inline void
- SystemSimple<MATRIX,VECTOR>::initialize_info(DOFINFO &info,
- bool face) const
+ SystemSimple<MATRIX,VectorType>::initialize_info(DOFINFO &info,
+ bool face) const
{
MatrixSimple<MATRIX>::initialize_info(info, face);
- ResidualSimple<VECTOR>::initialize_info(info, face);
+ ResidualSimple<VectorType>::initialize_info(info, face);
}
- template <class MATRIX, class VECTOR>
+ template <class MATRIX, typename VectorType>
template <class DOFINFO>
inline void
- SystemSimple<MATRIX,VECTOR>::assemble(const DOFINFO &info)
+ SystemSimple<MATRIX,VectorType>::assemble(const DOFINFO &info)
{
MatrixSimple<MATRIX>::assemble(info);
- ResidualSimple<VECTOR>::assemble(info);
+ ResidualSimple<VectorType>::assemble(info);
}
- template <class MATRIX, class VECTOR>
+ template <class MATRIX, typename VectorType>
template <class DOFINFO>
inline void
- SystemSimple<MATRIX,VECTOR>::assemble(const DOFINFO &info1,
- const DOFINFO &info2)
+ SystemSimple<MATRIX,VectorType>::assemble(const DOFINFO &info1,
+ const DOFINFO &info2)
{
MatrixSimple<MATRIX>::assemble(info1, info2);
- ResidualSimple<VECTOR>::assemble(info1, info2);
+ ResidualSimple<VectorType>::assemble(info1, info2);
}
}
}
* @ingroup MeshWorker
* @author Guido Kanschat, 2009
*/
- template <class VECTOR, int dim, int spacedim = dim>
+ template <typename VectorType, int dim, int spacedim = dim>
class VectorData :
- public VectorDataBase<dim, spacedim,typename VECTOR::value_type>
+ public VectorDataBase<dim, spacedim,typename VectorType::value_type>
{
public:
/**
* @note Make sure the VectorSelector base class was filled with
* reasonable data before calling this function.
*/
- void initialize(const VECTOR *, const std::string &name);
+ void initialize(const VectorType *, const std::string &name);
virtual void fill(
- std::vector<std::vector<std::vector<typename VECTOR::value_type> > > &values,
- std::vector<std::vector<std::vector<Tensor<1,dim,typename VECTOR::value_type> > > > &gradients,
- std::vector<std::vector<std::vector<Tensor<2,dim,typename VECTOR::value_type> > > > &hessians,
+ std::vector<std::vector<std::vector<typename VectorType::value_type> > > &values,
+ std::vector<std::vector<std::vector<Tensor<1,dim,typename VectorType::value_type> > > > &gradients,
+ std::vector<std::vector<std::vector<Tensor<2,dim,typename VectorType::value_type> > > > &hessians,
const FEValuesBase<dim,spacedim> &fe,
const std::vector<types::global_dof_index> &index,
const unsigned int component,
const unsigned int size) const;
virtual void mg_fill(
- std::vector<std::vector<std::vector<typename VECTOR::value_type> > > &values,
- std::vector<std::vector<std::vector<Tensor<1,dim,typename VECTOR::value_type> > > > &gradients,
- std::vector<std::vector<std::vector<Tensor<2,dim,typename VECTOR::value_type> > > > &hessians,
+ std::vector<std::vector<std::vector<typename VectorType::value_type> > > &values,
+ std::vector<std::vector<std::vector<Tensor<1,dim,typename VectorType::value_type> > > > &gradients,
+ std::vector<std::vector<std::vector<Tensor<2,dim,typename VectorType::value_type> > > > &hessians,
const FEValuesBase<dim,spacedim> &fe,
const unsigned int level,
const std::vector<types::global_dof_index> &index,
* @ingroup MeshWorker
* @author Guido Kanschat, 2010
*/
- template <class VECTOR, int dim, int spacedim = dim>
+ template <typename VectorType, int dim, int spacedim = dim>
class MGVectorData :
- public VectorData<VECTOR, dim, spacedim>
+ public VectorData<VectorType, dim, spacedim>
{
public:
/**
* @note Make sure the VectorSelector base class was filled with
* reasonable data before calling this function.
*/
- void initialize(const MGLevelObject<VECTOR> *, const std::string &name);
+ void initialize(const MGLevelObject<VectorType> *, const std::string &name);
/**
//----------------------------------------------------------------------//
- template <class VECTOR, int dim, int spacedim>
- VectorData<VECTOR, dim, spacedim>::VectorData()
+ template <typename VectorType, int dim, int spacedim>
+ VectorData<VectorType, dim, spacedim>::VectorData()
{}
- template <class VECTOR, int dim, int spacedim>
- VectorData<VECTOR, dim, spacedim>::VectorData(const VectorSelector &s)
+ template <typename VectorType, int dim, int spacedim>
+ VectorData<VectorType, dim, spacedim>::VectorData(const VectorSelector &s)
:
- VectorDataBase<dim, spacedim, typename VECTOR::value_type>(s)
+ VectorDataBase<dim, spacedim, typename VectorType::value_type>(s)
{}
- template <class VECTOR, int dim, int spacedim>
+ template <typename VectorType, int dim, int spacedim>
void
- VectorData<VECTOR, dim, spacedim>::initialize(const AnyData &d)
+ VectorData<VectorType, dim, spacedim>::initialize(const AnyData &d)
{
this->data = d;
VectorSelector::initialize(d);
}
- template <class VECTOR, int dim, int spacedim>
+ template <typename VectorType, int dim, int spacedim>
void
- VectorData<VECTOR, dim, spacedim>::initialize(const VECTOR *v, const std::string &name)
+ VectorData<VectorType, dim, spacedim>::initialize(const VectorType *v, const std::string &name)
{
- SmartPointer<const VECTOR,VectorData<VECTOR, dim, spacedim> > p = v;
+ SmartPointer<const VectorType,VectorData<VectorType, dim, spacedim> > p = v;
this->data.add(p, name);
VectorSelector::initialize(this->data);
}
- template <class VECTOR, int dim, int spacedim>
+ template <typename VectorType, int dim, int spacedim>
void
- VectorData<VECTOR, dim, spacedim>::fill(
- std::vector<std::vector<std::vector<typename VECTOR::value_type> > > &values,
- std::vector<std::vector<std::vector<Tensor<1,dim,typename VECTOR::value_type> > > > &gradients,
- std::vector<std::vector<std::vector<Tensor<2,dim,typename VECTOR::value_type> > > > &hessians,
+ VectorData<VectorType, dim, spacedim>::fill(
+ std::vector<std::vector<std::vector<typename VectorType::value_type> > > &values,
+ std::vector<std::vector<std::vector<Tensor<1,dim,typename VectorType::value_type> > > > &gradients,
+ std::vector<std::vector<std::vector<Tensor<2,dim,typename VectorType::value_type> > > > &hessians,
const FEValuesBase<dim,spacedim> &fe,
const std::vector<types::global_dof_index> &index,
const unsigned int component,
const AnyData &data = this->data;
for (unsigned int i=0; i<this->n_values(); ++i)
{
- const VECTOR *src = data.read_ptr<VECTOR>(this->value_index(i));
- VectorSlice<std::vector<std::vector<typename VECTOR::value_type> > > dst(values[i], component, n_comp);
+ const VectorType *src = data.read_ptr<VectorType>(this->value_index(i));
+ VectorSlice<std::vector<std::vector<typename VectorType::value_type> > > dst(values[i], component, n_comp);
fe.get_function_values(*src, make_slice(index, start, size), dst, true);
}
for (unsigned int i=0; i<this->n_gradients(); ++i)
{
- const VECTOR *src = data.read_ptr<VECTOR>(this->gradient_index(i));
- VectorSlice<std::vector<std::vector<Tensor<1,dim,typename VECTOR::value_type> > > > dst(gradients[i], component, n_comp);
+ const VectorType *src = data.read_ptr<VectorType>(this->gradient_index(i));
+ VectorSlice<std::vector<std::vector<Tensor<1,dim,typename VectorType::value_type> > > > dst(gradients[i], component, n_comp);
fe.get_function_gradients(*src, make_slice(index, start, size), dst, true);
}
for (unsigned int i=0; i<this->n_hessians(); ++i)
{
- const VECTOR *src = data.read_ptr<VECTOR>(this->hessian_index(i));
- VectorSlice<std::vector<std::vector<Tensor<2,dim,typename VECTOR::value_type> > > > dst(hessians[i], component, n_comp);
+ const VectorType *src = data.read_ptr<VectorType>(this->hessian_index(i));
+ VectorSlice<std::vector<std::vector<Tensor<2,dim,typename VectorType::value_type> > > > dst(hessians[i], component, n_comp);
fe.get_function_hessians(*src, make_slice(index, start, size), dst, true);
}
}
- template <class VECTOR, int dim, int spacedim>
+ template <typename VectorType, int dim, int spacedim>
std::size_t
- VectorData<VECTOR, dim, spacedim>::memory_consumption () const
+ VectorData<VectorType, dim, spacedim>::memory_consumption () const
{
std::size_t mem = VectorSelector::memory_consumption();
mem += sizeof (this->data);
//----------------------------------------------------------------------//
- template <class VECTOR, int dim, int spacedim>
- MGVectorData<VECTOR, dim, spacedim>::MGVectorData()
+ template <typename VectorType, int dim, int spacedim>
+ MGVectorData<VectorType, dim, spacedim>::MGVectorData()
{}
- template <class VECTOR, int dim, int spacedim>
- MGVectorData<VECTOR, dim, spacedim>::MGVectorData(const VectorSelector &s)
+ template <typename VectorType, int dim, int spacedim>
+ MGVectorData<VectorType, dim, spacedim>::MGVectorData(const VectorSelector &s)
:
- VectorData<VECTOR, dim, spacedim>(s)
+ VectorData<VectorType, dim, spacedim>(s)
{}
- template <class VECTOR, int dim, int spacedim>
+ template <typename VectorType, int dim, int spacedim>
void
- MGVectorData<VECTOR, dim, spacedim>::initialize(const AnyData &d)
+ MGVectorData<VectorType, dim, spacedim>::initialize(const AnyData &d)
{
this->data = d;
VectorSelector::initialize(d);
}
- template <class VECTOR, int dim, int spacedim>
+ template <typename VectorType, int dim, int spacedim>
void
- MGVectorData<VECTOR, dim, spacedim>::initialize(const MGLevelObject<VECTOR> *v, const std::string &name)
+ MGVectorData<VectorType, dim, spacedim>::initialize(const MGLevelObject<VectorType> *v, const std::string &name)
{
- SmartPointer<const MGLevelObject<VECTOR>, MGVectorData<VECTOR, dim, spacedim> >
+ SmartPointer<const MGLevelObject<VectorType>, MGVectorData<VectorType, dim, spacedim> >
p = v;
this->data.add(p, name);
VectorSelector::initialize(this->data);
}
- template <class VECTOR, int dim, int spacedim>
+ template <typename VectorType, int dim, int spacedim>
void
- VectorData<VECTOR, dim, spacedim>::mg_fill(
- std::vector<std::vector<std::vector<typename VECTOR::value_type> > > &values,
- std::vector<std::vector<std::vector<Tensor<1,dim,typename VECTOR::value_type> > > > &gradients,
- std::vector<std::vector<std::vector<Tensor<2,dim,typename VECTOR::value_type> > > > &hessians,
- const FEValuesBase<dim,spacedim> &fe,
- const unsigned int level,
- const std::vector<types::global_dof_index> &index,
- const unsigned int component,
- const unsigned int n_comp,
- const unsigned int start,
- const unsigned int size) const
+ VectorData<VectorType, dim, spacedim>::mg_fill
+ (std::vector<std::vector<std::vector<typename VectorType::value_type> > > &values,
+ std::vector<std::vector<std::vector<Tensor<1,dim,typename VectorType::value_type> > > > &gradients,
+ std::vector<std::vector<std::vector<Tensor<2,dim,typename VectorType::value_type> > > > &hessians,
+ const FEValuesBase<dim,spacedim> &fe,
+ const unsigned int level,
+ const std::vector<types::global_dof_index> &index,
+ const unsigned int component,
+ const unsigned int n_comp,
+ const unsigned int start,
+ const unsigned int size)
+ const
{
AssertDimension(values.size(), this->n_values());
AssertDimension(gradients.size(), this->n_gradients());
const AnyData &data = this->data;
for (unsigned int i=0; i<this->n_values(); ++i)
{
- const MGLevelObject<VECTOR> *src = data.read_ptr<MGLevelObject<VECTOR> >(this->value_index(i));
- VectorSlice<std::vector<std::vector<typename VECTOR::value_type> > > dst(values[i], component, n_comp);
+ const MGLevelObject<VectorType> *src = data.read_ptr<MGLevelObject<VectorType> >(this->value_index(i));
+ VectorSlice<std::vector<std::vector<typename VectorType::value_type> > > dst(values[i], component, n_comp);
fe.get_function_values((*src)[level], make_slice(index, start, size), dst, true);
}
for (unsigned int i=0; i<this->n_gradients(); ++i)
{
- const MGLevelObject<VECTOR> *src = data.read_ptr<MGLevelObject<VECTOR> >(this->value_index(i));
- VectorSlice<std::vector<std::vector<Tensor<1,dim,typename VECTOR::value_type> > > > dst(gradients[i], component, n_comp);
+ const MGLevelObject<VectorType> *src = data.read_ptr<MGLevelObject<VectorType> >(this->value_index(i));
+ VectorSlice<std::vector<std::vector<Tensor<1,dim,typename VectorType::value_type> > > > dst(gradients[i], component, n_comp);
fe.get_function_gradients((*src)[level], make_slice(index, start, size), dst, true);
}
for (unsigned int i=0; i<this->n_hessians(); ++i)
{
- const MGLevelObject<VECTOR> *src = data.read_ptr<MGLevelObject<VECTOR> >(this->value_index(i));
- VectorSlice<std::vector<std::vector<Tensor<2,dim,typename VECTOR::value_type> > > > dst(hessians[i], component, n_comp);
+ const MGLevelObject<VectorType> *src = data.read_ptr<MGLevelObject<VectorType> >(this->value_index(i));
+ VectorSlice<std::vector<std::vector<Tensor<2,dim,typename VectorType::value_type> > > > dst(hessians[i], component, n_comp);
fe.get_function_hessians((*src)[level], make_slice(index, start, size), dst, true);
}
}
*/
unsigned int debug;
- template<int dim, class VECTOR2, class TRANSFER> friend class PreconditionMG;
+ template<int dim, class OtherVectorType, class TRANSFER> friend class PreconditionMG;
};
*
* This is the operator used by LAC iterative solvers.
*/
- template<class VECTOR2>
- void vmult (VECTOR2 &dst,
- const VECTOR2 &src) const;
+ template<class OtherVectorType>
+ void vmult (OtherVectorType &dst,
+ const OtherVectorType &src) const;
/**
* Preconditioning operator. Calls the @p vcycle function of the @p MG
* object passed to the constructor.
*/
- template<class VECTOR2>
- void vmult_add (VECTOR2 &dst,
- const VECTOR2 &src) const;
+ template<class OtherVectorType>
+ void vmult_add (OtherVectorType &dst,
+ const OtherVectorType &src) const;
/**
* Tranposed preconditioning operator.
*
* Not implemented, but the definition may be needed.
*/
- template<class VECTOR2>
- void Tvmult (VECTOR2 &dst,
- const VECTOR2 &src) const;
+ template<class OtherVectorType>
+ void Tvmult (OtherVectorType &dst,
+ const OtherVectorType &src) const;
/**
* Tranposed preconditioning operator.
*
* Not implemented, but the definition may be needed.
*/
- template<class VECTOR2>
- void Tvmult_add (VECTOR2 &dst,
- const VECTOR2 &src) const;
+ template<class OtherVectorType>
+ void Tvmult_add (OtherVectorType &dst,
+ const OtherVectorType &src) const;
private:
/**
}
template<int dim, typename VectorType, class TRANSFER>
-template<class VECTOR2>
+template<class OtherVectorType>
void
-PreconditionMG<dim, VectorType, TRANSFER>::vmult (
- VECTOR2 &dst,
- const VECTOR2 &src) const
+PreconditionMG<dim, VectorType, TRANSFER>::vmult
+(OtherVectorType &dst,
+ const OtherVectorType &src) const
{
transfer->copy_to_mg(*dof_handler,
multigrid->defect,
template<int dim, typename VectorType, class TRANSFER>
-template<class VECTOR2>
+template<class OtherVectorType>
void
-PreconditionMG<dim, VectorType, TRANSFER>::vmult_add (
- VECTOR2 &dst,
- const VECTOR2 &src) const
+PreconditionMG<dim, VectorType, TRANSFER>::vmult_add
+(OtherVectorType &dst,
+ const OtherVectorType &src) const
{
transfer->copy_to_mg(*dof_handler,
multigrid->defect,
template<int dim, typename VectorType, class TRANSFER>
-template<class VECTOR2>
+template<class OtherVectorType>
void
-PreconditionMG<dim, VectorType, TRANSFER>::Tvmult (
- VECTOR2 &,
- const VECTOR2 &) const
+PreconditionMG<dim, VectorType, TRANSFER>::Tvmult
+(OtherVectorType &,
+ const OtherVectorType &) const
{
Assert(false, ExcNotImplemented());
}
template<int dim, typename VectorType, class TRANSFER>
-template<class VECTOR2>
+template<class OtherVectorType>
void
-PreconditionMG<dim, VectorType, TRANSFER>::Tvmult_add (
- VECTOR2 &,
- const VECTOR2 &) const
+PreconditionMG<dim, VectorType, TRANSFER>::Tvmult_add
+(OtherVectorType &,
+ const OtherVectorType &) const
{
Assert(false, ExcNotImplemented());
}