From: David Wells Date: Sat, 24 Oct 2015 22:58:32 +0000 (-0400) Subject: VECTOR to VectorType, part 2 X-Git-Tag: v8.4.0-rc2~230^2~16 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff5b1b70ac79e8c01a99e7e0092c1529ff054ca0;p=dealii.git VECTOR to VectorType, part 2 --- diff --git a/include/deal.II/lac/eigen.h b/include/deal.II/lac/eigen.h index 63211a2048..e4c56bed90 100644 --- a/include/deal.II/lac/eigen.h +++ b/include/deal.II/lac/eigen.h @@ -50,8 +50,8 @@ DEAL_II_NAMESPACE_OPEN * * @author Guido Kanschat, 2000 */ -template > -class EigenPower : private Solver +template > +class EigenPower : private Solver { public: /** @@ -82,9 +82,9 @@ public: /** * Constructor. */ - EigenPower (SolverControl &cn, - VectorMemory &mem, - const AdditionalData &data=AdditionalData()); + EigenPower (SolverControl &cn, + VectorMemory &mem, + const AdditionalData &data=AdditionalData()); /** * Virtual destructor. @@ -101,7 +101,7 @@ public: void solve (double &value, const MATRIX &A, - VECTOR &x); + VectorType &x); protected: /** @@ -133,8 +133,8 @@ protected: * * @author Guido Kanschat, 2000, 2003 */ -template > -class EigenInverse : private Solver +template > +class EigenInverse : private Solver { public: /** @@ -177,9 +177,9 @@ public: /** * Constructor. */ - EigenInverse (SolverControl &cn, - VectorMemory &mem, - const AdditionalData &data=AdditionalData()); + EigenInverse (SolverControl &cn, + VectorMemory &mem, + const AdditionalData &data=AdditionalData()); /** @@ -198,7 +198,7 @@ public: void solve (double &value, const MATRIX &A, - VECTOR &x); + VectorType &x); protected: /** @@ -211,39 +211,39 @@ protected: //--------------------------------------------------------------------------- -template -EigenPower::EigenPower (SolverControl &cn, - VectorMemory &mem, - const AdditionalData &data) +template +EigenPower::EigenPower (SolverControl &cn, + VectorMemory &mem, + const AdditionalData &data) : - Solver(cn, mem), + Solver(cn, mem), additional_data(data) {} -template -EigenPower::~EigenPower () +template +EigenPower::~EigenPower () {} -template +template template void -EigenPower::solve (double &value, - const MATRIX &A, - VECTOR &x) +EigenPower::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 (); @@ -305,29 +305,29 @@ EigenPower::solve (double &value, //--------------------------------------------------------------------------- -template -EigenInverse::EigenInverse (SolverControl &cn, - VectorMemory &mem, - const AdditionalData &data) +template +EigenInverse::EigenInverse (SolverControl &cn, + VectorMemory &mem, + const AdditionalData &data) : - Solver(cn, mem), + Solver(cn, mem), additional_data(data) {} -template -EigenInverse::~EigenInverse () +template +EigenInverse::~EigenInverse () {} -template +template template void -EigenInverse::solve (double &value, - const MATRIX &A, - VECTOR &x) +EigenInverse::solve (double &value, + const MATRIX &A, + VectorType &x) { deallog.push("Wielandt"); @@ -339,18 +339,18 @@ EigenInverse::solve (double &value, // Define solver ReductionControl inner_control (5000, 1.e-16, 1.e-5, false, false); PreconditionIdentity prec; - SolverGMRES + SolverGMRES 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 (); diff --git a/include/deal.II/lac/identity_matrix.h b/include/deal.II/lac/identity_matrix.h index 6dae5bd6aa..6344c3f541 100644 --- a/include/deal.II/lac/identity_matrix.h +++ b/include/deal.II/lac/identity_matrix.h @@ -107,27 +107,27 @@ public: * Matrix-vector multiplication. For the present case, this of course * amounts to simply copying the input vector to the output vector. */ - template - void vmult (VECTOR1 &out, - const VECTOR2 &in) const; + template + 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 - void vmult_add (VECTOR1 &out, - const VECTOR2 &in) const; + template + 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 - void Tvmult (VECTOR1 &out, - const VECTOR2 &in) const; + template + void Tvmult (OutVectorType &out, + const InVectorType &in) const; /** @@ -135,9 +135,9 @@ public: * the output vector. For the present case, this of course amounts to simply * adding the input vector to the output vector. */ - template - void Tvmult_add (VECTOR1 &out, - const VECTOR2 &in) const; + template + void Tvmult_add (OutVectorType &out, + const InVectorType &in) const; private: /** @@ -196,11 +196,11 @@ IdentityMatrix::n () const -template +template 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)); @@ -210,11 +210,11 @@ IdentityMatrix::vmult (VECTOR1 &out, -template +template 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)); @@ -224,11 +224,11 @@ IdentityMatrix::vmult_add (VECTOR1 &out, -template +template 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)); @@ -238,11 +238,11 @@ IdentityMatrix::Tvmult (VECTOR1 &out, -template +template 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)); @@ -258,4 +258,3 @@ IdentityMatrix::Tvmult_add (VECTOR1 &out, DEAL_II_NAMESPACE_CLOSE #endif - diff --git a/include/deal.II/lac/iterative_inverse.h b/include/deal.II/lac/iterative_inverse.h index 0fb7db5b74..3fd6f6f6f0 100644 --- a/include/deal.II/lac/iterative_inverse.h +++ b/include/deal.II/lac/iterative_inverse.h @@ -101,8 +101,8 @@ public: * vectors given to this function have different type from the vectors used * by the inner solver. */ - template - void vmult (VECTOR2 &dst, const VECTOR2 &src) const; + template + void vmult (OtherVectorType &dst, const OtherVectorType &src) const; /** * The solver, which allows selection of the actual solver as well as @@ -158,9 +158,9 @@ IterativeInverse::vmult (VectorType &dst, const VectorType &src) con template -template +template inline void -IterativeInverse::vmult (VECTOR2 &dst, const VECTOR2 &src) const +IterativeInverse::vmult (OtherVectorType &dst, const OtherVectorType &src) const { Assert(matrix.get() != 0, ExcNotInitialized()); Assert(preconditioner.get() != 0, ExcNotInitialized()); diff --git a/include/deal.II/lac/matrix_lib.h b/include/deal.II/lac/matrix_lib.h index d358d11172..9ccd73b2a0 100644 --- a/include/deal.II/lac/matrix_lib.h +++ b/include/deal.II/lac/matrix_lib.h @@ -51,8 +51,8 @@ template class SparseMatrix; * * @author Guido Kanschat, 2000, 2001, 2002, 2005 */ -template -class ProductMatrix : public PointerMatrixBase +template +class ProductMatrix : public PointerMatrixBase { public: /** @@ -65,16 +65,16 @@ public: * Constructor only assigning the memory pool. Matrices must be added by * reinit() later. */ - ProductMatrix(VectorMemory &mem); + ProductMatrix(VectorMemory &mem); /** * Constructor. Additionally to the two constituting matrices, a memory * pool for the auxiliary vector must be provided. */ template - ProductMatrix(const MATRIX1 &m1, - const MATRIX2 &m2, - VectorMemory &mem); + ProductMatrix (const MATRIX1 &m1, + const MATRIX2 &m2, + VectorMemory &mem); /** * Destructor. @@ -92,7 +92,7 @@ public: */ template void initialize(const MATRIX1 &m1, const MATRIX2 &m2, - VectorMemory &mem); + VectorMemory &mem); // Doc in PointerMatrixBase void clear(); @@ -100,44 +100,44 @@ public: /** * Matrix-vector product w = m1 * m2 * v. */ - virtual void vmult (VECTOR &w, - const VECTOR &v) const; + virtual void vmult (VectorType &w, + const VectorType &v) const; /** * Transposed matrix-vector product w = m2T * m1T * * v. */ - virtual void Tvmult (VECTOR &w, - const VECTOR &v) const; + virtual void Tvmult (VectorType &w, + const VectorType &v) const; /** * Adding matrix-vector product w += m1 * m2 * v */ - 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 w += m2T * * m1T * v. */ - 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 *m1; + PointerMatrixBase *m1; /** * The right matrix of the product. */ - PointerMatrixBase *m2; + PointerMatrixBase *m2; /** * Memory for auxiliary vector. */ - SmartPointer,ProductMatrix > mem; + SmartPointer,ProductMatrix > mem; }; @@ -154,7 +154,7 @@ private: * * @author Guido Kanschat, 2007 */ -template +template class ScaledMatrix : public Subscriptor { public: @@ -186,18 +186,18 @@ 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 *m; + PointerMatrixBase *m; /** * The scaling factor; */ @@ -240,9 +240,9 @@ public: * 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 &mem); + ProductSparseMatrix (const MatrixType &m1, + const MatrixType &m2, + VectorMemory &mem); /** * Constructor leaving an uninitialized matrix. initialize() must be called, @@ -250,9 +250,9 @@ public: */ ProductSparseMatrix(); - void initialize(const MatrixType &m1, - const MatrixType &m2, - VectorMemory &mem); + void initialize (const MatrixType &m1, + const MatrixType &m2, + VectorMemory &mem); // Doc in PointerMatrixBase void clear(); @@ -346,14 +346,14 @@ public: * Return the source vector with subtracted mean value. */ template - void vmult (Vector &dst, + void vmult (Vector &dst, const Vector &src) const; /** * Add source vector with subtracted mean value to dest. */ template - void vmult_add (Vector &dst, + void vmult_add (Vector &dst, const Vector &src) const; /** @@ -361,7 +361,7 @@ public: * component. */ template - void vmult (BlockVector &dst, + void vmult (BlockVector &dst, const BlockVector &src) const; /** @@ -369,21 +369,21 @@ public: * subtracted. */ template - void vmult_add (BlockVector &dst, + void vmult_add (BlockVector &dst, const BlockVector &src) const; /** * Not implemented. */ - template - void Tvmult(VECTOR &, const VECTOR &) const; + template + void Tvmult(VectorType &, const VectorType &) const; /** * Not implemented. */ - template - void Tvmult_add(VECTOR &, const VECTOR &) const; + template + void Tvmult_add(VectorType &, const VectorType &) const; private: /** @@ -429,7 +429,7 @@ private: * * @author Guido Kanschat, 2005 */ -template +template class InverseMatrixRichardson : public Subscriptor { public: @@ -437,8 +437,8 @@ 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 &mem); + InverseMatrixRichardson (SolverControl &control, + VectorMemory &mem); /** * Since we use two pointers, we must implement a destructor. */ @@ -459,43 +459,43 @@ public: /** * 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 &mem; + VectorMemory &mem; /** * The solver object. */ - mutable SolverRichardson solver; + mutable SolverRichardson solver; /** * The matrix in use. */ - PointerMatrixBase *matrix; + PointerMatrixBase *matrix; /** * The preconditioner to use. */ - PointerMatrixBase *precondition; + PointerMatrixBase *precondition; }; @@ -505,43 +505,43 @@ private: //--------------------------------------------------------------------------- -template +template inline -ScaledMatrix::ScaledMatrix() +ScaledMatrix::ScaledMatrix() : m(0) {} -template +template template inline -ScaledMatrix::ScaledMatrix(const MATRIX &mat, const double factor) +ScaledMatrix::ScaledMatrix(const MATRIX &mat, const double factor) : - m(new_pointer_matrix_base(mat, VECTOR())), + m(new_pointer_matrix_base(mat, VectorType())), factor(factor) {} -template +template template inline void -ScaledMatrix::initialize(const MATRIX &mat, const double f) +ScaledMatrix::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 +template inline void -ScaledMatrix::clear() +ScaledMatrix::clear() { if (m) delete m; m = 0; @@ -549,28 +549,28 @@ ScaledMatrix::clear() -template +template inline -ScaledMatrix::~ScaledMatrix() +ScaledMatrix::~ScaledMatrix() { clear (); } -template +template inline void -ScaledMatrix::vmult (VECTOR &w, const VECTOR &v) const +ScaledMatrix::vmult (VectorType &w, const VectorType &v) const { m->vmult(w, v); w *= factor; } -template +template inline void -ScaledMatrix::Tvmult (VECTOR &w, const VECTOR &v) const +ScaledMatrix::Tvmult (VectorType &w, const VectorType &v) const { m->Tvmult(w, v); w *= factor; @@ -579,72 +579,68 @@ ScaledMatrix::Tvmult (VECTOR &w, const VECTOR &v) const //--------------------------------------------------------------------------- -template -ProductMatrix::ProductMatrix () +template +ProductMatrix::ProductMatrix () : m1(0), m2(0), mem(0) {} -template -ProductMatrix::ProductMatrix (VectorMemory &m) +template +ProductMatrix::ProductMatrix (VectorMemory &m) : m1(0), m2(0), mem(&m) {} -template +template template -ProductMatrix::ProductMatrix ( - const MATRIX1 &mat1, - const MATRIX2 &mat2, - VectorMemory &m) +ProductMatrix::ProductMatrix (const MATRIX1 &mat1, + const MATRIX2 &mat2, + VectorMemory &m) : mem(&m) { - m1 = new PointerMatrix(&mat1, typeid(*this).name()); - m2 = new PointerMatrix(&mat2, typeid(*this).name()); + m1 = new PointerMatrix(&mat1, typeid(*this).name()); + m2 = new PointerMatrix(&mat2, typeid(*this).name()); } -template +template template void -ProductMatrix::reinit ( - const MATRIX1 &mat1, - const MATRIX2 &mat2) +ProductMatrix::reinit (const MATRIX1 &mat1, const MATRIX2 &mat2) { if (m1) delete m1; if (m2) delete m2; - m1 = new PointerMatrix(&mat1, typeid(*this).name()); - m2 = new PointerMatrix(&mat2, typeid(*this).name()); + m1 = new PointerMatrix(&mat1, typeid(*this).name()); + m2 = new PointerMatrix(&mat2, typeid(*this).name()); } -template +template template void -ProductMatrix::initialize ( - const MATRIX1 &mat1, - const MATRIX2 &mat2, - VectorMemory &memory) +ProductMatrix::initialize (const MATRIX1 &mat1, + const MATRIX2 &mat2, + VectorMemory &memory) { mem = &memory; if (m1) delete m1; if (m2) delete m2; - m1 = new PointerMatrix(&mat1, typeid(*this).name()); - m2 = new PointerMatrix(&mat2, typeid(*this).name()); + m1 = new PointerMatrix(&mat1, typeid(*this).name()); + m2 = new PointerMatrix(&mat2, typeid(*this).name()); } -template -ProductMatrix::~ProductMatrix () +template +ProductMatrix::~ProductMatrix () { if (m1) delete m1; if (m2) delete m2; } -template +template void -ProductMatrix::clear () +ProductMatrix::clear () { if (m1) delete m1; m1 = 0; @@ -653,15 +649,15 @@ ProductMatrix::clear () } -template +template void -ProductMatrix::vmult (VECTOR &dst, const VECTOR &src) const +ProductMatrix::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); @@ -669,15 +665,15 @@ ProductMatrix::vmult (VECTOR &dst, const VECTOR &src) const } -template +template void -ProductMatrix::vmult_add (VECTOR &dst, const VECTOR &src) const +ProductMatrix::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); @@ -685,15 +681,15 @@ ProductMatrix::vmult_add (VECTOR &dst, const VECTOR &src) const } -template +template void -ProductMatrix::Tvmult (VECTOR &dst, const VECTOR &src) const +ProductMatrix::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); @@ -701,15 +697,15 @@ ProductMatrix::Tvmult (VECTOR &dst, const VECTOR &src) const } -template +template void -ProductMatrix::Tvmult_add (VECTOR &dst, const VECTOR &src) const +ProductMatrix::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); @@ -720,34 +716,34 @@ ProductMatrix::Tvmult_add (VECTOR &dst, const VECTOR &src) const //--------------------------------------------------------------------------- -template +template inline void -MeanValueFilter::Tvmult(VECTOR &, const VECTOR &) const +MeanValueFilter::Tvmult(VectorType &, const VectorType &) const { Assert(false, ExcNotImplemented()); } -template +template inline void -MeanValueFilter::Tvmult_add(VECTOR &, const VECTOR &) const +MeanValueFilter::Tvmult_add(VectorType &, const VectorType &) const { Assert(false, ExcNotImplemented()); } //-----------------------------------------------------------------------// -template +template template inline void -InverseMatrixRichardson::initialize (const MATRIX &m, const PRECONDITION &p) +InverseMatrixRichardson::initialize (const MATRIX &m, const PRECONDITION &p) { if (matrix != 0) delete matrix; - matrix = new PointerMatrix(&m); + matrix = new PointerMatrix(&m); if (precondition != 0) delete precondition; - precondition = new PointerMatrix(&p); + precondition = new PointerMatrix(&p); } diff --git a/include/deal.II/lac/matrix_lib.templates.h b/include/deal.II/lac/matrix_lib.templates.h index 16d0435a88..3b9ade0aa4 100644 --- a/include/deal.II/lac/matrix_lib.templates.h +++ b/include/deal.II/lac/matrix_lib.templates.h @@ -124,10 +124,10 @@ MeanValueFilter::vmult_add(BlockVector &dst, //----------------------------------------------------------------------// -template -InverseMatrixRichardson::InverseMatrixRichardson( +template +InverseMatrixRichardson::InverseMatrixRichardson( SolverControl &c, - VectorMemory &m) + VectorMemory &m) : mem(m), solver(c,m), @@ -136,17 +136,17 @@ InverseMatrixRichardson::InverseMatrixRichardson( {} -template -InverseMatrixRichardson::~InverseMatrixRichardson() +template +InverseMatrixRichardson::~InverseMatrixRichardson() { if (matrix != 0) delete matrix; if (precondition != 0) delete precondition; } -template +template void -InverseMatrixRichardson::vmult(VECTOR &dst, const VECTOR &src) const +InverseMatrixRichardson::vmult(VectorType &dst, const VectorType &src) const { Assert (matrix != 0, ExcNotInitialized()); Assert (precondition != 0, ExcNotInitialized()); @@ -156,13 +156,13 @@ InverseMatrixRichardson::vmult(VECTOR &dst, const VECTOR &src) const -template +template void -InverseMatrixRichardson::vmult_add(VECTOR &dst, const VECTOR &src) const +InverseMatrixRichardson::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); @@ -173,9 +173,9 @@ InverseMatrixRichardson::vmult_add(VECTOR &dst, const VECTOR &src) const -template +template void -InverseMatrixRichardson::Tvmult(VECTOR &dst, const VECTOR &src) const +InverseMatrixRichardson::Tvmult(VectorType &dst, const VectorType &src) const { Assert (matrix != 0, ExcNotInitialized()); Assert (precondition != 0, ExcNotInitialized()); @@ -185,13 +185,13 @@ InverseMatrixRichardson::Tvmult(VECTOR &dst, const VECTOR &src) const -template +template void -InverseMatrixRichardson::Tvmult_add(VECTOR &dst, const VECTOR &src) const +InverseMatrixRichardson::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); diff --git a/include/deal.II/lac/precondition.h b/include/deal.II/lac/precondition.h index 6c0285b23a..f806b60733 100644 --- a/include/deal.II/lac/precondition.h +++ b/include/deal.II/lac/precondition.h @@ -105,28 +105,28 @@ public: /** * Apply preconditioner. */ - template - void vmult (VECTOR &, const VECTOR &) const; + template + void vmult (VectorType &, const VectorType &) const; /** * Apply transpose preconditioner. Since this is the identity, this function * is the same as vmult(). */ - template - void Tvmult (VECTOR &, const VECTOR &) const; + template + void Tvmult (VectorType &, const VectorType &) const; /** * Apply preconditioner, adding to the previous value. */ - template - void vmult_add (VECTOR &, const VECTOR &) const; + template + 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 - void Tvmult_add (VECTOR &, const VECTOR &) const; + template + void Tvmult_add (VectorType &, const VectorType &) const; /** * This function is only present to provide the interface of a @@ -228,27 +228,27 @@ public: /** * Apply preconditioner. */ - template - void vmult (VECTOR &, const VECTOR &) const; + template + void vmult (VectorType &, const VectorType &) const; /** * Apply transpose preconditioner. Since this is the identity, this function * is the same as vmult(). */ - template - void Tvmult (VECTOR &, const VECTOR &) const; + template + void Tvmult (VectorType &, const VectorType &) const; /** * Apply preconditioner, adding to the previous value. */ - template - void vmult_add (VECTOR &, const VECTOR &) const; + template + 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 - void Tvmult_add (VECTOR &, const VECTOR &) const; + template + void Tvmult_add (VectorType &, const VectorType &) const; /** * This function is only present to provide the interface of a @@ -333,14 +333,14 @@ private: * * @author Guido Kanschat, Wolfgang Bangerth, 1999 */ -template, class VECTOR = Vector > +template, class VectorType = Vector > 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 @@ -354,8 +354,8 @@ public: * 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: /** @@ -446,8 +446,8 @@ protected: /** * Jacobi preconditioner using matrix built-in function. The MATRIX - * class used is required to have a function precondition_Jacobi(VECTOR&, - * const VECTOR&, double) + * class used is required to have a function precondition_Jacobi(VectorType&, + * const VectorType&, double) * * @code * // Declare related objects @@ -476,27 +476,27 @@ public: /** * Apply preconditioner. */ - template - void vmult (VECTOR &, const VECTOR &) const; + template + void vmult (VectorType &, const VectorType &) const; /** * Apply transpose preconditioner. Since this is a symmetric preconditioner, * this function is the same as vmult(). */ - template - void Tvmult (VECTOR &, const VECTOR &) const; + template + void Tvmult (VectorType &, const VectorType &) const; /** * Perform one step of the preconditioned Richardson iteration. */ - template - void step (VECTOR &x, const VECTOR &rhs) const; + template + void step (VectorType &x, const VectorType &rhs) const; /** * Perform one transposed step of the preconditioned Richardson iteration. */ - template - void Tstep (VECTOR &x, const VECTOR &rhs) const; + template + void Tstep (VectorType &x, const VectorType &rhs) const; }; @@ -521,8 +521,8 @@ public: * is the operation implemented by step(). * * The MATRIX class used is required to have functions - * precondition_SOR(VECTOR&, const VECTOR&, double) and - * precondition_TSOR(VECTOR&, const VECTOR&, double). + * precondition_SOR(VectorType&, const VectorType&, double) and + * precondition_TSOR(VectorType&, const VectorType&, double). * * @code * // Declare related objects @@ -551,34 +551,34 @@ public: /** * Apply preconditioner. */ - template - void vmult (VECTOR &, const VECTOR &) const; + template + void vmult (VectorType &, const VectorType &) const; /** * Apply transpose preconditioner. */ - template - void Tvmult (VECTOR &, const VECTOR &) const; + template + void Tvmult (VectorType &, const VectorType &) const; /** * Perform one step of the preconditioned Richardson iteration. */ - template - void step (VECTOR &x, const VECTOR &rhs) const; + template + void step (VectorType &x, const VectorType &rhs) const; /** * Perform one transposed step of the preconditioned Richardson iteration. */ - template - void Tstep (VECTOR &x, const VECTOR &rhs) const; + template + void Tstep (VectorType &x, const VectorType &rhs) const; }; /** * SSOR preconditioner using matrix built-in function. The MATRIX - * class used is required to have a function precondition_SSOR(VECTOR&, - * const VECTOR&, double) + * class used is required to have a function precondition_SSOR(VectorType&, + * const VectorType&, double) * * @code * // Declare related objects @@ -626,28 +626,28 @@ public: /** * Apply preconditioner. */ - template - void vmult (VECTOR &, const VECTOR &) const; + template + void vmult (VectorType &, const VectorType &) const; /** * Apply transpose preconditioner. Since this is a symmetric preconditioner, * this function is the same as vmult(). */ - template - void Tvmult (VECTOR &, const VECTOR &) const; + template + void Tvmult (VectorType &, const VectorType &) const; /** * Perform one step of the preconditioned Richardson iteration */ - template - void step (VECTOR &x, const VECTOR &rhs) const; + template + void step (VectorType &x, const VectorType &rhs) const; /** * Perform one transposed step of the preconditioned Richardson iteration. */ - template - void Tstep (VECTOR &x, const VECTOR &rhs) const; + template + void Tstep (VectorType &x, const VectorType &rhs) const; private: /** @@ -660,8 +660,8 @@ private: /** * Permuted SOR preconditioner using matrix built-in function. The - * MATRIX class used is required to have functions PSOR(VECTOR&, - * const VECTOR&, double) and TPSOR(VECTOR&, const VECTOR&, + * MATRIX class used is required to have functions PSOR(VectorType&, + * const VectorType&, double) and TPSOR(VectorType&, const VectorType&, * double). * * @code @@ -767,14 +767,14 @@ public: /** * Apply preconditioner. */ - template - void vmult (VECTOR &, const VECTOR &) const; + template + void vmult (VectorType &, const VectorType &) const; /** * Apply transpose preconditioner. */ - template - void Tvmult (VECTOR &, const VECTOR &) const; + template + void Tvmult (VectorType &, const VectorType &) const; private: /** * Storage for the permutation vector. @@ -803,7 +803,7 @@ private: * @author Martin Kronbichler, 2009; extension for full compatibility with * LinearOperator class: Jean-Paul Pelteret, 2015 */ -template , class VECTOR=Vector > +template , class VectorType=Vector > class PreconditionChebyshev : public Subscriptor { public: @@ -883,7 +883,7 @@ public: /** * Stores the inverse of the diagonal of the underlying matrix. */ - VECTOR matrix_diagonal_inverse; + VectorType matrix_diagonal_inverse; }; PreconditionChebyshev (); @@ -906,15 +906,15 @@ public: * Computes the action of the preconditioner on src, storing the * result in dst. */ - void vmult (VECTOR &dst, - const VECTOR &src) const; + void vmult (VectorType &dst, + const VectorType &src) const; /** * Computes the action of the transposed preconditioner on src, * storing the result in dst. */ - void Tvmult (VECTOR &dst, - const VECTOR &src) const; + void Tvmult (VectorType &dst, + const VectorType &src) const; /** * Resets the preconditioner. @@ -938,17 +938,17 @@ private: /** * A pointer to the underlying matrix. */ - SmartPointer > matrix_ptr; + SmartPointer > matrix_ptr; /** * Internal vector used for the vmult operation. */ - mutable VECTOR update1; + mutable VectorType update1; /** * Internal vector used for the vmult operation. */ - mutable VECTOR update2; + mutable VectorType update2; /** * Stores the additional data provided to the initialize function. @@ -997,34 +997,34 @@ PreconditionIdentity::initialize ( } -template +template inline void -PreconditionIdentity::vmult (VECTOR &dst, const VECTOR &src) const +PreconditionIdentity::vmult (VectorType &dst, const VectorType &src) const { dst = src; } -template +template inline void -PreconditionIdentity::Tvmult (VECTOR &dst, const VECTOR &src) const +PreconditionIdentity::Tvmult (VectorType &dst, const VectorType &src) const { dst = src; } -template +template inline void -PreconditionIdentity::vmult_add (VECTOR &dst, const VECTOR &src) const +PreconditionIdentity::vmult_add (VectorType &dst, const VectorType &src) const { dst.add(src); } -template +template inline void -PreconditionIdentity::Tvmult_add (VECTOR &dst, const VECTOR &src) const +PreconditionIdentity::Tvmult_add (VectorType &dst, const VectorType &src) const { dst.add(src); } @@ -1088,14 +1088,14 @@ PreconditionRichardson::initialize ( -template +template 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::value, - "PreconditionRichardson and VECTOR must have the same size_type."); + std::is_same::value, + "PreconditionRichardson and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 dst.equ(relaxation,src); @@ -1103,27 +1103,27 @@ PreconditionRichardson::vmult (VECTOR &dst, const VECTOR &src) const -template +template 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::value, - "PreconditionRichardson and VECTOR must have the same size_type."); + std::is_same::value, + "PreconditionRichardson and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 dst.equ(relaxation,src); } -template +template 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::value, - "PreconditionRichardson and VECTOR must have the same size_type."); + std::is_same::value, + "PreconditionRichardson and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 dst.add(relaxation,src); @@ -1131,14 +1131,14 @@ PreconditionRichardson::vmult_add (VECTOR &dst, const VECTOR &src) const -template +template 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::value, - "PreconditionRichardson and VECTOR must have the same size_type."); + std::is_same::value, + "PreconditionRichardson and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 dst.add(relaxation,src); @@ -1196,14 +1196,14 @@ PreconditionRelaxation::n () const //--------------------------------------------------------------------------- template -template +template inline void -PreconditionJacobi::vmult (VECTOR &dst, const VECTOR &src) const +PreconditionJacobi::vmult (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VECTOR::size_type>::value, - "PreconditionJacobi and VECTOR must have the same size_type."); + std::is_same::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()); @@ -1213,14 +1213,14 @@ PreconditionJacobi::vmult (VECTOR &dst, const VECTOR &src) const template -template +template inline void -PreconditionJacobi::Tvmult (VECTOR &dst, const VECTOR &src) const +PreconditionJacobi::Tvmult (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VECTOR::size_type>::value, - "PreconditionJacobi and VECTOR must have the same size_type."); + std::is_same::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()); @@ -1230,14 +1230,14 @@ PreconditionJacobi::Tvmult (VECTOR &dst, const VECTOR &src) const template -template +template inline void -PreconditionJacobi::step (VECTOR &dst, const VECTOR &src) const +PreconditionJacobi::step (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VECTOR::size_type>::value, - "PreconditionJacobi and VECTOR must have the same size_type."); + std::is_same::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()); @@ -1247,14 +1247,14 @@ PreconditionJacobi::step (VECTOR &dst, const VECTOR &src) const template -template +template inline void -PreconditionJacobi::Tstep (VECTOR &dst, const VECTOR &src) const +PreconditionJacobi::Tstep (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VECTOR::size_type>::value, - "PreconditionJacobi and VECTOR must have the same size_type."); + std::is_same::size_type, typename VectorType::size_type>::value, + "PreconditionJacobi and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 step (dst, src); @@ -1265,14 +1265,14 @@ PreconditionJacobi::Tstep (VECTOR &dst, const VECTOR &src) const //--------------------------------------------------------------------------- template -template +template inline void -PreconditionSOR::vmult (VECTOR &dst, const VECTOR &src) const +PreconditionSOR::vmult (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VECTOR::size_type>::value, - "PreconditionSOR and VECTOR must have the same size_type."); + std::is_same::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()); @@ -1282,14 +1282,14 @@ PreconditionSOR::vmult (VECTOR &dst, const VECTOR &src) const template -template +template inline void -PreconditionSOR::Tvmult (VECTOR &dst, const VECTOR &src) const +PreconditionSOR::Tvmult (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VECTOR::size_type>::value, - "PreconditionSOR and VECTOR must have the same size_type."); + std::is_same::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()); @@ -1299,14 +1299,14 @@ PreconditionSOR::Tvmult (VECTOR &dst, const VECTOR &src) const template -template +template inline void -PreconditionSOR::step (VECTOR &dst, const VECTOR &src) const +PreconditionSOR::step (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VECTOR::size_type>::value, - "PreconditionSOR and VECTOR must have the same size_type."); + std::is_same::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()); @@ -1316,14 +1316,14 @@ PreconditionSOR::step (VECTOR &dst, const VECTOR &src) const template -template +template inline void -PreconditionSOR::Tstep (VECTOR &dst, const VECTOR &src) const +PreconditionSOR::Tstep (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VECTOR::size_type>::value, - "PreconditionSOR and VECTOR must have the same size_type."); + std::is_same::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()); @@ -1369,14 +1369,14 @@ PreconditionSSOR::initialize (const MATRIX &rA, template -template +template inline void -PreconditionSSOR::vmult (VECTOR &dst, const VECTOR &src) const +PreconditionSSOR::vmult (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VECTOR::size_type>::value, - "PreconditionSSOR and VECTOR must have the same size_type."); + std::is_same::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()); @@ -1386,14 +1386,14 @@ PreconditionSSOR::vmult (VECTOR &dst, const VECTOR &src) const template -template +template inline void -PreconditionSSOR::Tvmult (VECTOR &dst, const VECTOR &src) const +PreconditionSSOR::Tvmult (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VECTOR::size_type>::value, - "PreconditionSSOR and VECTOR must have the same size_type."); + std::is_same::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()); @@ -1403,14 +1403,14 @@ PreconditionSSOR::Tvmult (VECTOR &dst, const VECTOR &src) const template -template +template inline void -PreconditionSSOR::step (VECTOR &dst, const VECTOR &src) const +PreconditionSSOR::step (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VECTOR::size_type>::value, - "PreconditionSSOR and VECTOR must have the same size_type."); + std::is_same::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()); @@ -1420,14 +1420,14 @@ PreconditionSSOR::step (VECTOR &dst, const VECTOR &src) const template -template +template inline void -PreconditionSSOR::Tstep (VECTOR &dst, const VECTOR &src) const +PreconditionSSOR::Tstep (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VECTOR::size_type>::value, - "PreconditionSSOR and VECTOR must have the same size_type."); + std::is_same::size_type, typename VectorType::size_type>::value, + "PreconditionSSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 step (dst, src); @@ -1465,14 +1465,14 @@ PreconditionPSOR::initialize ( template -template +template inline void -PreconditionPSOR::vmult (VECTOR &dst, const VECTOR &src) const +PreconditionPSOR::vmult (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VECTOR::size_type>::value, - "PreconditionPSOR and VECTOR must have the same size_type."); + std::is_same::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()); @@ -1483,14 +1483,14 @@ PreconditionPSOR::vmult (VECTOR &dst, const VECTOR &src) const template -template +template inline void -PreconditionPSOR::Tvmult (VECTOR &dst, const VECTOR &src) const +PreconditionPSOR::Tvmult (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VECTOR::size_type>::value, - "PreconditionPSOR and VECTOR must have the same size_type."); + std::is_same::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()); @@ -1515,19 +1515,19 @@ PreconditionPSOR::AdditionalData::AdditionalData ( //--------------------------------------------------------------------------- -template -PreconditionUseMatrix::PreconditionUseMatrix(const MATRIX &M, - const function_ptr method) +template +PreconditionUseMatrix::PreconditionUseMatrix(const MATRIX &M, + const function_ptr method) : matrix(M), precondition(method) {} -template +template void -PreconditionUseMatrix::vmult (VECTOR &dst, - const VECTOR &src) const +PreconditionUseMatrix::vmult (VectorType &dst, + const VectorType &src) const { (matrix.*precondition)(dst, src); } @@ -1556,17 +1556,17 @@ namespace internal // size of the vector // generic part for non-deal.II vectors - template + template 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) { @@ -1728,22 +1728,22 @@ namespace internal VectorUpdatesRange(upd, src.local_size()); } - template + template 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 @@ -1761,9 +1761,9 @@ namespace internal -template +template inline -PreconditionChebyshev::AdditionalData:: +PreconditionChebyshev::AdditionalData:: AdditionalData (const unsigned int degree, const double smoothing_range, const bool nonzero_starting, @@ -1781,26 +1781,26 @@ AdditionalData (const unsigned int degree, -template +template inline -PreconditionChebyshev::PreconditionChebyshev () +PreconditionChebyshev::PreconditionChebyshev () : is_initialized (false) { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::value, - "PreconditionChebyshev and VECTOR must have the same size_type."); + std::is_same::value, + "PreconditionChebyshev and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 } -template +template inline void -PreconditionChebyshev::initialize (const MATRIX &matrix, - const AdditionalData &additional_data) +PreconditionChebyshev::initialize (const MATRIX &matrix, + const AdditionalData &additional_data) { matrix_ptr = &matrix; data = additional_data; @@ -1825,9 +1825,9 @@ PreconditionChebyshev::initialize (const MATRIX &matrix, // set a very strict tolerance to force at least two iterations ReductionControl control (data.eig_cg_n_iterations, 1e-35, 1e-10); - GrowingVectorMemory memory; - VECTOR *rhs = memory.alloc(); - VECTOR *dummy = memory.alloc(); + GrowingVectorMemory memory; + VectorType *rhs = memory.alloc(); + VectorType *dummy = memory.alloc(); rhs->reinit(data.matrix_diagonal_inverse); dummy->reinit(data.matrix_diagonal_inverse); @@ -1842,11 +1842,11 @@ PreconditionChebyshev::initialize (const MATRIX &matrix, rhs->compress(VectorOperation::insert); internal::PreconditionChebyshev::EigenvalueTracker eigenvalue_tracker; - SolverCG solver (control, memory); + SolverCG solver (control, memory); solver.connect_eigenvalues_slot(std_cxx11::bind(&internal::PreconditionChebyshev::EigenvalueTracker::slot, &eigenvalue_tracker, std_cxx11::_1)); - internal::PreconditionChebyshev::DiagonalPreconditioner + internal::PreconditionChebyshev::DiagonalPreconditioner preconditioner(data.matrix_diagonal_inverse); try { @@ -1892,11 +1892,11 @@ PreconditionChebyshev::initialize (const MATRIX &matrix, -template +template inline void -PreconditionChebyshev::vmult (VECTOR &dst, - const VECTOR &src) const +PreconditionChebyshev::vmult (VectorType &dst, + const VectorType &src) const { Assert (is_initialized, ExcMessage("Preconditioner not initialized")); double rhok = delta / theta, sigma = theta / delta; @@ -1926,11 +1926,11 @@ PreconditionChebyshev::vmult (VECTOR &dst, -template +template inline void -PreconditionChebyshev::Tvmult (VECTOR &dst, - const VECTOR &src) const +PreconditionChebyshev::Tvmult (VectorType &dst, + const VectorType &src) const { Assert (is_initialized, ExcMessage("Preconditioner not initialized")); double rhok = delta / theta, sigma = theta / delta; @@ -1960,9 +1960,9 @@ PreconditionChebyshev::Tvmult (VECTOR &dst, -template +template inline -void PreconditionChebyshev::clear () +void PreconditionChebyshev::clear () { is_initialized = false; matrix_ptr = 0; @@ -1972,20 +1972,20 @@ void PreconditionChebyshev::clear () } -template +template inline -typename PreconditionChebyshev::size_type -PreconditionChebyshev::m () const +typename PreconditionChebyshev::size_type +PreconditionChebyshev::m () const { Assert (matrix_ptr!=0, ExcNotInitialized()); return matrix_ptr->m(); } -template +template inline -typename PreconditionChebyshev::size_type -PreconditionChebyshev::n () const +typename PreconditionChebyshev::size_type +PreconditionChebyshev::n () const { Assert (matrix_ptr!=0, ExcNotInitialized()); return matrix_ptr->n(); diff --git a/include/deal.II/lac/solver_cg.h b/include/deal.II/lac/solver_cg.h index c11f6f52e8..2829124fcc 100644 --- a/include/deal.II/lac/solver_cg.h +++ b/include/deal.II/lac/solver_cg.h @@ -95,8 +95,8 @@ class PreconditionIdentity; * * @author W. Bangerth, G. Kanschat, R. Becker and F.-T. Suttmeier */ -template > -class SolverCG : public Solver +template > +class SolverCG : public Solver { public: /** @@ -156,9 +156,9 @@ public: /** * Constructor. */ - SolverCG (SolverControl &cn, - VectorMemory &mem, - const AdditionalData &data = AdditionalData()); + SolverCG (SolverControl &cn, + VectorMemory &mem, + const AdditionalData &data = AdditionalData()); /** * Constructor. Use an object of type GrowingVectorMemory as a default to @@ -178,8 +178,8 @@ public: template void solve (const MATRIX &A, - VECTOR &x, - const VECTOR &b, + VectorType &x, + const VectorType &b, const PRECONDITIONER &precondition); /** @@ -227,9 +227,9 @@ protected: * 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 @@ -251,9 +251,9 @@ protected: * 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 @@ -308,9 +308,9 @@ private: #ifndef DOXYGEN -template +template inline -SolverCG::AdditionalData:: +SolverCG::AdditionalData:: AdditionalData (const bool log_coefficients, const bool compute_condition_number, const bool compute_all_condition_numbers, @@ -324,9 +324,9 @@ AdditionalData (const bool log_coefficients, -template +template inline -SolverCG::AdditionalData:: +SolverCG::AdditionalData:: AdditionalData () : log_coefficients (false), @@ -337,45 +337,45 @@ AdditionalData () -template -SolverCG::SolverCG (SolverControl &cn, - VectorMemory &mem, - const AdditionalData &data) +template +SolverCG::SolverCG (SolverControl &cn, + VectorMemory &mem, + const AdditionalData &data) : - Solver(cn,mem), + Solver(cn,mem), additional_data(data) {} -template -SolverCG::SolverCG (SolverControl &cn, - const AdditionalData &data) +template +SolverCG::SolverCG (SolverControl &cn, + const AdditionalData &data) : - Solver(cn), + Solver(cn), additional_data(data) {} -template -SolverCG::~SolverCG () +template +SolverCG::~SolverCG () {} -template +template double -SolverCG::criterion() +SolverCG::criterion() { return std::sqrt(res2); } -template +template void -SolverCG::cleanup() +SolverCG::cleanup() { this->memory.free(Vr); this->memory.free(Vp); @@ -385,25 +385,25 @@ SolverCG::cleanup() -template +template void -SolverCG::print_vectors(const unsigned int, - const VECTOR &, - const VECTOR &, - const VECTOR &) const +SolverCG::print_vectors(const unsigned int, + const VectorType &, + const VectorType &, + const VectorType &) const {} -template +template inline void -SolverCG::compute_eigs_and_cond( - const std::vector &diagonal, - const std::vector &offdiagonal, - const boost::signals2::signal &)> &eigenvalues_signal, - const boost::signals2::signal &cond_signal, - const bool log_eigenvalues, - const bool log_cond) +SolverCG::compute_eigs_and_cond +(const std::vector &diagonal, + const std::vector &offdiagonal, + const boost::signals2::signal &)> &eigenvalues_signal, + const boost::signals2::signal &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 || @@ -452,13 +452,13 @@ SolverCG::compute_eigs_and_cond( -template +template template void -SolverCG::solve (const MATRIX &A, - VECTOR &x, - const VECTOR &b, - const PRECONDITIONER &precondition) +SolverCG::solve (const MATRIX &A, + VectorType &x, + const VectorType &b, + const PRECONDITIONER &precondition) { SolverControl::State conv=SolverControl::iterate; @@ -490,9 +490,9 @@ SolverCG::solve (const MATRIX &A, 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. @@ -611,21 +611,21 @@ SolverCG::solve (const MATRIX &A, -template +template boost::signals2::connection -SolverCG::connect_coefficients_slot( - const std_cxx11::function &slot) +SolverCG::connect_coefficients_slot +(const std_cxx11::function &slot) { return coefficients_signal.connect(slot); } -template +template boost::signals2::connection -SolverCG::connect_condition_number_slot( - const std_cxx11::function &slot, - const bool every_iteration) +SolverCG::connect_condition_number_slot +(const std_cxx11::function &slot, + const bool every_iteration) { if (every_iteration) { @@ -639,11 +639,11 @@ SolverCG::connect_condition_number_slot( -template +template boost::signals2::connection -SolverCG::connect_eigenvalues_slot( - const std_cxx11::function &)> &slot, - const bool every_iteration) +SolverCG::connect_eigenvalues_slot +(const std_cxx11::function &)> &slot, + const bool every_iteration) { if (every_iteration) { diff --git a/include/deal.II/lac/solver_richardson.h b/include/deal.II/lac/solver_richardson.h index e96c3f1b9e..ac8e3e1144 100644 --- a/include/deal.II/lac/solver_richardson.h +++ b/include/deal.II/lac/solver_richardson.h @@ -57,8 +57,8 @@ DEAL_II_NAMESPACE_OPEN * * @author Ralf Hartmann */ -template > -class SolverRichardson : public Solver +template > +class SolverRichardson : public Solver { public: /** @@ -88,9 +88,9 @@ public: /** * Constructor. */ - SolverRichardson (SolverControl &cn, - VectorMemory &mem, - const AdditionalData &data=AdditionalData()); + SolverRichardson (SolverControl &cn, + VectorMemory &mem, + const AdditionalData &data=AdditionalData()); /** * Constructor. Use an object of type GrowingVectorMemory as a default to @@ -110,8 +110,8 @@ public: template void solve (const MATRIX &A, - VECTOR &x, - const VECTOR &b, + VectorType &x, + const VectorType &b, const PRECONDITIONER &precondition); /** @@ -120,8 +120,8 @@ public: template void Tsolve (const MATRIX &A, - VECTOR &x, - const VECTOR &b, + VectorType &x, + const VectorType &b, const PRECONDITIONER &precondition); /** @@ -134,28 +134,28 @@ public: * 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. @@ -168,7 +168,7 @@ protected: * 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; }; /*@}*/ @@ -176,9 +176,9 @@ protected: #ifndef DOXYGEN -template +template inline -SolverRichardson::AdditionalData:: +SolverRichardson::AdditionalData:: AdditionalData (const double omega, const bool use_preconditioned_residual) : @@ -187,39 +187,39 @@ AdditionalData (const double omega, {} -template -SolverRichardson::SolverRichardson(SolverControl &cn, - VectorMemory &mem, - const AdditionalData &data) +template +SolverRichardson::SolverRichardson(SolverControl &cn, + VectorMemory &mem, + const AdditionalData &data) : - Solver (cn,mem), + Solver (cn,mem), additional_data(data) {} -template -SolverRichardson::SolverRichardson(SolverControl &cn, - const AdditionalData &data) +template +SolverRichardson::SolverRichardson(SolverControl &cn, + const AdditionalData &data) : - Solver (cn), + Solver (cn), additional_data(data) {} -template -SolverRichardson::~SolverRichardson() +template +SolverRichardson::~SolverRichardson() {} -template +template template void -SolverRichardson::solve (const MATRIX &A, - VECTOR &x, - const VECTOR &b, - const PRECONDITIONER &precondition) +SolverRichardson::solve (const MATRIX &A, + VectorType &x, + const VectorType &b, + const PRECONDITIONER &precondition) { SolverControl::State conv=SolverControl::iterate; @@ -229,10 +229,10 @@ SolverRichardson::solve (const MATRIX &A, // 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"); @@ -284,13 +284,13 @@ SolverRichardson::solve (const MATRIX &A, } -template +template template void -SolverRichardson::Tsolve (const MATRIX &A, - VECTOR &x, - const VECTOR &b, - const PRECONDITIONER &precondition) +SolverRichardson::Tsolve (const MATRIX &A, + VectorType &x, + const VectorType &b, + const PRECONDITIONER &precondition) { SolverControl::State conv=SolverControl::iterate; double last_criterion = -std::numeric_limits::max(); @@ -299,10 +299,10 @@ SolverRichardson::Tsolve (const MATRIX &A, // 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"); @@ -349,19 +349,19 @@ SolverRichardson::Tsolve (const MATRIX &A, } -template +template void -SolverRichardson::print_vectors(const unsigned int, - const VECTOR &, - const VECTOR &, - const VECTOR &) const +SolverRichardson::print_vectors(const unsigned int, + const VectorType &, + const VectorType &, + const VectorType &) const {} -template -inline typename VECTOR::value_type -SolverRichardson::criterion() +template +inline typename VectorType::value_type +SolverRichardson::criterion() { if (!additional_data.use_preconditioned_residual) res = Vr->l2_norm(); @@ -371,9 +371,9 @@ SolverRichardson::criterion() } -template +template inline void -SolverRichardson::set_omega (const double om) +SolverRichardson::set_omega (const double om) { additional_data.omega=om; } diff --git a/include/deal.II/lac/solver_selector.h b/include/deal.II/lac/solver_selector.h index cc135cad50..99591e254b 100644 --- a/include/deal.II/lac/solver_selector.h +++ b/include/deal.II/lac/solver_selector.h @@ -94,14 +94,14 @@ DEAL_II_NAMESPACE_OPEN * * @author Ralf Hartmann, 1999 */ -template > +template > 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 @@ -119,10 +119,10 @@ public: * */ template - 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 @@ -138,37 +138,37 @@ public: /** * Set the additional data. For more info see the @p Solver class. */ - void set_data(const typename SolverRichardson + void set_data(const typename SolverRichardson ::AdditionalData &data); /** * Set the additional data. For more info see the @p Solver class. */ - void set_data(const typename SolverCG + void set_data(const typename SolverCG ::AdditionalData &data); /** * Set the additional data. For more info see the @p Solver class. */ - void set_data(const typename SolverMinRes + void set_data(const typename SolverMinRes ::AdditionalData &data); /** * Set the additional data. For more info see the @p Solver class. */ - void set_data(const typename SolverBicgstab + void set_data(const typename SolverBicgstab ::AdditionalData &data); /** * Set the additional data. For more info see the @p Solver class. */ - void set_data(const typename SolverGMRES + void set_data(const typename SolverGMRES ::AdditionalData &data); /** * Set the additional data. For more info see the @p Solver class. */ - void set_data(const typename SolverFGMRES + void set_data(const typename SolverFGMRES ::AdditionalData &data); /** @@ -190,7 +190,7 @@ protected: * 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. @@ -201,92 +201,92 @@ private: /** * Stores the additional data. */ - typename SolverRichardson::AdditionalData richardson_data; + typename SolverRichardson::AdditionalData richardson_data; /** * Stores the additional data. */ - typename SolverCG::AdditionalData cg_data; + typename SolverCG::AdditionalData cg_data; /** * Stores the additional data. */ - typename SolverMinRes::AdditionalData minres_data; + typename SolverMinRes::AdditionalData minres_data; /** * Stores the additional data. */ - typename SolverBicgstab::AdditionalData bicgstab_data; + typename SolverBicgstab::AdditionalData bicgstab_data; /** * Stores the additional data. */ - typename SolverGMRES::AdditionalData gmres_data; + typename SolverGMRES::AdditionalData gmres_data; /** * Stores the additional data. */ - typename SolverFGMRES::AdditionalData fgmres_data; + typename SolverFGMRES::AdditionalData fgmres_data; }; /*@}*/ /* --------------------- Inline and template functions ------------------- */ -template -SolverSelector::SolverSelector() +template +SolverSelector::SolverSelector() {} -template -SolverSelector::~SolverSelector() +template +SolverSelector::~SolverSelector() {} -template +template void -SolverSelector::select(const std::string &name) +SolverSelector::select(const std::string &name) { solver_name = name; } -template +template template void -SolverSelector::solve(const Matrix &A, - VECTOR &x, - const VECTOR &b, - const Preconditioner &precond) const +SolverSelector::solve (const Matrix &A, + VectorType &x, + const VectorType &b, + const Preconditioner &precond) const { if (solver_name=="richardson") { - SolverRichardson solver(*control, richardson_data); + SolverRichardson solver(*control, richardson_data); solver.solve(A,x,b,precond); } else if (solver_name=="cg") { - SolverCG solver(*control, cg_data); + SolverCG solver(*control, cg_data); solver.solve(A,x,b,precond); } else if (solver_name=="minres") { - SolverMinRes solver(*control, minres_data); + SolverMinRes solver(*control, minres_data); solver.solve(A,x,b,precond); } else if (solver_name=="bicgstab") { - SolverBicgstab solver(*control, bicgstab_data); + SolverBicgstab solver(*control, bicgstab_data); solver.solve(A,x,b,precond); } else if (solver_name=="gmres") { - SolverGMRES solver(*control, gmres_data); + SolverGMRES solver(*control, gmres_data); solver.solve(A,x,b,precond); } else if (solver_name=="fgmres") { - SolverFGMRES solver(*control, fgmres_data); + SolverFGMRES solver(*control, fgmres_data); solver.solve(A,x,b,precond); } else @@ -294,64 +294,63 @@ SolverSelector::solve(const Matrix &A, } -template -void SolverSelector::set_control( - SolverControl &ctrl) +template +void SolverSelector::set_control (SolverControl &ctrl) { control=&ctrl; } -template -std::string SolverSelector::get_solver_names() +template +std::string SolverSelector::get_solver_names() { return "richardson|cg|bicgstab|gmres|fgmres|minres"; } -template -void SolverSelector::set_data( - const typename SolverGMRES::AdditionalData &data) +template +void SolverSelector::set_data +(const typename SolverGMRES::AdditionalData &data) { gmres_data=data; } -template -void SolverSelector::set_data( - const typename SolverFGMRES::AdditionalData &data) +template +void SolverSelector::set_data +(const typename SolverFGMRES::AdditionalData &data) { fgmres_data=data; } -template -void SolverSelector::set_data( - const typename SolverRichardson::AdditionalData &data) +template +void SolverSelector::set_data +(const typename SolverRichardson::AdditionalData &data) { richardson_data=data; } -template -void SolverSelector::set_data( - const typename SolverCG::AdditionalData &data) +template +void SolverSelector::set_data( + const typename SolverCG::AdditionalData &data) { cg_data=data; } -template -void SolverSelector::set_data( - const typename SolverMinRes::AdditionalData &data) +template +void SolverSelector::set_data +(const typename SolverMinRes::AdditionalData &data) { minres_data=data; } -template -void SolverSelector::set_data( - const typename SolverBicgstab::AdditionalData &data) +template +void SolverSelector::set_data +(const typename SolverBicgstab::AdditionalData &data) { bicgstab_data=data; } diff --git a/include/deal.II/lac/vector_memory.h b/include/deal.II/lac/vector_memory.h index 78dca45340..85473dbd7e 100644 --- a/include/deal.II/lac/vector_memory.h +++ b/include/deal.II/lac/vector_memory.h @@ -67,7 +67,7 @@ DEAL_II_NAMESPACE_OPEN * * @author Guido Kanschat, 1998-2003 */ -template > +template > class VectorMemory : public Subscriptor { public: @@ -84,13 +84,13 @@ 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 @@ -121,7 +121,7 @@ public: /** * Constructor, automatically allocating a vector from @p mem. */ - Pointer(VectorMemory &mem); + Pointer(VectorMemory &mem); /** * Destructor, automatically releasing the vector from the memory #pool. */ @@ -130,26 +130,26 @@ public: /** * 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,Pointer> pool; + SmartPointer,Pointer> pool; /** * The pointer to the vector. */ - VECTOR *v; + VectorType *v; }; }; @@ -162,8 +162,8 @@ public: * This class allocates and deletes vectors as needed from the global heap, * i.e. performs no specially adapted actions for memory management. */ -template > -class PrimitiveVectorMemory : public VectorMemory +template > +class PrimitiveVectorMemory : public VectorMemory { public: /** @@ -180,9 +180,9 @@ 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(); } /** @@ -193,7 +193,7 @@ public: * 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; } @@ -225,8 +225,8 @@ public: * * @author Guido Kanschat, 1999, 2007 */ -template > -class GrowingVectorMemory : public VectorMemory +template > +class GrowingVectorMemory : public VectorMemory { public: /** @@ -256,7 +256,7 @@ 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 @@ -265,7 +265,7 @@ public: * 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. @@ -282,7 +282,7 @@ private: * 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 entry_type; + typedef std::pair entry_type; /** * The class providing the actual storage for the memory pool. @@ -347,9 +347,9 @@ private: /* --------------------- inline functions ---------------------- */ -template +template inline -VectorMemory::Pointer::Pointer(VectorMemory &mem) +VectorMemory::Pointer::Pointer(VectorMemory &mem) : pool(&mem, typeid(*this).name()), v(0) { @@ -357,33 +357,33 @@ VectorMemory::Pointer::Pointer(VectorMemory &mem) } -template +template inline -VectorMemory::Pointer::~Pointer() +VectorMemory::Pointer::~Pointer() { pool->free(v); } -template +template inline -VectorMemory::Pointer::operator VECTOR *() const +VectorMemory::Pointer::operator VectorType *() const { return v; } -template +template inline -VECTOR &VectorMemory::Pointer::operator * () const +VectorType &VectorMemory::Pointer::operator * () const { return *v; } -template +template inline -VECTOR *VectorMemory::Pointer::operator -> () const +VectorType *VectorMemory::Pointer::operator -> () const { return v; } diff --git a/include/deal.II/meshworker/assembler.h b/include/deal.II/meshworker/assembler.h index 54e8a21c8d..9d1e78e04e 100644 --- a/include/deal.II/meshworker/assembler.h +++ b/include/deal.II/meshworker/assembler.h @@ -103,7 +103,7 @@ namespace MeshWorker * @ingroup MeshWorker * @author Guido Kanschat, 2009 */ - template + template class ResidualLocalBlocksToGlobalBlocks { public: @@ -143,8 +143,8 @@ namespace MeshWorker /** * Assemble a single local residual into the global. */ - void assemble(VECTOR &global, - const BlockVector &local, + void assemble(VectorType &global, + const BlockVector &local, const std::vector &dof); /** @@ -156,12 +156,12 @@ namespace MeshWorker * A pointer to the object containing the block structure. */ SmartPointer > block_info; + ResidualLocalBlocksToGlobalBlocks > block_info; /** * A pointer to the object containing constraints. */ SmartPointer > constraints; + ResidualLocalBlocksToGlobalBlocks > constraints; }; @@ -493,39 +493,39 @@ namespace MeshWorker //----------------------------------------------------------------------// - template + template inline void - ResidualLocalBlocksToGlobalBlocks::initialize(const BlockInfo *b, - AnyData &m) + ResidualLocalBlocksToGlobalBlocks::initialize(const BlockInfo *b, + AnyData &m) { block_info = b; residuals = m; } - template + template inline void - ResidualLocalBlocksToGlobalBlocks::initialize( - const ConstraintMatrix &c) + ResidualLocalBlocksToGlobalBlocks::initialize + (const ConstraintMatrix &c) { constraints = &c; } - template + template template inline void - ResidualLocalBlocksToGlobalBlocks::initialize_info( - DOFINFO &info, bool) const + ResidualLocalBlocksToGlobalBlocks::initialize_info + (DOFINFO &info, bool) const { info.initialize_vectors(residuals.size()); } - template + template inline void - ResidualLocalBlocksToGlobalBlocks::assemble( - VECTOR &global, - const BlockVector &local, - const std::vector &dof) + ResidualLocalBlocksToGlobalBlocks::assemble + (VectorType &global, + const BlockVector &local, + const std::vector &dof) { if (constraints == 0) { @@ -549,23 +549,23 @@ namespace MeshWorker } - template + template template inline void - ResidualLocalBlocksToGlobalBlocks::assemble( - const DOFINFO &info) + ResidualLocalBlocksToGlobalBlocks::assemble + (const DOFINFO &info) { for (unsigned int i=0; i + template template inline void - ResidualLocalBlocksToGlobalBlocks::assemble( - const DOFINFO &info1, - const DOFINFO &info2) + ResidualLocalBlocksToGlobalBlocks::assemble + (const DOFINFO &info1, + const DOFINFO &info2) { for (unsigned int i=0; i + template void initialize(const FiniteElement &el, - const Mapping &mapping, - const AnyData &data, - const VECTOR &dummy, - const BlockInfo *block_info = 0); + const Mapping &mapping, + const AnyData &data, + const VectorType &dummy, + const BlockInfo *block_info = 0); /** * Initialize the IntegrationInfo objects contained. * @@ -323,12 +323,12 @@ namespace MeshWorker * and also set uninitialized quadrature rules to Gauss formulas, which * integrate polynomial bilinear forms exactly. */ - template + template void initialize(const FiniteElement &el, - const Mapping &mapping, - const AnyData &data, - const MGLevelObject &dummy, - const BlockInfo *block_info = 0); + const Mapping &mapping, + const AnyData &data, + const MGLevelObject &dummy, + const BlockInfo *block_info = 0); /** * @name FEValues setup */ @@ -773,20 +773,20 @@ namespace MeshWorker template - template + template void - IntegrationInfoBox::initialize( - const FiniteElement &el, - const Mapping &mapping, - const AnyData &data, - const VECTOR &, - const BlockInfo *block_info) + IntegrationInfoBox::initialize + (const FiniteElement &el, + const Mapping &mapping, + const AnyData &data, + const VectorType &, + const BlockInfo *block_info) { initialize(el, mapping, block_info); - std_cxx11::shared_ptr > p; + std_cxx11::shared_ptr > p; VectorDataBase *pp; - p = std_cxx11::shared_ptr >(new VectorData (cell_selector)); + p = std_cxx11::shared_ptr >(new VectorData (cell_selector)); // Public member function of parent class was not found without // explicit cast pp = &*p; @@ -794,13 +794,13 @@ namespace MeshWorker cell_data = p; cell.initialize_data(p); - p = std_cxx11::shared_ptr >(new VectorData (boundary_selector)); + p = std_cxx11::shared_ptr >(new VectorData (boundary_selector)); pp = &*p; pp->initialize(data); boundary_data = p; boundary.initialize_data(p); - p = std_cxx11::shared_ptr >(new VectorData (face_selector)); + p = std_cxx11::shared_ptr >(new VectorData (face_selector)); pp = &*p; pp->initialize(data); face_data = p; @@ -810,20 +810,20 @@ namespace MeshWorker } template - template + template void - IntegrationInfoBox::initialize( - const FiniteElement &el, - const Mapping &mapping, - const AnyData &data, - const MGLevelObject &, - const BlockInfo *block_info) + IntegrationInfoBox::initialize + (const FiniteElement &el, + const Mapping &mapping, + const AnyData &data, + const MGLevelObject &, + const BlockInfo *block_info) { initialize(el, mapping, block_info); - std_cxx11::shared_ptr > p; + std_cxx11::shared_ptr > p; VectorDataBase *pp; - p = std_cxx11::shared_ptr >(new MGVectorData (cell_selector)); + p = std_cxx11::shared_ptr >(new MGVectorData (cell_selector)); // Public member function of parent class was not found without // explicit cast pp = &*p; @@ -831,13 +831,13 @@ namespace MeshWorker cell_data = p; cell.initialize_data(p); - p = std_cxx11::shared_ptr >(new MGVectorData (boundary_selector)); + p = std_cxx11::shared_ptr >(new MGVectorData (boundary_selector)); pp = &*p; pp->initialize(data); boundary_data = p; boundary.initialize_data(p); - p = std_cxx11::shared_ptr >(new MGVectorData (face_selector)); + p = std_cxx11::shared_ptr >(new MGVectorData (face_selector)); pp = &*p; pp->initialize(data); face_data = p; diff --git a/include/deal.II/meshworker/simple.h b/include/deal.II/meshworker/simple.h index e4ceda1cb9..58e6a039c2 100644 --- a/include/deal.II/meshworker/simple.h +++ b/include/deal.II/meshworker/simple.h @@ -50,7 +50,7 @@ namespace MeshWorker * @ingroup MeshWorker * @author Guido Kanschat, 2009 */ - template + template class ResidualSimple { public: @@ -115,7 +115,7 @@ namespace MeshWorker /** * A pointer to the object containing constraints. */ - SmartPointer > constraints; + SmartPointer > constraints; }; @@ -409,10 +409,10 @@ namespace MeshWorker * @ingroup MeshWorker * @author Guido Kanschat, 2009 */ - template + template class SystemSimple : private MatrixSimple, - private ResidualSimple + private ResidualSimple { public: /** @@ -423,7 +423,7 @@ namespace MeshWorker /** * 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 @@ -462,16 +462,16 @@ namespace MeshWorker //----------------------------------------------------------------------// - template + template inline void - ResidualSimple::initialize(AnyData &results) + ResidualSimple::initialize(AnyData &results) { residuals = results; } - template + template inline void - ResidualSimple::initialize(const ConstraintMatrix &c) + ResidualSimple::initialize(const ConstraintMatrix &c) { constraints = &c; } @@ -483,23 +483,23 @@ namespace MeshWorker {} - template + template template inline void - ResidualSimple::initialize_info(DOFINFO &info, bool) const + ResidualSimple::initialize_info(DOFINFO &info, bool) const { info.initialize_vectors(residuals.size()); } - template + template template inline void - ResidualSimple::assemble(const DOFINFO &info) + ResidualSimple::assemble(const DOFINFO &info) { for (unsigned int k=0; k(k); + VectorType *v = residuals.entry(k); if (constraints == 0) { for (unsigned int i=0; i + template template inline void - ResidualSimple::assemble(const DOFINFO &info1, - const DOFINFO &info2) + ResidualSimple::assemble(const DOFINFO &info1, + const DOFINFO &info2) { for (unsigned int k=0; k(k); + VectorType *v = residuals.entry(k); if (constraints == 0) { for (unsigned int i=0; i - SystemSimple::SystemSimple(double t) + template + SystemSimple::SystemSimple(double t) : MatrixSimple(t) {} - template + template inline void - SystemSimple::initialize(MATRIX &m, VECTOR &rhs) + SystemSimple::initialize(MATRIX &m, VectorType &rhs) { AnyData data; - VECTOR *p = &rhs; + VectorType *p = &rhs; data.add(p, "right hand side"); MatrixSimple::initialize(m); - ResidualSimple::initialize(data); + ResidualSimple::initialize(data); } - template + template inline void - SystemSimple::initialize(const ConstraintMatrix &c) + SystemSimple::initialize(const ConstraintMatrix &c) { MatrixSimple::initialize(c); - ResidualSimple::initialize(c); + ResidualSimple::initialize(c); } - template + template template inline void - SystemSimple::initialize_info(DOFINFO &info, - bool face) const + SystemSimple::initialize_info(DOFINFO &info, + bool face) const { MatrixSimple::initialize_info(info, face); - ResidualSimple::initialize_info(info, face); + ResidualSimple::initialize_info(info, face); } - template + template template inline void - SystemSimple::assemble(const DOFINFO &info) + SystemSimple::assemble(const DOFINFO &info) { MatrixSimple::assemble(info); - ResidualSimple::assemble(info); + ResidualSimple::assemble(info); } - template + template template inline void - SystemSimple::assemble(const DOFINFO &info1, - const DOFINFO &info2) + SystemSimple::assemble(const DOFINFO &info1, + const DOFINFO &info2) { MatrixSimple::assemble(info1, info2); - ResidualSimple::assemble(info1, info2); + ResidualSimple::assemble(info1, info2); } } } diff --git a/include/deal.II/meshworker/vector_selector.h b/include/deal.II/meshworker/vector_selector.h index 5a4928ec50..f4ba7ff549 100644 --- a/include/deal.II/meshworker/vector_selector.h +++ b/include/deal.II/meshworker/vector_selector.h @@ -285,9 +285,9 @@ namespace MeshWorker * @ingroup MeshWorker * @author Guido Kanschat, 2009 */ - template + template class VectorData : - public VectorDataBase + public VectorDataBase { public: /** @@ -311,12 +311,12 @@ namespace MeshWorker * @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 > > &values, - std::vector > > > &gradients, - std::vector > > > &hessians, + std::vector > > &values, + std::vector > > > &gradients, + std::vector > > > &hessians, const FEValuesBase &fe, const std::vector &index, const unsigned int component, @@ -325,9 +325,9 @@ namespace MeshWorker const unsigned int size) const; virtual void mg_fill( - std::vector > > &values, - std::vector > > > &gradients, - std::vector > > > &hessians, + std::vector > > &values, + std::vector > > > &gradients, + std::vector > > > &hessians, const FEValuesBase &fe, const unsigned int level, const std::vector &index, @@ -351,9 +351,9 @@ namespace MeshWorker * @ingroup MeshWorker * @author Guido Kanschat, 2010 */ - template + template class MGVectorData : - public VectorData + public VectorData { public: /** @@ -378,7 +378,7 @@ namespace MeshWorker * @note Make sure the VectorSelector base class was filled with * reasonable data before calling this function. */ - void initialize(const MGLevelObject *, const std::string &name); + void initialize(const MGLevelObject *, const std::string &name); /** diff --git a/include/deal.II/meshworker/vector_selector.templates.h b/include/deal.II/meshworker/vector_selector.templates.h index b3fed888c1..805bced493 100644 --- a/include/deal.II/meshworker/vector_selector.templates.h +++ b/include/deal.II/meshworker/vector_selector.templates.h @@ -85,43 +85,43 @@ namespace MeshWorker //----------------------------------------------------------------------// - template - VectorData::VectorData() + template + VectorData::VectorData() {} - template - VectorData::VectorData(const VectorSelector &s) + template + VectorData::VectorData(const VectorSelector &s) : - VectorDataBase(s) + VectorDataBase(s) {} - template + template void - VectorData::initialize(const AnyData &d) + VectorData::initialize(const AnyData &d) { this->data = d; VectorSelector::initialize(d); } - template + template void - VectorData::initialize(const VECTOR *v, const std::string &name) + VectorData::initialize(const VectorType *v, const std::string &name) { - SmartPointer > p = v; + SmartPointer > p = v; this->data.add(p, name); VectorSelector::initialize(this->data); } - template + template void - VectorData::fill( - std::vector > > &values, - std::vector > > > &gradients, - std::vector > > > &hessians, + VectorData::fill( + std::vector > > &values, + std::vector > > > &gradients, + std::vector > > > &hessians, const FEValuesBase &fe, const std::vector &index, const unsigned int component, @@ -136,30 +136,30 @@ namespace MeshWorker const AnyData &data = this->data; for (unsigned int i=0; in_values(); ++i) { - const VECTOR *src = data.read_ptr(this->value_index(i)); - VectorSlice > > dst(values[i], component, n_comp); + const VectorType *src = data.read_ptr(this->value_index(i)); + VectorSlice > > dst(values[i], component, n_comp); fe.get_function_values(*src, make_slice(index, start, size), dst, true); } for (unsigned int i=0; in_gradients(); ++i) { - const VECTOR *src = data.read_ptr(this->gradient_index(i)); - VectorSlice > > > dst(gradients[i], component, n_comp); + const VectorType *src = data.read_ptr(this->gradient_index(i)); + VectorSlice > > > dst(gradients[i], component, n_comp); fe.get_function_gradients(*src, make_slice(index, start, size), dst, true); } for (unsigned int i=0; in_hessians(); ++i) { - const VECTOR *src = data.read_ptr(this->hessian_index(i)); - VectorSlice > > > dst(hessians[i], component, n_comp); + const VectorType *src = data.read_ptr(this->hessian_index(i)); + VectorSlice > > > dst(hessians[i], component, n_comp); fe.get_function_hessians(*src, make_slice(index, start, size), dst, true); } } - template + template std::size_t - VectorData::memory_consumption () const + VectorData::memory_consumption () const { std::size_t mem = VectorSelector::memory_consumption(); mem += sizeof (this->data); @@ -168,51 +168,52 @@ namespace MeshWorker //----------------------------------------------------------------------// - template - MGVectorData::MGVectorData() + template + MGVectorData::MGVectorData() {} - template - MGVectorData::MGVectorData(const VectorSelector &s) + template + MGVectorData::MGVectorData(const VectorSelector &s) : - VectorData(s) + VectorData(s) {} - template + template void - MGVectorData::initialize(const AnyData &d) + MGVectorData::initialize(const AnyData &d) { this->data = d; VectorSelector::initialize(d); } - template + template void - MGVectorData::initialize(const MGLevelObject *v, const std::string &name) + MGVectorData::initialize(const MGLevelObject *v, const std::string &name) { - SmartPointer, MGVectorData > + SmartPointer, MGVectorData > p = v; this->data.add(p, name); VectorSelector::initialize(this->data); } - template + template void - VectorData::mg_fill( - std::vector > > &values, - std::vector > > > &gradients, - std::vector > > > &hessians, - const FEValuesBase &fe, - const unsigned int level, - const std::vector &index, - const unsigned int component, - const unsigned int n_comp, - const unsigned int start, - const unsigned int size) const + VectorData::mg_fill + (std::vector > > &values, + std::vector > > > &gradients, + std::vector > > > &hessians, + const FEValuesBase &fe, + const unsigned int level, + const std::vector &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()); @@ -221,22 +222,22 @@ namespace MeshWorker const AnyData &data = this->data; for (unsigned int i=0; in_values(); ++i) { - const MGLevelObject *src = data.read_ptr >(this->value_index(i)); - VectorSlice > > dst(values[i], component, n_comp); + const MGLevelObject *src = data.read_ptr >(this->value_index(i)); + VectorSlice > > dst(values[i], component, n_comp); fe.get_function_values((*src)[level], make_slice(index, start, size), dst, true); } for (unsigned int i=0; in_gradients(); ++i) { - const MGLevelObject *src = data.read_ptr >(this->value_index(i)); - VectorSlice > > > dst(gradients[i], component, n_comp); + const MGLevelObject *src = data.read_ptr >(this->value_index(i)); + VectorSlice > > > dst(gradients[i], component, n_comp); fe.get_function_gradients((*src)[level], make_slice(index, start, size), dst, true); } for (unsigned int i=0; in_hessians(); ++i) { - const MGLevelObject *src = data.read_ptr >(this->value_index(i)); - VectorSlice > > > dst(hessians[i], component, n_comp); + const MGLevelObject *src = data.read_ptr >(this->value_index(i)); + VectorSlice > > > dst(hessians[i], component, n_comp); fe.get_function_hessians((*src)[level], make_slice(index, start, size), dst, true); } } diff --git a/include/deal.II/multigrid/multigrid.h b/include/deal.II/multigrid/multigrid.h index 8d20f15ac4..df0c9d31a9 100644 --- a/include/deal.II/multigrid/multigrid.h +++ b/include/deal.II/multigrid/multigrid.h @@ -330,7 +330,7 @@ private: */ unsigned int debug; - template friend class PreconditionMG; + template friend class PreconditionMG; }; @@ -368,35 +368,35 @@ public: * * This is the operator used by LAC iterative solvers. */ - template - void vmult (VECTOR2 &dst, - const VECTOR2 &src) const; + template + 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 - void vmult_add (VECTOR2 &dst, - const VECTOR2 &src) const; + template + void vmult_add (OtherVectorType &dst, + const OtherVectorType &src) const; /** * Tranposed preconditioning operator. * * Not implemented, but the definition may be needed. */ - template - void Tvmult (VECTOR2 &dst, - const VECTOR2 &src) const; + template + void Tvmult (OtherVectorType &dst, + const OtherVectorType &src) const; /** * Tranposed preconditioning operator. * * Not implemented, but the definition may be needed. */ - template - void Tvmult_add (VECTOR2 &dst, - const VECTOR2 &src) const; + template + void Tvmult_add (OtherVectorType &dst, + const OtherVectorType &src) const; private: /** @@ -491,11 +491,11 @@ PreconditionMG::empty () const } template -template +template void -PreconditionMG::vmult ( - VECTOR2 &dst, - const VECTOR2 &src) const +PreconditionMG::vmult +(OtherVectorType &dst, + const OtherVectorType &src) const { transfer->copy_to_mg(*dof_handler, multigrid->defect, @@ -509,11 +509,11 @@ PreconditionMG::vmult ( template -template +template void -PreconditionMG::vmult_add ( - VECTOR2 &dst, - const VECTOR2 &src) const +PreconditionMG::vmult_add +(OtherVectorType &dst, + const OtherVectorType &src) const { transfer->copy_to_mg(*dof_handler, multigrid->defect, @@ -526,22 +526,22 @@ PreconditionMG::vmult_add ( template -template +template void -PreconditionMG::Tvmult ( - VECTOR2 &, - const VECTOR2 &) const +PreconditionMG::Tvmult +(OtherVectorType &, + const OtherVectorType &) const { Assert(false, ExcNotImplemented()); } template -template +template void -PreconditionMG::Tvmult_add ( - VECTOR2 &, - const VECTOR2 &) const +PreconditionMG::Tvmult_add +(OtherVectorType &, + const OtherVectorType &) const { Assert(false, ExcNotImplemented()); }