From: David Wells Date: Fri, 30 Oct 2015 14:44:50 +0000 (-0400) Subject: MATRIX to MatrixType, part 1 X-Git-Tag: v8.4.0-rc2~230^2~14 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=299a9478761fa6f8388faed9bbeb4db1973fc11d;p=dealii.git MATRIX to MatrixType, part 1 --- diff --git a/include/deal.II/lac/arpack_solver.h b/include/deal.II/lac/arpack_solver.h index cef7851e2d..48afdb8cc5 100644 --- a/include/deal.II/lac/arpack_solver.h +++ b/include/deal.II/lac/arpack_solver.h @@ -172,14 +172,14 @@ public: * Leave it at its default zero, which will be reset to the size of * eigenvalues internally. */ - template - void solve (const MATRIX1 &A, - const MATRIX2 &B, + template + void solve (const MatrixType1 &A, + const MatrixType2 &B, const INVERSE &inverse, std::vector > &eigenvalues, std::vector &eigenvectors, - const unsigned int n_eigenvalues = 0); + const unsigned int n_eigenvalues = 0); protected: @@ -257,15 +257,15 @@ ArpackSolver::ArpackSolver (SolverControl &control, {} -template +template inline -void ArpackSolver::solve (const MATRIX1 &system_matrix, - const MATRIX2 &mass_matrix, +void ArpackSolver::solve (const MatrixType1 &system_matrix, + const MatrixType2 &mass_matrix, const INVERSE &inverse, std::vector > &eigenvalues, std::vector &eigenvectors, - const unsigned int n_eigenvalues) + const unsigned int n_eigenvalues) { //inside the routines of ARPACK the //values change magically, so store diff --git a/include/deal.II/lac/block_matrix.h b/include/deal.II/lac/block_matrix.h index a90ba86df6..fac76f86e4 100644 --- a/include/deal.II/lac/block_matrix.h +++ b/include/deal.II/lac/block_matrix.h @@ -47,7 +47,7 @@ DEAL_II_NAMESPACE_OPEN * @ref GlossBlockLA "Block (linear algebra)" * @author Guido Kanschat, 2000 */ -template +template class BlockDiagonalMatrix : public Subscriptor { public: @@ -55,7 +55,7 @@ public: * Constructor for an @p n_blocks by @p n_blocks matrix with diagonal blocks * @p M. */ - BlockDiagonalMatrix (const MATRIX &M, + BlockDiagonalMatrix (const MatrixType &M, const unsigned int n_blocks); /** @@ -80,26 +80,26 @@ private: /** * Diagonal entry. */ - SmartPointer > matrix; + SmartPointer > matrix; }; /*@}*/ //--------------------------------------------------------------------------- -template -BlockDiagonalMatrix::BlockDiagonalMatrix (const MATRIX &M, - const unsigned int num_blocks) +template +BlockDiagonalMatrix::BlockDiagonalMatrix (const MatrixType &M, + const unsigned int num_blocks) : num_blocks (num_blocks), matrix(&M) {} -template +template template void -BlockDiagonalMatrix::vmult (BlockVector &dst, - const BlockVector &src) const +BlockDiagonalMatrix::vmult (BlockVector &dst, + const BlockVector &src) const { Assert (dst.n_blocks()==num_blocks, ExcDimensionMismatch(dst.n_blocks(),num_blocks)); @@ -111,11 +111,11 @@ BlockDiagonalMatrix::vmult (BlockVector &dst, } -template +template template void -BlockDiagonalMatrix::Tvmult (BlockVector &dst, - const BlockVector &src) const +BlockDiagonalMatrix::Tvmult (BlockVector &dst, + const BlockVector &src) const { Assert (dst.n_blocks()==num_blocks, ExcDimensionMismatch(dst.n_blocks(),num_blocks)); diff --git a/include/deal.II/lac/block_matrix_array.h b/include/deal.II/lac/block_matrix_array.h index e54a70a352..854ffd9c3c 100644 --- a/include/deal.II/lac/block_matrix_array.h +++ b/include/deal.II/lac/block_matrix_array.h @@ -60,9 +60,9 @@ DEAL_II_NAMESPACE_OPEN * this class. If you need a preconditioner for a BlockMatrixArray object, use * BlockTrianglePrecondition. * - *

Requirements on MATRIX

+ *

Requirements on MatrixType

* - * The template argument MATRIX is a class providing the matrix- + * The template argument MatrixType is a class providing the matrix- * vector multiplication functions vmult(), Tvmult(), vmult_add() and * Tvmult_add() used in this class, but with arguments of type * Vector<number> instead of BlockVector<number>. Every matrix @@ -154,8 +154,8 @@ public: * entering a block of wrong dimension here will only lead to a * ExcDimensionMismatch in one of the multiplication functions. */ - template - void enter (const MATRIX &matrix, + template + void enter (const MatrixType &matrix, const unsigned int row, const unsigned int col, const number prefix = 1., @@ -272,10 +272,12 @@ protected: * Constructor initializing all data fields. A PointerMatrix object is * generated for matrix. */ - template - Entry (const MATRIX &matrix, - size_type row, size_type col, - number prefix, bool transpose); + template + Entry (const MatrixType &matrix, + size_type row, + size_type col, + number prefix, + bool transpose); /** * Copy constructor invalidating the old object. Since it is only used for @@ -423,12 +425,12 @@ public: * Enter a block. This calls BlockMatrixArray::enter(). Remember that the * diagonal blocks should actually be inverse matrices or preconditioners. */ - template - void enter (const MATRIX &matrix, - const size_type row, - const size_type col, - const number prefix = 1., - const bool transpose = false); + template + void enter (const MatrixType &matrix, + const size_type row, + const size_type col, + const number prefix = 1., + const bool transpose = false); /** * Preconditioning. @@ -513,14 +515,14 @@ private: //--------------------------------------------------------------------------- template -template +template inline BlockMatrixArray::Entry::Entry ( - const MATRIX &m, - size_type row, - size_type col, - number prefix, - bool transpose) + const MatrixType &m, + size_type row, + size_type col, + number prefix, + bool transpose) : row (row), col (col), @@ -532,15 +534,14 @@ BlockMatrixArray::Entry::Entry ( template -template +template inline void -BlockMatrixArray::enter ( - const MATRIX &matrix, - unsigned int row, - unsigned int col, - number prefix, - bool transpose) +BlockMatrixArray::enter (const MatrixType &matrix, + unsigned int row, + unsigned int col, + number prefix, + bool transpose) { Assert(row::print_latex (STREAM &out) const } template -template +template inline void -BlockTrianglePrecondition::enter (const MATRIX &matrix, - size_type row, size_type col, - number prefix, bool transpose) +BlockTrianglePrecondition::enter (const MatrixType &matrix, + size_type row, + size_type col, + number prefix, + bool transpose) { BlockMatrixArray::enter(matrix, row, col, prefix, transpose); } diff --git a/include/deal.II/lac/eigen.h b/include/deal.II/lac/eigen.h index e4c56bed90..9d874d234e 100644 --- a/include/deal.II/lac/eigen.h +++ b/include/deal.II/lac/eigen.h @@ -97,11 +97,11 @@ public: * approximated eigenvalue and @p x is the corresponding eigenvector, * normalized with respect to the l2-norm. */ - template + template void - solve (double &value, - const MATRIX &A, - VectorType &x); + solve (double &value, + const MatrixType &A, + VectorType &x); protected: /** @@ -194,11 +194,11 @@ public: * eigenvalue and @p x is the corresponding eigenvector, normalized with * respect to the l2-norm. */ - template + template void - solve (double &value, - const MATRIX &A, - VectorType &x); + solve (double &value, + const MatrixType &A, + VectorType &x); protected: /** @@ -229,11 +229,11 @@ EigenPower::~EigenPower () template -template +template void -EigenPower::solve (double &value, - const MATRIX &A, - VectorType &x) +EigenPower::solve (double &value, + const MatrixType &A, + VectorType &x) { SolverControl::State conv=SolverControl::iterate; @@ -323,18 +323,18 @@ EigenInverse::~EigenInverse () template -template +template void -EigenInverse::solve (double &value, - const MATRIX &A, - VectorType &x) +EigenInverse::solve (double &value, + const MatrixType &A, + VectorType &x) { deallog.push("Wielandt"); SolverControl::State conv=SolverControl::iterate; // Prepare matrix for solver - ShiftedMatrix A_s(A, -value); + ShiftedMatrix A_s(A, -value); // Define solver ReductionControl inner_control (5000, 1.e-16, 1.e-5, false, false); diff --git a/include/deal.II/lac/filtered_matrix.h b/include/deal.II/lac/filtered_matrix.h index 306607548b..289cfb9dfc 100644 --- a/include/deal.II/lac/filtered_matrix.h +++ b/include/deal.II/lac/filtered_matrix.h @@ -341,9 +341,9 @@ public: * @arg @p expect_constrained_source: See documentation of * #expect_constrained_source. */ - template - FilteredMatrix (const MATRIX &matrix, - bool expect_constrained_source = false); + template + FilteredMatrix (const MatrixType &matrix, + bool expect_constrained_source = false); /** * Copy operator. Take over matrix and constraints from the other object. @@ -359,9 +359,9 @@ public: * @arg @p expect_constrained_source: See documentation of * #expect_constrained_source. */ - template - void initialize (const MATRIX &m, - bool expect_constrained_source = false); + template + void initialize (const MatrixType &m, + bool expect_constrained_source = false); /** * Delete all constraints and the matrix pointer. @@ -700,10 +700,10 @@ operator () (const IndexValuePair &i1, template -template +template inline void -FilteredMatrix::initialize (const MATRIX &m, bool ecs) +FilteredMatrix::initialize (const MatrixType &m, bool ecs) { matrix.reset (new_pointer_matrix_base(m, VectorType())); @@ -732,10 +732,10 @@ FilteredMatrix::FilteredMatrix (const FilteredMatrix &fm) template -template +template inline FilteredMatrix:: -FilteredMatrix (const MATRIX &m, bool ecs) +FilteredMatrix (const MatrixType &m, bool ecs) { initialize (m, ecs); } diff --git a/include/deal.II/lac/full_matrix.h b/include/deal.II/lac/full_matrix.h index 933b1d50cd..0aadc96c7c 100644 --- a/include/deal.II/lac/full_matrix.h +++ b/include/deal.II/lac/full_matrix.h @@ -312,19 +312,19 @@ public: /** * Assignment from different matrix classes. This assignment operator uses - * iterators of the class MATRIX. Therefore, sparse matrices are possible + * iterators of the typename MatrixType. Therefore, sparse matrices are possible * sources. */ - template - void copy_from (const MATRIX &); + template + void copy_from (const MatrixType &); /** * Transposing assignment from different matrix classes. This assignment - * operator uses iterators of the class MATRIX. Therefore, sparse matrices + * operator uses iterators of the typename MatrixType. Therefore, sparse matrices * are possible sources. */ - template - void copy_transposed (const MATRIX &); + template + void copy_transposed (const MatrixType &); /** * Fill matrix with elements extracted from a tensor, taking rows included @@ -373,7 +373,7 @@ public: * this operation. */ template - void extract_submatrix_from (const MatrixType &matrix, + void extract_submatrix_from (const MatrixType &matrix, const std::vector &row_index_set, const std::vector &column_index_set); @@ -393,7 +393,7 @@ public: void scatter_matrix_to (const std::vector &row_index_set, const std::vector &column_index_set, - MatrixType &matrix) const; + MatrixType &matrix) const; /** * Fill rectangular block. @@ -1206,9 +1206,9 @@ void FullMatrix::fill (const number2 *src) template -template +template void -FullMatrix::copy_from (const MATRIX &M) +FullMatrix::copy_from (const MatrixType &M) { this->reinit (M.m(), M.n()); @@ -1217,8 +1217,8 @@ FullMatrix::copy_from (const MATRIX &M) // copy them into the current object for (size_type row = 0; row < M.m(); ++row) { - const typename MATRIX::const_iterator end_row = M.end(row); - for (typename MATRIX::const_iterator entry = M.begin(row); + const typename MatrixType::const_iterator end_row = M.end(row); + for (typename MatrixType::const_iterator entry = M.begin(row); entry != end_row; ++entry) this->el(row, entry->column()) = entry->value(); } @@ -1227,9 +1227,9 @@ FullMatrix::copy_from (const MATRIX &M) template -template +template void -FullMatrix::copy_transposed (const MATRIX &M) +FullMatrix::copy_transposed (const MatrixType &M) { this->reinit (M.n(), M.m()); @@ -1238,8 +1238,8 @@ FullMatrix::copy_transposed (const MATRIX &M) // copy them into the current object for (size_type row = 0; row < M.m(); ++row) { - const typename MATRIX::const_iterator end_row = M.end(row); - for (typename MATRIX::const_iterator entry = M.begin(row); + const typename MatrixType::const_iterator end_row = M.end(row); + for (typename MatrixType::const_iterator entry = M.begin(row); entry != end_row; ++entry) this->el(entry->column(), row) = entry->value(); } @@ -1251,7 +1251,7 @@ template template inline void -FullMatrix::extract_submatrix_from (const MatrixType &matrix, +FullMatrix::extract_submatrix_from (const MatrixType &matrix, const std::vector &row_index_set, const std::vector &column_index_set) { @@ -1274,7 +1274,7 @@ inline void FullMatrix::scatter_matrix_to (const std::vector &row_index_set, const std::vector &column_index_set, - MatrixType &matrix) const + MatrixType &matrix) const { AssertDimension(row_index_set.size(), this->n_rows()); AssertDimension(column_index_set.size(), this->n_cols()); diff --git a/include/deal.II/lac/householder.h b/include/deal.II/lac/householder.h index da3045a128..932c51db32 100644 --- a/include/deal.II/lac/householder.h +++ b/include/deal.II/lac/householder.h @@ -101,7 +101,8 @@ public: const BlockVector &src) const; /** - * A wrapper to least_squares(), implementing the standard MATRIX interface. + * A wrapper to least_squares(), implementing the standard MatrixType + * interface. */ template void vmult (VectorType &dst, const VectorType &src) const; diff --git a/include/deal.II/lac/iterative_inverse.h b/include/deal.II/lac/iterative_inverse.h index 3fd6f6f6f0..53cc554919 100644 --- a/include/deal.II/lac/iterative_inverse.h +++ b/include/deal.II/lac/iterative_inverse.h @@ -83,8 +83,8 @@ public: * Initialization function. Provide a matrix and preconditioner for the * solve in vmult(). */ - template - void initialize (const MATRIX &, const PRECONDITION &); + template + void initialize (const MatrixType &, const PRECONDITION &); /** * Delete the pointers to matrix and preconditioner. @@ -124,10 +124,10 @@ private: template -template +template inline void -IterativeInverse::initialize(const MATRIX &m, const PRECONDITION &p) +IterativeInverse::initialize(const MatrixType &m, const PRECONDITION &p) { // dummy variable VectorType *v = 0; diff --git a/include/deal.II/lac/lapack_full_matrix.h b/include/deal.II/lac/lapack_full_matrix.h index d2b1405226..ecf25ee85f 100644 --- a/include/deal.II/lac/lapack_full_matrix.h +++ b/include/deal.II/lac/lapack_full_matrix.h @@ -124,11 +124,11 @@ public: /** * Assignment from different matrix classes, performing the usual conversion * to the transposed format expected by LAPACK. This assignment operator - * uses iterators of the class MATRIX. Therefore, sparse matrices are + * uses iterators of the typename MatrixType. Therefore, sparse matrices are * possible sources. */ - template - void copy_from (const MATRIX &); + template + void copy_from (const MatrixType &); /** * Regenerate the current matrix by one that has the same properties as if @@ -172,8 +172,8 @@ public: * The final two arguments allow to enter a multiple of the source or its * transpose. */ - template - void fill (const MATRIX &src, + template + void fill (const MatrixType &src, const size_type dst_offset_i = 0, const size_type dst_offset_j = 0, const size_type src_offset_i = 0, @@ -702,9 +702,9 @@ LAPACKFullMatrix::n () const } template -template +template inline void -LAPACKFullMatrix::copy_from (const MATRIX &M) +LAPACKFullMatrix::copy_from (const MatrixType &M) { this->reinit (M.m(), M.n()); @@ -713,8 +713,8 @@ LAPACKFullMatrix::copy_from (const MATRIX &M) // copy them into the current object for (size_type row = 0; row < M.m(); ++row) { - const typename MATRIX::const_iterator end_row = M.end(row); - for (typename MATRIX::const_iterator entry = M.begin(row); + const typename MatrixType::const_iterator end_row = M.end(row); + for (typename MatrixType::const_iterator entry = M.begin(row); entry != end_row; ++entry) this->el(row, entry->column()) = entry->value(); } @@ -725,23 +725,22 @@ LAPACKFullMatrix::copy_from (const MATRIX &M) template -template +template inline void -LAPACKFullMatrix::fill ( - const MATRIX &M, - const size_type dst_offset_i, - const size_type dst_offset_j, - const size_type src_offset_i, - const size_type src_offset_j, - const number factor, - const bool transpose) +LAPACKFullMatrix::fill (const MatrixType &M, + const size_type dst_offset_i, + const size_type dst_offset_j, + const size_type src_offset_i, + const size_type src_offset_j, + const number factor, + const bool transpose) { // loop over the elements of the argument matrix row by row, as suggested // in the documentation of the sparse matrix iterator class for (size_type row = src_offset_i; row < M.m(); ++row) { - const typename MATRIX::const_iterator end_row = M.end(row); - for (typename MATRIX::const_iterator entry = M.begin(row); + const typename MatrixType::const_iterator end_row = M.end(row); + for (typename MatrixType::const_iterator entry = M.begin(row); entry != end_row; ++entry) { const size_type i = transpose ? entry->column() : row; diff --git a/include/deal.II/lac/matrix_block.h b/include/deal.II/lac/matrix_block.h index 59a51810b3..b5a16bc3c2 100644 --- a/include/deal.II/lac/matrix_block.h +++ b/include/deal.II/lac/matrix_block.h @@ -30,13 +30,13 @@ DEAL_II_NAMESPACE_OPEN -template class MatrixBlock; +template class MatrixBlock; namespace internal { - template + template void - reinit(MatrixBlock &v, + reinit(MatrixBlock &v, const BlockSparsityPattern &p); template @@ -65,7 +65,7 @@ namespace internal * * While the add() functions make a MatrixBlock appear like a block matrix for * assembling, the functions vmult(), Tvmult(), vmult_add(), and Tvmult_add() - * make it behave like a MATRIX, when it comes to applying it to a vector. + * make it behave like a MatrixType, when it comes to applying it to a vector. * This behavior allows us to store MatrixBlock objects in vectors, for * instance in MGLevelObject without extracting the #matrix first. * @@ -100,7 +100,7 @@ namespace internal * @ref GlossBlockLA "Block (linear algebra)" * @author Guido Kanschat, 2006 */ -template +template class MatrixBlock : public Subscriptor { @@ -113,7 +113,7 @@ public: /** * Declare a type for matrix entries. */ - typedef typename MATRIX::value_type value_type; + typedef typename MatrixType::value_type value_type; /** * Constructor rendering an uninitialized object. @@ -123,7 +123,7 @@ public: /** * Copy constructor. */ - MatrixBlock(const MatrixBlock &M); + MatrixBlock(const MatrixBlock &M); /** * Constructor setting block coordinates, but not initializing the matrix. @@ -140,16 +140,16 @@ public: */ void reinit(const BlockSparsityPattern &sparsity); - operator MATRIX &(); - operator const MATRIX &() const; + operator MatrixType &(); + operator const MatrixType &() const; /** * Add value to the element (i,j). Throws an error if the * entry does not exist or if it is in a different block. */ - void add (const size_type i, - const size_type j, - const typename MATRIX::value_type value); + void add (const size_type i, + const size_type j, + const typename MatrixType::value_type value); /** * Add all elements in a FullMatrix into sparse matrix locations given by @@ -231,7 +231,7 @@ public: const bool col_indices_are_sorted = false); /** - * Matrix-vector-multiplication, forwarding to the same function in MATRIX. + * Matrix-vector-multiplication, forwarding to the same function in MatrixType. * No index computations are done, thus, the vectors need to have sizes * matching #matrix. */ @@ -239,7 +239,7 @@ public: void vmult (VectorType &w, const VectorType &v) const; /** - * Matrix-vector-multiplication, forwarding to the same function in MATRIX. + * Matrix-vector-multiplication, forwarding to the same function in MatrixType. * No index computations are done, thus, the vectors need to have sizes * matching #matrix. */ @@ -247,7 +247,7 @@ public: void vmult_add (VectorType &w, const VectorType &v) const; /** - * Matrix-vector-multiplication, forwarding to the same function in MATRIX. + * Matrix-vector-multiplication, forwarding to the same function in MatrixType. * No index computations are done, thus, the vectors need to have sizes * matching #matrix. */ @@ -255,7 +255,7 @@ public: void Tvmult (VectorType &w, const VectorType &v) const; /** - * Matrix-vector-multiplication, forwarding to the same function in MATRIX. + * Matrix-vector-multiplication, forwarding to the same function in MatrixType. * No index computations are done, thus, the vectors need to have sizes * matching #matrix. */ @@ -288,7 +288,7 @@ public: /** * The matrix itself */ - MATRIX matrix; + MatrixType matrix; private: /** @@ -303,9 +303,9 @@ private: */ BlockIndices column_indices; - template + template friend - void dealii::internal::reinit(MatrixBlock &, + void dealii::internal::reinit(MatrixBlock &, const BlockSparsityPattern &); template @@ -324,7 +324,7 @@ private: * @ingroup vector_valued * @author Baerbel Janssen, Guido Kanschat, 2010 */ -template +template class MatrixBlockVector : private AnyData @@ -338,7 +338,7 @@ public: /** * The type of object stored. */ - typedef MatrixBlock value_type; + typedef MatrixBlock value_type; /** * The pointer type used for storing the objects. We use a shard pointer, @@ -388,7 +388,7 @@ public: /** * Access the matrix at position i for read and write access. */ - MATRIX &matrix(size_type i); + MatrixType &matrix(size_type i); /** * import functions from private base class @@ -409,7 +409,7 @@ public: * @ingroup vector_valued * @author Baerbel Janssen, Guido Kanschat, 2010 */ -template +template class MGMatrixBlockVector : public Subscriptor { @@ -422,7 +422,7 @@ public: /** * The type of object stored. */ - typedef MGLevelObject > value_type; + typedef MGLevelObject > value_type; /** * Constructor, determining which matrices should be stored. * @@ -567,9 +567,9 @@ private: namespace internal { - template + template void - reinit(MatrixBlock &v, + reinit(MatrixBlock &v, const BlockSparsityPattern &p) { v.row_indices = p.get_row_indices(); @@ -589,18 +589,18 @@ namespace internal } -template +template inline -MatrixBlock::MatrixBlock() +MatrixBlock::MatrixBlock () : row(numbers::invalid_size_type), column(numbers::invalid_size_type) {} -template +template inline -MatrixBlock::MatrixBlock(const MatrixBlock &M) +MatrixBlock::MatrixBlock (const MatrixBlock &M) : Subscriptor(), row(M.row), @@ -611,45 +611,44 @@ MatrixBlock::MatrixBlock(const MatrixBlock &M) {} -template +template inline -MatrixBlock::MatrixBlock(size_type i, size_type j) +MatrixBlock::MatrixBlock (size_type i, size_type j) : row(i), column(j) {} -template +template inline void -MatrixBlock::reinit(const BlockSparsityPattern &sparsity) +MatrixBlock::reinit (const BlockSparsityPattern &sparsity) { internal::reinit(*this, sparsity); } -template +template inline -MatrixBlock::operator MATRIX &() +MatrixBlock::operator MatrixType &() { return matrix; } -template +template inline -MatrixBlock::operator const MATRIX &() const +MatrixBlock::operator const MatrixType &() const { return matrix; } -template +template inline void -MatrixBlock::add ( - const size_type gi, - const size_type gj, - const typename MATRIX::value_type value) +MatrixBlock::add (const size_type gi, + const size_type gj, + const typename MatrixType::value_type value) { Assert(row_indices.size() != 0, ExcNotInitialized()); Assert(column_indices.size() != 0, ExcNotInitialized()); @@ -666,14 +665,14 @@ MatrixBlock::add ( } -template +template template inline void -MatrixBlock::add (const std::vector &r_indices, - const std::vector &c_indices, - const FullMatrix &values, - const bool elide_zero_values) +MatrixBlock::add (const std::vector &r_indices, + const std::vector &c_indices, + const FullMatrix &values, + const bool elide_zero_values) { Assert(row_indices.size() != 0, ExcNotInitialized()); Assert(column_indices.size() != 0, ExcNotInitialized()); @@ -687,16 +686,16 @@ MatrixBlock::add (const std::vector &r_indices, } -template +template template inline void -MatrixBlock::add (const size_type b_row, - const size_type n_cols, - const size_type *col_indices, - const number *values, - const bool, - const bool) +MatrixBlock::add (const size_type b_row, + const size_type n_cols, + const size_type *col_indices, + const number *values, + const bool, + const bool) { Assert(row_indices.size() != 0, ExcNotInitialized()); Assert(column_indices.size() != 0, ExcNotInitialized()); @@ -727,13 +726,13 @@ MatrixBlock::add (const size_type b_row, } -template +template template inline void -MatrixBlock::add (const std::vector &indices, - const FullMatrix &values, - const bool elide_zero_values) +MatrixBlock::add (const std::vector &indices, + const FullMatrix &values, + const bool elide_zero_values) { Assert(row_indices.size() != 0, ExcNotInitialized()); Assert(column_indices.size() != 0, ExcNotInitialized()); @@ -748,14 +747,14 @@ MatrixBlock::add (const std::vector &indices, -template +template template inline void -MatrixBlock::add (const size_type row, - const std::vector &col_indices, - const std::vector &values, - const bool elide_zero_values) +MatrixBlock::add (const size_type row, + const std::vector &col_indices, + const std::vector &values, + const bool elide_zero_values) { Assert(row_indices.size() != 0, ExcNotInitialized()); Assert(column_indices.size() != 0, ExcNotInitialized()); @@ -766,50 +765,50 @@ MatrixBlock::add (const size_type row, } -template +template template inline void -MatrixBlock::vmult (VectorType &w, const VectorType &v) const +MatrixBlock::vmult (VectorType &w, const VectorType &v) const { matrix.vmult(w,v); } -template +template template inline void -MatrixBlock::vmult_add (VectorType &w, const VectorType &v) const +MatrixBlock::vmult_add (VectorType &w, const VectorType &v) const { matrix.vmult_add(w,v); } -template +template template inline void -MatrixBlock::Tvmult (VectorType &w, const VectorType &v) const +MatrixBlock::Tvmult (VectorType &w, const VectorType &v) const { matrix.Tvmult(w,v); } -template +template template inline void -MatrixBlock::Tvmult_add (VectorType &w, const VectorType &v) const +MatrixBlock::Tvmult_add (VectorType &w, const VectorType &v) const { matrix.Tvmult_add(w,v); } -template +template inline std::size_t -MatrixBlock::memory_consumption () const +MatrixBlock::memory_consumption () const { return (sizeof(*this) + MemoryConsumption::memory_consumption(matrix) @@ -818,20 +817,20 @@ MatrixBlock::memory_consumption () const //----------------------------------------------------------------------// -template +template inline void -MatrixBlockVector::add( - size_type row, size_type column, - const std::string &name) +MatrixBlockVector::add(size_type row, + size_type column, + const std::string &name) { ptr_type p(new value_type(row, column)); AnyData::add(p, name); } -template +template inline void -MatrixBlockVector::reinit(const BlockSparsityPattern &sparsity) +MatrixBlockVector::reinit (const BlockSparsityPattern &sparsity) { for (size_type i=0; isize(); ++i) { @@ -840,9 +839,9 @@ MatrixBlockVector::reinit(const BlockSparsityPattern &sparsity) } -template +template inline void -MatrixBlockVector::clear(bool really_clean) +MatrixBlockVector::clear (bool really_clean) { if (really_clean) { @@ -857,25 +856,25 @@ MatrixBlockVector::clear(bool really_clean) -template -inline const MatrixBlock & -MatrixBlockVector::block(size_type i) const +template +inline const MatrixBlock & +MatrixBlockVector::block (size_type i) const { return *this->read(i); } -template -inline MatrixBlock & -MatrixBlockVector::block(size_type i) +template +inline MatrixBlock & +MatrixBlockVector::block (size_type i) { return *this->entry(i); } -template -inline MATRIX & -MatrixBlockVector::matrix(size_type i) +template +inline MatrixType & +MatrixBlockVector::matrix (size_type i) { return this->entry(i)->matrix; } @@ -884,32 +883,31 @@ MatrixBlockVector::matrix(size_type i) //----------------------------------------------------------------------// -template +template inline -MGMatrixBlockVector::MGMatrixBlockVector( - const bool e, const bool f) +MGMatrixBlockVector::MGMatrixBlockVector(const bool e, const bool f) : edge_matrices(e), edge_flux_matrices(f) {} -template +template inline unsigned int -MGMatrixBlockVector::size () const +MGMatrixBlockVector::size () const { return matrices.size(); } -template +template inline void -MGMatrixBlockVector::add( +MGMatrixBlockVector::add( size_type row, size_type column, const std::string &name) { - MGLevelObject > p(0, 1); + MGLevelObject > p(0, 1); p[0].row = row; p[0].column = column; @@ -927,93 +925,93 @@ MGMatrixBlockVector::add( } -template -inline const MGLevelObject > & -MGMatrixBlockVector::block(size_type i) const +template +inline const MGLevelObject > & +MGMatrixBlockVector::block(size_type i) const { - return *matrices.read* >(i); + return *matrices.read* >(i); } -template -inline MGLevelObject > & -MGMatrixBlockVector::block(size_type i) +template +inline MGLevelObject > & +MGMatrixBlockVector::block(size_type i) { - return *matrices.entry* >(i); + return *matrices.entry* >(i); } -template -inline const MGLevelObject > & -MGMatrixBlockVector::block_in(size_type i) const +template +inline const MGLevelObject > & +MGMatrixBlockVector::block_in(size_type i) const { - return *matrices_in.read* >(i); + return *matrices_in.read* >(i); } -template -inline MGLevelObject > & -MGMatrixBlockVector::block_in(size_type i) +template +inline MGLevelObject > & +MGMatrixBlockVector::block_in(size_type i) { - return *matrices_in.entry* >(i); + return *matrices_in.entry* >(i); } -template -inline const MGLevelObject > & -MGMatrixBlockVector::block_out(size_type i) const +template +inline const MGLevelObject > & +MGMatrixBlockVector::block_out(size_type i) const { - return *matrices_out.read* >(i); + return *matrices_out.read* >(i); } -template -inline MGLevelObject > & -MGMatrixBlockVector::block_out(size_type i) +template +inline MGLevelObject > & +MGMatrixBlockVector::block_out(size_type i) { - return *matrices_out.entry* >(i); + return *matrices_out.entry* >(i); } -template -inline const MGLevelObject > & -MGMatrixBlockVector::block_up(size_type i) const +template +inline const MGLevelObject > & +MGMatrixBlockVector::block_up(size_type i) const { - return *flux_matrices_up.read* >(i); + return *flux_matrices_up.read* >(i); } -template -inline MGLevelObject > & -MGMatrixBlockVector::block_up(size_type i) +template +inline MGLevelObject > & +MGMatrixBlockVector::block_up(size_type i) { - return *flux_matrices_up.entry* >(i); + return *flux_matrices_up.entry* >(i); } -template -inline const MGLevelObject > & -MGMatrixBlockVector::block_down(size_type i) const +template +inline const MGLevelObject > & +MGMatrixBlockVector::block_down(size_type i) const { - return *flux_matrices_down.read* >(i); + return *flux_matrices_down.read* >(i); } -template -inline MGLevelObject > & -MGMatrixBlockVector::block_down(size_type i) +template +inline MGLevelObject > & +MGMatrixBlockVector::block_down(size_type i) { - return *flux_matrices_down.entry* >(i); + return *flux_matrices_down.entry* >(i); } -template +template inline void -MGMatrixBlockVector::reinit_matrix(const MGLevelObject &sparsity) +MGMatrixBlockVector::reinit_matrix(const MGLevelObject &sparsity) { for (size_type i=0; isize(); ++i) { - MGLevelObject > &o = block(i); + MGLevelObject > &o = block(i); const size_type row = o[o.min_level()].row; const size_type col = o[o.min_level()].column; @@ -1028,13 +1026,13 @@ MGMatrixBlockVector::reinit_matrix(const MGLevelObject +template inline void -MGMatrixBlockVector::reinit_edge(const MGLevelObject &sparsity) +MGMatrixBlockVector::reinit_edge(const MGLevelObject &sparsity) { for (size_type i=0; isize(); ++i) { - MGLevelObject > &o = block(i); + MGLevelObject > &o = block(i); const size_type row = o[o.min_level()].row; const size_type col = o[o.min_level()].column; @@ -1053,13 +1051,14 @@ MGMatrixBlockVector::reinit_edge(const MGLevelObject +template inline void -MGMatrixBlockVector::reinit_edge_flux(const MGLevelObject &sparsity) +MGMatrixBlockVector::reinit_edge_flux +(const MGLevelObject &sparsity) { for (size_type i=0; isize(); ++i) { - MGLevelObject > &o = block(i); + MGLevelObject > &o = block(i); const size_type row = o[o.min_level()].row; const size_type col = o[o.min_level()].column; @@ -1079,22 +1078,22 @@ MGMatrixBlockVector::reinit_edge_flux(const MGLevelObject +template inline void -MGMatrixBlockVector::clear_object(AnyData &mo) +MGMatrixBlockVector::clear_object (AnyData &mo) { for (size_type i=0; i > &o = mo.entry* >(i); + MGLevelObject > &o = mo.entry* >(i); for (size_type level = o.min_level(); level <= o.max_level(); ++level) o[level].matrix.clear(); } } -template +template inline void -MGMatrixBlockVector::clear(bool really_clean) +MGMatrixBlockVector::clear (bool really_clean) { if (really_clean) { diff --git a/include/deal.II/lac/matrix_lib.h b/include/deal.II/lac/matrix_lib.h index 9ccd73b2a0..adcc672693 100644 --- a/include/deal.II/lac/matrix_lib.h +++ b/include/deal.II/lac/matrix_lib.h @@ -71,9 +71,9 @@ public: * 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, + template + ProductMatrix (const MatrixType1 &m1, + const MatrixType2 &m2, VectorMemory &mem); /** @@ -84,15 +84,16 @@ public: /** * Change the matrices. */ - template - void reinit(const MATRIX1 &m1, const MATRIX2 &m2); + template + void reinit (const MatrixType1 &m1, const MatrixType2 &m2); /** * Change the matrices and memory pool. */ - template - void initialize(const MATRIX1 &m1, const MATRIX2 &m2, - VectorMemory &mem); + template + void initialize (const MatrixType1 &m1, + const MatrixType2 &m2, + VectorMemory &mem); // Doc in PointerMatrixBase void clear(); @@ -165,8 +166,8 @@ public: /** * Constructor with initialization. */ - template - ScaledMatrix (const MATRIX &M, const double factor); + template + ScaledMatrix (const MatrixType &M, const double factor); /** * Destructor @@ -175,8 +176,8 @@ public: /** * Initialize for use with a new matrix and factor. */ - template - void initialize (const MATRIX &M, const double factor); + template + void initialize (const MatrixType &M, const double factor); /** * Reset the object to its original state. @@ -448,8 +449,8 @@ public: * Initialization function. Provide a solver object, a matrix, and another * preconditioner for this. */ - template - void initialize (const MATRIX &, + template + void initialize (const MatrixType &, const PRECONDITION &); /** @@ -515,9 +516,9 @@ ScaledMatrix::ScaledMatrix() template -template +template inline -ScaledMatrix::ScaledMatrix(const MATRIX &mat, const double factor) +ScaledMatrix::ScaledMatrix(const MatrixType &mat, const double factor) : m(new_pointer_matrix_base(mat, VectorType())), factor(factor) @@ -526,10 +527,10 @@ ScaledMatrix::ScaledMatrix(const MATRIX &mat, const double factor) template -template +template inline void -ScaledMatrix::initialize(const MATRIX &mat, const double f) +ScaledMatrix::initialize(const MatrixType &mat, const double f) { if (m) delete m; m = new_pointer_matrix_base(mat, VectorType()); @@ -592,41 +593,41 @@ ProductMatrix::ProductMatrix (VectorMemory &m) template -template -ProductMatrix::ProductMatrix (const MATRIX1 &mat1, - const MATRIX2 &mat2, +template +ProductMatrix::ProductMatrix (const MatrixType1 &mat1, + const MatrixType2 &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 MatrixType1 &mat1, const MatrixType2 &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, +ProductMatrix::initialize (const MatrixType1 &mat1, + const MatrixType2 &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()); } @@ -734,13 +735,13 @@ MeanValueFilter::Tvmult_add(VectorType &, const VectorType &) const //-----------------------------------------------------------------------// template -template +template inline void -InverseMatrixRichardson::initialize (const MATRIX &m, const PRECONDITION &p) +InverseMatrixRichardson::initialize (const MatrixType &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); diff --git a/include/deal.II/lac/parpack_solver.h b/include/deal.II/lac/parpack_solver.h index 5da03105c2..9f0a359938 100644 --- a/include/deal.II/lac/parpack_solver.h +++ b/include/deal.II/lac/parpack_solver.h @@ -159,7 +159,7 @@ public: /** * Auxiliary class to represent A-sigma*B operator. */ - template + template class Shift : public dealii::Subscriptor { public: @@ -167,9 +167,9 @@ public: /** * Constructor. */ - Shift (const MATRIX &A, - const MATRIX &B, - const double sigma) + Shift (const MatrixType &A, + const MatrixType &B, + const double sigma) : A(A), B(B), @@ -197,8 +197,8 @@ public: } private: - const MATRIX &A; - const MATRIX &B; + const MatrixType &A; + const MatrixType &B; const double sigma; }; @@ -244,15 +244,15 @@ public: * calling the pd(n/s)eupd and pd(n/s)aupd * functions of PARPACK. */ - template + template void solve - (const MATRIX1 &A, - const MATRIX2 &B, + (const MatrixType1 &A, + const MatrixType2 &B, const INVERSE &inverse, std::vector > &eigenvalues, std::vector &eigenvectors, - const unsigned int n_eigenvalues); + const unsigned int n_eigenvalues); std::size_t memory_consumption() const; @@ -517,14 +517,14 @@ void PArpackSolver::reinit(const dealii::IndexSet &locally_owned_dof } template -template +template void PArpackSolver::solve -(const MATRIX1 &/*system_matrix*/, - const MATRIX2 &mass_matrix, +(const MatrixType1 &/*system_matrix*/, + const MatrixType2 &mass_matrix, const INVERSE &inverse, std::vector > &eigenvalues, std::vector &eigenvectors, - const unsigned int n_eigenvalues) + const unsigned int n_eigenvalues) { Assert (n_eigenvalues <= eigenvectors.size(), diff --git a/include/deal.II/lac/pointer_matrix.h b/include/deal.II/lac/pointer_matrix.h index ed0088c0ee..d778c60b28 100644 --- a/include/deal.II/lac/pointer_matrix.h +++ b/include/deal.II/lac/pointer_matrix.h @@ -109,7 +109,7 @@ public: * * @author Guido Kanschat 2000, 2001, 2002 */ -template +template class PointerMatrix : public PointerMatrixBase { public: @@ -120,7 +120,7 @@ public: * * If M is zero, no matrix is stored. */ - PointerMatrix (const MATRIX *M=0); + PointerMatrix (const MatrixType *M=0); /** * Constructor. @@ -145,7 +145,7 @@ public: * argument to this function is used to this end, i.e., you can in essence * assign a name to the current PointerMatrix object. */ - PointerMatrix(const MATRIX *M, + PointerMatrix(const MatrixType *M, const char *name); // Use doc from base class @@ -161,7 +161,7 @@ public: * matrix. * @see SmartPointer */ - const PointerMatrix &operator= (const MATRIX *M); + const PointerMatrix &operator= (const MatrixType *M); /** * Matrix-vector product. @@ -191,7 +191,7 @@ private: /** * The pointer to the actual matrix. */ - SmartPointer > m; + SmartPointer > m; }; @@ -205,11 +205,11 @@ private: * * This class differs form PointerMatrix by its additional VectorMemory object * and by the fact that it implements the functions vmult_add() and - * Tvmult_add() only using vmult() and Tvmult() of the MATRIX. + * Tvmult_add() only using vmult() and Tvmult() of the MatrixType. * * @author Guido Kanschat 2006 */ -template +template class PointerMatrixAux : public PointerMatrixBase { public: @@ -223,7 +223,7 @@ public: * If mem is zero, then GrowingVectorMemory is used. */ PointerMatrixAux (VectorMemory *mem = 0, - const MATRIX *M=0); + const MatrixType *M = 0); /** * Constructor not using a matrix. @@ -250,7 +250,7 @@ public: * assign a name to the current PointerMatrix object. */ PointerMatrixAux(VectorMemory *mem, - const MATRIX *M, + const MatrixType *M, const char *name); // Use doc from base class @@ -271,7 +271,7 @@ public: * matrix. * @see SmartPointer */ - const PointerMatrixAux &operator= (const MATRIX *M); + const PointerMatrixAux &operator= (const MatrixType *M); /** * Matrix-vector product. @@ -306,12 +306,12 @@ private: /** * Object for getting the auxiliary vector. */ - mutable SmartPointer,PointerMatrixAux > mem; + mutable SmartPointer,PointerMatrixAux > mem; /** * The pointer to the actual matrix. */ - SmartPointer > m; + SmartPointer > m; }; @@ -444,12 +444,12 @@ private: * * @relates PointerMatrixBase @relates PointerMatrixAux */ -template +template inline PointerMatrixBase * -new_pointer_matrix_base(MATRIX &matrix, const VectorType &, const char *name = "PointerMatrixAux") +new_pointer_matrix_base(MatrixType &matrix, const VectorType &, const char *name = "PointerMatrixAux") { - return new PointerMatrixAux(0, &matrix, name); + return new PointerMatrixAux(0, &matrix, name); } /** @@ -583,85 +583,85 @@ PointerMatrixBase::~PointerMatrixBase () //----------------------------------------------------------------------// -template -PointerMatrix::PointerMatrix (const MATRIX *M) +template +PointerMatrix::PointerMatrix (const MatrixType *M) : m(M, typeid(*this).name()) {} -template -PointerMatrix::PointerMatrix (const char *name) +template +PointerMatrix::PointerMatrix (const char *name) : m(0, name) {} -template -PointerMatrix::PointerMatrix (const MATRIX *M, - const char *name) +template +PointerMatrix::PointerMatrix (const MatrixType *M, + const char *name) : m(M, name) {} -template +template inline void -PointerMatrix::clear () +PointerMatrix::clear () { m = 0; } -template -inline const PointerMatrix & -PointerMatrix::operator= (const MATRIX *M) +template +inline const PointerMatrix & +PointerMatrix::operator= (const MatrixType *M) { m = M; return *this; } -template +template inline bool -PointerMatrix::empty () const +PointerMatrix::empty () const { if (m == 0) return true; return m->empty(); } -template +template inline void -PointerMatrix::vmult (VectorType &dst, - const VectorType &src) const +PointerMatrix::vmult (VectorType &dst, + const VectorType &src) const { Assert (m != 0, ExcNotInitialized()); m->vmult (dst, src); } -template +template inline void -PointerMatrix::Tvmult (VectorType &dst, - const VectorType &src) const +PointerMatrix::Tvmult (VectorType &dst, + const VectorType &src) const { Assert (m != 0, ExcNotInitialized()); m->Tvmult (dst, src); } -template +template inline void -PointerMatrix::vmult_add (VectorType &dst, - const VectorType &src) const +PointerMatrix::vmult_add (VectorType &dst, + const VectorType &src) const { Assert (m != 0, ExcNotInitialized()); m->vmult_add (dst, src); } -template +template inline void -PointerMatrix::Tvmult_add (VectorType &dst, - const VectorType &src) const +PointerMatrix::Tvmult_add (VectorType &dst, + const VectorType &src) const { Assert (m != 0, ExcNotInitialized()); m->Tvmult_add (dst, src); @@ -672,10 +672,9 @@ PointerMatrix::Tvmult_add (VectorType &dst, //----------------------------------------------------------------------// -template -PointerMatrixAux::PointerMatrixAux ( - VectorMemory *mem, - const MATRIX *M) +template +PointerMatrixAux::PointerMatrixAux (VectorMemory *mem, + const MatrixType *M) : mem(mem, typeid(*this).name()), m(M, typeid(*this).name()) { @@ -683,10 +682,9 @@ PointerMatrixAux::PointerMatrixAux ( } -template -PointerMatrixAux::PointerMatrixAux ( - VectorMemory *mem, - const char *name) +template +PointerMatrixAux::PointerMatrixAux (VectorMemory *mem, + const char *name) : mem(mem, name), m(0, name) { @@ -694,11 +692,10 @@ PointerMatrixAux::PointerMatrixAux ( } -template -PointerMatrixAux::PointerMatrixAux ( - VectorMemory *mem, - const MATRIX *M, - const char *name) +template +PointerMatrixAux::PointerMatrixAux (VectorMemory *mem, + const MatrixType *M, + const char *name) : mem(mem, name), m(M, name) { @@ -706,26 +703,26 @@ PointerMatrixAux::PointerMatrixAux ( } -template +template inline void -PointerMatrixAux::clear () +PointerMatrixAux::clear () { m = 0; } -template -inline const PointerMatrixAux & -PointerMatrixAux::operator= (const MATRIX *M) +template +inline const PointerMatrixAux & +PointerMatrixAux::operator= (const MatrixType *M) { m = M; return *this; } -template +template inline void -PointerMatrixAux::set_memory(VectorMemory *M) +PointerMatrixAux::set_memory(VectorMemory *M) { mem = M; if (mem == 0) @@ -733,18 +730,18 @@ PointerMatrixAux::set_memory(VectorMemory *M) } -template +template inline bool -PointerMatrixAux::empty () const +PointerMatrixAux::empty () const { if (m == 0) return true; return m->empty(); } -template +template inline void -PointerMatrixAux::vmult (VectorType &dst, +PointerMatrixAux::vmult (VectorType &dst, const VectorType &src) const { if (mem == 0) @@ -755,9 +752,9 @@ PointerMatrixAux::vmult (VectorType &dst, } -template +template inline void -PointerMatrixAux::Tvmult (VectorType &dst, +PointerMatrixAux::Tvmult (VectorType &dst, const VectorType &src) const { if (mem == 0) @@ -768,9 +765,9 @@ PointerMatrixAux::Tvmult (VectorType &dst, } -template +template inline void -PointerMatrixAux::vmult_add (VectorType &dst, +PointerMatrixAux::vmult_add (VectorType &dst, const VectorType &src) const { if (mem == 0) @@ -785,9 +782,9 @@ PointerMatrixAux::vmult_add (VectorType &dst, } -template +template inline void -PointerMatrixAux::Tvmult_add (VectorType &dst, +PointerMatrixAux::Tvmult_add (VectorType &dst, const VectorType &src) const { if (mem == 0) @@ -818,9 +815,8 @@ PointerMatrixVector::PointerMatrixVector (const char *name) template -PointerMatrixVector::PointerMatrixVector ( - const Vector *M, - const char *name) +PointerMatrixVector::PointerMatrixVector (const Vector *M, + const char *name) : m(M, name) {} @@ -853,9 +849,8 @@ PointerMatrixVector::empty () const template inline void -PointerMatrixVector::vmult ( - Vector &dst, - const Vector &src) const +PointerMatrixVector::vmult (Vector &dst, + const Vector &src) const { Assert (m != 0, ExcNotInitialized()); Assert (dst.size() == 1, ExcDimensionMismatch(dst.size(), 1)); @@ -866,9 +861,8 @@ PointerMatrixVector::vmult ( template inline void -PointerMatrixVector::Tvmult ( - Vector &dst, - const Vector &src) const +PointerMatrixVector::Tvmult (Vector &dst, + const Vector &src) const { Assert (m != 0, ExcNotInitialized()); Assert(src.size() == 1, ExcDimensionMismatch(src.size(), 1)); @@ -879,9 +873,8 @@ PointerMatrixVector::Tvmult ( template inline void -PointerMatrixVector::vmult_add ( - Vector &dst, - const Vector &src) const +PointerMatrixVector::vmult_add (Vector &dst, + const Vector &src) const { Assert (m != 0, ExcNotInitialized()); Assert (dst.size() == 1, ExcDimensionMismatch(dst.size(), 1)); @@ -892,9 +885,8 @@ PointerMatrixVector::vmult_add ( template inline void -PointerMatrixVector::Tvmult_add ( - Vector &dst, - const Vector &src) const +PointerMatrixVector::Tvmult_add (Vector &dst, + const Vector &src) const { Assert (m != 0, ExcNotInitialized()); Assert(src.size() == 1, ExcDimensionMismatch(src.size(), 1)); diff --git a/include/deal.II/lac/precondition.h b/include/deal.II/lac/precondition.h index f806b60733..c55d6ec85e 100644 --- a/include/deal.II/lac/precondition.h +++ b/include/deal.II/lac/precondition.h @@ -98,8 +98,8 @@ public: * The matrix argument is ignored and here just for compatibility with more * complex preconditioners. */ - template - void initialize (const MATRIX &matrix, + template + void initialize (const MatrixType &matrix, const AdditionalData &additional_data = AdditionalData()); /** @@ -221,8 +221,8 @@ public: * preconditioners. The matrix argument is ignored and here just for * compatibility with more complex preconditioners. */ - template - void initialize (const MATRIX &matrix, + template + void initialize (const MatrixType &matrix, const AdditionalData ¶meters); /** @@ -333,21 +333,21 @@ private: * * @author Guido Kanschat, Wolfgang Bangerth, 1999 */ -template, class VectorType = Vector > +template, class VectorType = Vector > class PreconditionUseMatrix : public Subscriptor { public: /** * Type of the preconditioning function of the matrix. */ - typedef void ( MATRIX::* function_ptr)(VectorType &, const VectorType &) const; + typedef void ( MatrixType::* function_ptr)(VectorType &, const VectorType &) const; /** * Constructor. This constructor stores a reference to the matrix object * for later use and selects a preconditioning method, which must be a * member function of that matrix. */ - PreconditionUseMatrix(const MATRIX &M, + PreconditionUseMatrix(const MatrixType &M, const function_ptr method); /** @@ -361,7 +361,7 @@ private: /** * Pointer to the matrix in use. */ - const MATRIX &matrix; + const MatrixType &matrix; /** * Pointer to the preconditioning function. @@ -379,14 +379,14 @@ private: * @author Guido Kanschat, 2000; extension for full compatibility with * LinearOperator class: Jean-Paul Pelteret, 2015 */ -template > +template > class PreconditionRelaxation : public Subscriptor { public: /** * Declare type for container size. */ - typedef typename MATRIX::size_type size_type; + typedef typename MatrixType::size_type size_type; /** * Class for parameters. @@ -410,7 +410,7 @@ public: * the preconditioner object. The relaxation parameter should be larger than * zero and smaller than 2 for numerical reasons. It defaults to 1. */ - void initialize (const MATRIX &A, + void initialize (const MatrixType &A, const AdditionalData ¶meters = AdditionalData()); /** @@ -434,7 +434,7 @@ protected: /** * Pointer to the matrix object. */ - SmartPointer > A; + SmartPointer > A; /** * Relaxation parameter. @@ -445,7 +445,7 @@ protected: /** - * Jacobi preconditioner using matrix built-in function. The MATRIX + * Jacobi preconditioner using matrix built-in function. The MatrixType * class used is required to have a function precondition_Jacobi(VectorType&, * const VectorType&, double) * @@ -469,8 +469,8 @@ protected: * * @author Guido Kanschat, 2000 */ -template > -class PreconditionJacobi : public PreconditionRelaxation +template > +class PreconditionJacobi : public PreconditionRelaxation { public: /** @@ -520,7 +520,7 @@ public: * Using the right hand side b and the previous iterate x, this * is the operation implemented by step(). * - * The MATRIX class used is required to have functions + * The MatrixType class used is required to have functions * precondition_SOR(VectorType&, const VectorType&, double) and * precondition_TSOR(VectorType&, const VectorType&, double). * @@ -544,8 +544,8 @@ public: * * @author Guido Kanschat, 2000 */ -template > -class PreconditionSOR : public PreconditionRelaxation +template > +class PreconditionSOR : public PreconditionRelaxation { public: /** @@ -576,7 +576,7 @@ public: /** - * SSOR preconditioner using matrix built-in function. The MATRIX + * SSOR preconditioner using matrix built-in function. The MatrixType * class used is required to have a function precondition_SSOR(VectorType&, * const VectorType&, double) * @@ -600,19 +600,19 @@ public: * * @author Guido Kanschat, 2000 */ -template > -class PreconditionSSOR : public PreconditionRelaxation +template > +class PreconditionSSOR : public PreconditionRelaxation { public: /** * Declare type for container size. */ - typedef typename MATRIX::size_type size_type; + typedef typename MatrixType::size_type size_type; /** * A typedef to the base class. */ - typedef PreconditionRelaxation BaseClass; + typedef PreconditionRelaxation BaseClass; /** @@ -620,7 +620,7 @@ public: * the preconditioner object. The relaxation parameter should be larger than * zero and smaller than 2 for numerical reasons. It defaults to 1. */ - void initialize (const MATRIX &A, + void initialize (const MatrixType &A, const typename BaseClass::AdditionalData ¶meters = typename BaseClass::AdditionalData()); /** @@ -660,7 +660,7 @@ private: /** * Permuted SOR preconditioner using matrix built-in function. The - * MATRIX class used is required to have functions PSOR(VectorType&, + * MatrixType class used is required to have functions PSOR(VectorType&, * const VectorType&, double) and TPSOR(VectorType&, const VectorType&, * double). * @@ -690,14 +690,14 @@ private: * @author Guido Kanschat, 2003; extension for full compatibility with * LinearOperator class: Jean-Paul Pelteret, 2015 */ -template > -class PreconditionPSOR : public PreconditionRelaxation +template > +class PreconditionPSOR : public PreconditionRelaxation { public: /** * Declare type for container size. */ - typedef typename MATRIX::size_type size_type; + typedef typename MatrixType::size_type size_type; /** * Parameters for PreconditionPSOR. @@ -717,8 +717,8 @@ public: */ AdditionalData (const std::vector &permutation, const std::vector &inverse_permutation, - const typename PreconditionRelaxation::AdditionalData - ¶meters = typename PreconditionRelaxation::AdditionalData()); + const typename PreconditionRelaxation::AdditionalData + ¶meters = typename PreconditionRelaxation::AdditionalData()); /** * Storage for the permutation vector. @@ -731,7 +731,7 @@ public: /** * Relaxation parameters */ - typename PreconditionRelaxation::AdditionalData parameters; + typename PreconditionRelaxation::AdditionalData parameters; }; /** @@ -745,11 +745,11 @@ public: * The relaxation parameter should be larger than zero and smaller than 2 * for numerical reasons. It defaults to 1. */ - void initialize (const MATRIX &A, + void initialize (const MatrixType &A, const std::vector &permutation, const std::vector &inverse_permutation, - const typename PreconditionRelaxation::AdditionalData & - parameters = typename PreconditionRelaxation::AdditionalData()); + const typename PreconditionRelaxation::AdditionalData & + parameters = typename PreconditionRelaxation::AdditionalData()); /** * Initialize matrix and relaxation parameter. The matrix is just stored in @@ -761,7 +761,7 @@ public: * After this function is called the preconditioner is ready to be used * (using the vmult function of derived classes). */ - void initialize (const MATRIX &A, + void initialize (const MatrixType &A, const AdditionalData &additional_data); /** @@ -803,7 +803,7 @@ private: * @author Martin Kronbichler, 2009; extension for full compatibility with * LinearOperator class: Jean-Paul Pelteret, 2015 */ -template , class VectorType=Vector > +template , class VectorType=Vector > class PreconditionChebyshev : public Subscriptor { public: @@ -899,7 +899,7 @@ public: * matrix weighted by its diagonal using a modified CG iteration in case the * given number of iterations is positive. */ - void initialize (const MATRIX &matrix, + void initialize (const MatrixType &matrix, const AdditionalData &additional_data = AdditionalData()); /** @@ -938,7 +938,7 @@ private: /** * A pointer to the underlying matrix. */ - SmartPointer > matrix_ptr; + SmartPointer > matrix_ptr; /** * Internal vector used for the vmult operation. @@ -986,11 +986,10 @@ PreconditionIdentity::PreconditionIdentity () n_columns (0) {} -template +template inline void -PreconditionIdentity::initialize ( - const MATRIX &matrix, - const PreconditionIdentity::AdditionalData &) +PreconditionIdentity::initialize (const MatrixType &matrix, + const PreconditionIdentity::AdditionalData &) { n_rows = matrix.m(); n_columns = matrix.n(); @@ -1046,8 +1045,7 @@ PreconditionIdentity::n () const //--------------------------------------------------------------------------- inline -PreconditionRichardson::AdditionalData::AdditionalData ( - const double relaxation) +PreconditionRichardson::AdditionalData::AdditionalData (const double relaxation) : relaxation(relaxation) {} @@ -1067,19 +1065,19 @@ PreconditionRichardson::PreconditionRichardson () inline void -PreconditionRichardson::initialize ( - const PreconditionRichardson::AdditionalData ¶meters) +PreconditionRichardson::initialize +(const PreconditionRichardson::AdditionalData ¶meters) { relaxation = parameters.relaxation; } -template +template inline void -PreconditionRichardson::initialize ( - const MATRIX &matrix, - const PreconditionRichardson::AdditionalData ¶meters) +PreconditionRichardson::initialize +(const MatrixType &matrix, + const PreconditionRichardson::AdditionalData ¶meters) { relaxation = parameters.relaxation; n_rows = matrix.m(); @@ -1160,34 +1158,34 @@ PreconditionRichardson::n () const //--------------------------------------------------------------------------- -template +template inline void -PreconditionRelaxation::initialize (const MATRIX &rA, - const AdditionalData ¶meters) +PreconditionRelaxation::initialize (const MatrixType &rA, + const AdditionalData ¶meters) { A = &rA; relaxation = parameters.relaxation; } -template +template inline void -PreconditionRelaxation::clear () +PreconditionRelaxation::clear () { A = 0; } -template -inline typename PreconditionRelaxation::size_type -PreconditionRelaxation::m () const +template +inline typename PreconditionRelaxation::size_type +PreconditionRelaxation::m () const { Assert (A!=0, ExcNotInitialized()); return A->m(); } -template -inline typename PreconditionRelaxation::size_type -PreconditionRelaxation::n () const +template +inline typename PreconditionRelaxation::size_type +PreconditionRelaxation::n () const { Assert (A!=0, ExcNotInitialized()); return A->n(); @@ -1195,14 +1193,14 @@ PreconditionRelaxation::n () const //--------------------------------------------------------------------------- -template +template template inline void -PreconditionJacobi::vmult (VectorType &dst, const VectorType &src) const +PreconditionJacobi::vmult (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VectorType::size_type>::value, + std::is_same::size_type, typename VectorType::size_type>::value, "PreconditionJacobi and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 @@ -1212,14 +1210,14 @@ PreconditionJacobi::vmult (VectorType &dst, const VectorType &src) const -template +template template inline void -PreconditionJacobi::Tvmult (VectorType &dst, const VectorType &src) const +PreconditionJacobi::Tvmult (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VectorType::size_type>::value, + std::is_same::size_type, typename VectorType::size_type>::value, "PreconditionJacobi and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 @@ -1229,14 +1227,14 @@ PreconditionJacobi::Tvmult (VectorType &dst, const VectorType &src) cons -template +template template inline void -PreconditionJacobi::step (VectorType &dst, const VectorType &src) const +PreconditionJacobi::step (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VectorType::size_type>::value, + std::is_same::size_type, typename VectorType::size_type>::value, "PreconditionJacobi and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 @@ -1246,14 +1244,14 @@ PreconditionJacobi::step (VectorType &dst, const VectorType &src) const -template +template template inline void -PreconditionJacobi::Tstep (VectorType &dst, const VectorType &src) const +PreconditionJacobi::Tstep (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VectorType::size_type>::value, + std::is_same::size_type, typename VectorType::size_type>::value, "PreconditionJacobi and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 @@ -1264,14 +1262,14 @@ PreconditionJacobi::Tstep (VectorType &dst, const VectorType &src) const //--------------------------------------------------------------------------- -template +template template inline void -PreconditionSOR::vmult (VectorType &dst, const VectorType &src) const +PreconditionSOR::vmult (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VectorType::size_type>::value, + std::is_same::size_type, typename VectorType::size_type>::value, "PreconditionSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 @@ -1281,14 +1279,14 @@ PreconditionSOR::vmult (VectorType &dst, const VectorType &src) const -template +template template inline void -PreconditionSOR::Tvmult (VectorType &dst, const VectorType &src) const +PreconditionSOR::Tvmult (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VectorType::size_type>::value, + std::is_same::size_type, typename VectorType::size_type>::value, "PreconditionSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 @@ -1298,14 +1296,14 @@ PreconditionSOR::Tvmult (VectorType &dst, const VectorType &src) const -template +template template inline void -PreconditionSOR::step (VectorType &dst, const VectorType &src) const +PreconditionSOR::step (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VectorType::size_type>::value, + std::is_same::size_type, typename VectorType::size_type>::value, "PreconditionSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 @@ -1315,14 +1313,14 @@ PreconditionSOR::step (VectorType &dst, const VectorType &src) const -template +template template inline void -PreconditionSOR::Tstep (VectorType &dst, const VectorType &src) const +PreconditionSOR::Tstep (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VectorType::size_type>::value, + std::is_same::size_type, typename VectorType::size_type>::value, "PreconditionSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 @@ -1334,17 +1332,17 @@ PreconditionSOR::Tstep (VectorType &dst, const VectorType &src) const //--------------------------------------------------------------------------- -template +template inline void -PreconditionSSOR::initialize (const MATRIX &rA, +PreconditionSSOR::initialize (const MatrixType &rA, const typename BaseClass::AdditionalData ¶meters) { - this->PreconditionRelaxation::initialize (rA, parameters); + this->PreconditionRelaxation::initialize (rA, parameters); // in case we have a SparseMatrix class, we can extract information about // the diagonal. - const SparseMatrix *mat = - dynamic_cast *>(&*this->A); + const SparseMatrix *mat = + dynamic_cast *>(&*this->A); // calculate the positions first after the diagonal. if (mat != 0) @@ -1357,7 +1355,7 @@ PreconditionSSOR::initialize (const MATRIX &rA, // diagonal. we need to precondition with the elements on the left // only. note: the first entry in each line denotes the diagonal // element, which we need not check. - typename SparseMatrix::const_iterator + typename SparseMatrix::const_iterator it = mat->begin(row)+1; for ( ; it < mat->end(row); ++it) if (it->column() > row) @@ -1368,14 +1366,14 @@ PreconditionSSOR::initialize (const MATRIX &rA, } -template +template template inline void -PreconditionSSOR::vmult (VectorType &dst, const VectorType &src) const +PreconditionSSOR::vmult (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VectorType::size_type>::value, + std::is_same::size_type, typename VectorType::size_type>::value, "PreconditionSSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 @@ -1385,14 +1383,14 @@ PreconditionSSOR::vmult (VectorType &dst, const VectorType &src) const -template +template template inline void -PreconditionSSOR::Tvmult (VectorType &dst, const VectorType &src) const +PreconditionSSOR::Tvmult (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VectorType::size_type>::value, + std::is_same::size_type, typename VectorType::size_type>::value, "PreconditionSSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 @@ -1402,14 +1400,14 @@ PreconditionSSOR::Tvmult (VectorType &dst, const VectorType &src) const -template +template template inline void -PreconditionSSOR::step (VectorType &dst, const VectorType &src) const +PreconditionSSOR::step (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VectorType::size_type>::value, + std::is_same::size_type, typename VectorType::size_type>::value, "PreconditionSSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 @@ -1419,14 +1417,14 @@ PreconditionSSOR::step (VectorType &dst, const VectorType &src) const -template +template template inline void -PreconditionSSOR::Tstep (VectorType &dst, const VectorType &src) const +PreconditionSSOR::Tstep (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VectorType::size_type>::value, + std::is_same::size_type, typename VectorType::size_type>::value, "PreconditionSSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 @@ -1437,25 +1435,24 @@ PreconditionSSOR::Tstep (VectorType &dst, const VectorType &src) const //--------------------------------------------------------------------------- -template +template inline void -PreconditionPSOR::initialize ( - const MATRIX &rA, - const std::vector &p, - const std::vector &ip, - const typename PreconditionRelaxation::AdditionalData ¶meters) +PreconditionPSOR::initialize +(const MatrixType &rA, + const std::vector &p, + const std::vector &ip, + const typename PreconditionRelaxation::AdditionalData ¶meters) { permutation = &p; inverse_permutation = &ip; - PreconditionRelaxation::initialize(rA, parameters); + PreconditionRelaxation::initialize(rA, parameters); } -template +template inline void -PreconditionPSOR::initialize ( - const MATRIX &A, - const AdditionalData &additional_data) +PreconditionPSOR::initialize (const MatrixType &A, + const AdditionalData &additional_data) { initialize(A, additional_data.permutation, @@ -1464,14 +1461,14 @@ PreconditionPSOR::initialize ( } -template +template template inline void -PreconditionPSOR::vmult (VectorType &dst, const VectorType &src) const +PreconditionPSOR::vmult (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VectorType::size_type>::value, + std::is_same::size_type, typename VectorType::size_type>::value, "PreconditionPSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 @@ -1482,14 +1479,14 @@ PreconditionPSOR::vmult (VectorType &dst, const VectorType &src) const -template +template template inline void -PreconditionPSOR::Tvmult (VectorType &dst, const VectorType &src) const +PreconditionPSOR::Tvmult (VectorType &dst, const VectorType &src) const { #ifdef DEAL_II_WITH_CXX11 static_assert( - std::is_same::size_type, typename VectorType::size_type>::value, + std::is_same::size_type, typename VectorType::size_type>::value, "PreconditionPSOR and VectorType must have the same size_type."); #endif // DEAL_II_WITH_CXX11 @@ -1498,11 +1495,11 @@ PreconditionPSOR::Tvmult (VectorType &dst, const VectorType &src) const this->A->TPSOR (dst, *permutation, *inverse_permutation, this->relaxation); } -template -PreconditionPSOR::AdditionalData::AdditionalData ( - const std::vector &permutation, - const std::vector &inverse_permutation, - const typename PreconditionRelaxation::AdditionalData ¶meters) +template +PreconditionPSOR::AdditionalData::AdditionalData +(const std::vector &permutation, + const std::vector &inverse_permutation, + const typename PreconditionRelaxation::AdditionalData ¶meters) : permutation(permutation), inverse_permutation(inverse_permutation), @@ -1515,28 +1512,28 @@ PreconditionPSOR::AdditionalData::AdditionalData ( //--------------------------------------------------------------------------- -template -PreconditionUseMatrix::PreconditionUseMatrix(const MATRIX &M, - const function_ptr method) +template +PreconditionUseMatrix::PreconditionUseMatrix(const MatrixType &M, + const function_ptr method) : matrix(M), precondition(method) {} -template +template void -PreconditionUseMatrix::vmult (VectorType &dst, - const VectorType &src) const +PreconditionUseMatrix::vmult (VectorType &dst, + const VectorType &src) const { (matrix.*precondition)(dst, src); } //--------------------------------------------------------------------------- -template +template inline -PreconditionRelaxation::AdditionalData:: +PreconditionRelaxation::AdditionalData:: AdditionalData (const double relaxation) : relaxation (relaxation) @@ -1761,9 +1758,9 @@ namespace internal -template +template inline -PreconditionChebyshev::AdditionalData:: +PreconditionChebyshev::AdditionalData:: AdditionalData (const unsigned int degree, const double smoothing_range, const bool nonzero_starting, @@ -1781,9 +1778,9 @@ AdditionalData (const unsigned int degree, -template +template inline -PreconditionChebyshev::PreconditionChebyshev () +PreconditionChebyshev::PreconditionChebyshev () : is_initialized (false) { @@ -1796,11 +1793,12 @@ PreconditionChebyshev::PreconditionChebyshev () -template +template inline void -PreconditionChebyshev::initialize (const MATRIX &matrix, - const AdditionalData &additional_data) +PreconditionChebyshev::initialize +(const MatrixType &matrix, + const AdditionalData &additional_data) { matrix_ptr = &matrix; data = additional_data; @@ -1892,11 +1890,11 @@ PreconditionChebyshev::initialize (const MATRIX &matr -template +template inline void -PreconditionChebyshev::vmult (VectorType &dst, - const VectorType &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 +1924,11 @@ PreconditionChebyshev::vmult (VectorType &dst, -template +template inline void -PreconditionChebyshev::Tvmult (VectorType &dst, - const VectorType &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 +1958,9 @@ PreconditionChebyshev::Tvmult (VectorType &dst, -template +template inline -void PreconditionChebyshev::clear () +void PreconditionChebyshev::clear () { is_initialized = false; matrix_ptr = 0; @@ -1972,20 +1970,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/precondition_block.h b/include/deal.II/lac/precondition_block.h index 472b70b75d..80e321ab0e 100644 --- a/include/deal.II/lac/precondition_block.h +++ b/include/deal.II/lac/precondition_block.h @@ -27,7 +27,7 @@ DEAL_II_NAMESPACE_OPEN -template +template class PreconditionBlockJacobi; /*! @addtogroup Preconditioners @@ -37,7 +37,7 @@ class PreconditionBlockJacobi; /** * Base class for actual block preconditioners. This class assumes the - * MATRIX consisting of invertible blocks of @p blocksize on the + * MatrixType consisting of invertible blocks of @p blocksize on the * diagonal and provides the inversion of the diagonal blocks of the matrix. * It is not necessary for this class that the matrix be block diagonal; * rather, it applies to matrices of arbitrary structure with the minimal @@ -80,7 +80,7 @@ class PreconditionBlockJacobi; * @author Ralf Hartmann, Guido Kanschat * @date 1999, 2000, 2010 */ -template +template class PreconditionBlock : public virtual Subscriptor, protected PreconditionBlockBase @@ -89,7 +89,7 @@ private: /** * Define number type of matrix. */ - typedef typename MATRIX::value_type number; + typedef typename MatrixType::value_type number; /** * Value type for inverse matrices. @@ -167,7 +167,7 @@ public: * * Additionally, a relaxation parameter for derived classes may be provided. */ - void initialize (const MATRIX &A, + void initialize (const MatrixType &A, const AdditionalData parameters); protected: /** @@ -181,7 +181,7 @@ protected: * * Additionally, a relaxation parameter for derived classes may be provided. */ - void initialize (const MATRIX &A, + void initialize (const MatrixType &A, const std::vector &permutation, const std::vector &inverse_permutation, const AdditionalData parameters); @@ -215,9 +215,8 @@ protected: /** * Replacement of invert_diagblocks() for permuted preconditioning. */ - void invert_permuted_diagblocks( - const std::vector &permutation, - const std::vector &inverse_permutation); + void invert_permuted_diagblocks(const std::vector &permutation, + const std::vector &inverse_permutation); public: /** * Deletes the inverse diagonal block matrices if existent, sets the @@ -267,11 +266,10 @@ public: * function. */ template - void forward_step ( - Vector &dst, - const Vector &prev, - const Vector &src, - const bool transpose_diagonal) const; + void forward_step (Vector &dst, + const Vector &prev, + const Vector &src, + const bool transpose_diagonal) const; /** * Perform one block relaxation step in backward numbering. @@ -285,11 +283,10 @@ public: * function. */ template - void backward_step ( - Vector &dst, - const Vector &prev, - const Vector &src, - const bool transpose_diagonal) const; + void backward_step (Vector &dst, + const Vector &prev, + const Vector &src, + const bool transpose_diagonal) const; /** @@ -338,7 +335,7 @@ protected: * inverse matrices should not be stored) until the last call of the * preconditoining @p vmult function of the derived classes. */ - SmartPointer > A; + SmartPointer > A; /** * Relaxation parameter to be used by derived classes. */ @@ -369,15 +366,15 @@ protected: * * @author Ralf Hartmann, Guido Kanschat, 1999, 2000, 2003 */ -template +template class PreconditionBlockJacobi : public virtual Subscriptor, - private PreconditionBlock + private PreconditionBlock { private: /** * Define number type of matrix. */ - typedef typename MATRIX::value_type number; + typedef typename MatrixType::value_type number; public: /** @@ -401,7 +398,7 @@ public: * Constructor. Since we use accessors only for read access, a const * matrix pointer is sufficient. */ - Accessor (const PreconditionBlockJacobi *matrix, + Accessor (const PreconditionBlockJacobi *matrix, const size_type row); /** @@ -423,7 +420,7 @@ public: /** * The matrix accessed. */ - const PreconditionBlockJacobi *matrix; + const PreconditionBlockJacobi *matrix; /** * Save block size here for further reference. @@ -455,7 +452,7 @@ public: /** * Constructor. */ - const_iterator(const PreconditionBlockJacobi *matrix, + const_iterator(const PreconditionBlockJacobi *matrix, const size_type row); /** @@ -503,19 +500,19 @@ public: /** * import functions from private base class */ - using PreconditionBlock::initialize; - using PreconditionBlock::clear; - using PreconditionBlock::empty; - using PreconditionBlock::el; - using PreconditionBlock::set_same_diagonal; - using PreconditionBlock::invert_diagblocks; - using PreconditionBlock::block_size; + using PreconditionBlock::initialize; + using PreconditionBlock::clear; + using PreconditionBlock::empty; + using PreconditionBlock::el; + using PreconditionBlock::set_same_diagonal; + using PreconditionBlock::invert_diagblocks; + using PreconditionBlock::block_size; using PreconditionBlockBase::size; using PreconditionBlockBase::inverse; using PreconditionBlockBase::inverse_householder; using PreconditionBlockBase::inverse_svd; using PreconditionBlockBase::log_statistics; - using PreconditionBlock::set_permutation; + using PreconditionBlock::set_permutation; /** * Execute block Jacobi preconditioning. @@ -633,9 +630,9 @@ private: * * @author Ralf Hartmann, Guido Kanschat, 1999, 2000, 2001, 2002, 2003 */ -template +template class PreconditionBlockSOR : public virtual Subscriptor, - protected PreconditionBlock + protected PreconditionBlock { public: /** @@ -651,23 +648,23 @@ public: /** * Define number type of matrix. */ - typedef typename MATRIX::value_type number; + typedef typename MatrixType::value_type number; /** * import types and functions from protected base class. */ - using typename PreconditionBlock::AdditionalData; - using PreconditionBlock::initialize; - using PreconditionBlock::clear; - using PreconditionBlock::empty; + using typename PreconditionBlock::AdditionalData; + using PreconditionBlock::initialize; + using PreconditionBlock::clear; + using PreconditionBlock::empty; using PreconditionBlockBase::size; using PreconditionBlockBase::inverse; using PreconditionBlockBase::inverse_householder; using PreconditionBlockBase::inverse_svd; - using PreconditionBlock::el; - using PreconditionBlock::set_same_diagonal; - using PreconditionBlock::invert_diagblocks; - using PreconditionBlock::set_permutation; + using PreconditionBlock::el; + using PreconditionBlock::set_same_diagonal; + using PreconditionBlock::invert_diagblocks; + using PreconditionBlock::set_permutation; using PreconditionBlockBase::log_statistics; /** @@ -790,9 +787,9 @@ protected: * * @author Ralf Hartmann, Guido Kanschat, 1999, 2000 */ -template +template class PreconditionBlockSSOR : public virtual Subscriptor, - private PreconditionBlockSOR + private PreconditionBlockSOR { public: /** @@ -803,7 +800,7 @@ public: /** * Define number type of matrix. */ - typedef typename MATRIX::value_type number; + typedef typename MatrixType::value_type number; /** * Constructor. @@ -811,7 +808,7 @@ public: PreconditionBlockSSOR (); // Keep AdditionalData accessible - using typename PreconditionBlockSOR::AdditionalData; + using typename PreconditionBlockSOR::AdditionalData; // The following are the // functions of the base classes @@ -820,18 +817,18 @@ public: /** * Make initialization function publicly available. */ - using PreconditionBlockSOR::initialize; - using PreconditionBlockSOR::clear; + using PreconditionBlockSOR::initialize; + using PreconditionBlockSOR::clear; using PreconditionBlockBase::size; using PreconditionBlockBase::inverse; using PreconditionBlockBase::inverse_householder; using PreconditionBlockBase::inverse_svd; using PreconditionBlockBase::log_statistics; - using PreconditionBlockSOR::set_permutation; - using PreconditionBlockSOR::empty; - using PreconditionBlockSOR::el; - using PreconditionBlockSOR::set_same_diagonal; - using PreconditionBlockSOR::invert_diagblocks; + using PreconditionBlockSOR::set_permutation; + using PreconditionBlockSOR::empty; + using PreconditionBlockSOR::el; + using PreconditionBlockSOR::set_same_diagonal; + using PreconditionBlockSOR::invert_diagblocks; /** * Execute block SSOR preconditioning. @@ -867,9 +864,9 @@ public: #ifndef DOXYGEN -template +template inline bool -PreconditionBlock::empty () const +PreconditionBlock::empty () const { if (A == 0) return true; @@ -877,9 +874,9 @@ PreconditionBlock::empty () const } -template +template inline inverse_type -PreconditionBlock::el ( +PreconditionBlock::el ( size_type i, size_type j) const { @@ -901,10 +898,10 @@ PreconditionBlock::el ( //--------------------------------------------------------------------------- -template +template inline -PreconditionBlockJacobi::const_iterator::Accessor:: -Accessor (const PreconditionBlockJacobi *matrix, +PreconditionBlockJacobi::const_iterator::Accessor:: +Accessor (const PreconditionBlockJacobi *matrix, const size_type row) : matrix(matrix), @@ -929,10 +926,10 @@ Accessor (const PreconditionBlockJacobi *matrix, } -template +template inline -typename PreconditionBlockJacobi::size_type -PreconditionBlockJacobi::const_iterator::Accessor::row() const +typename PreconditionBlockJacobi::size_type +PreconditionBlockJacobi::const_iterator::Accessor::row() const { Assert (a_block < matrix->size(), ExcIteratorPastEnd()); @@ -941,10 +938,10 @@ PreconditionBlockJacobi::const_iterator::Accessor::row() c } -template +template inline -typename PreconditionBlockJacobi::size_type -PreconditionBlockJacobi::const_iterator::Accessor::column() const +typename PreconditionBlockJacobi::size_type +PreconditionBlockJacobi::const_iterator::Accessor::column() const { Assert (a_block < matrix->size(), ExcIteratorPastEnd()); @@ -953,10 +950,10 @@ PreconditionBlockJacobi::const_iterator::Accessor::column( } -template +template inline inverse_type -PreconditionBlockJacobi::const_iterator::Accessor::value() const +PreconditionBlockJacobi::const_iterator::Accessor::value() const { Assert (a_block < matrix->size(), ExcIteratorPastEnd()); @@ -965,20 +962,20 @@ PreconditionBlockJacobi::const_iterator::Accessor::value() } -template +template inline -PreconditionBlockJacobi::const_iterator:: -const_iterator(const PreconditionBlockJacobi *matrix, +PreconditionBlockJacobi::const_iterator:: +const_iterator(const PreconditionBlockJacobi *matrix, const size_type row) : accessor(matrix, row) {} -template +template inline -typename PreconditionBlockJacobi::const_iterator & -PreconditionBlockJacobi::const_iterator::operator++ () +typename PreconditionBlockJacobi::const_iterator & +PreconditionBlockJacobi::const_iterator::operator++ () { Assert (*this != accessor.matrix->end(), ExcIteratorPastEnd()); @@ -997,28 +994,28 @@ PreconditionBlockJacobi::const_iterator::operator++ () } -template +template inline -const typename PreconditionBlockJacobi::const_iterator::Accessor & -PreconditionBlockJacobi::const_iterator::operator* () const +const typename PreconditionBlockJacobi::const_iterator::Accessor & +PreconditionBlockJacobi::const_iterator::operator* () const { return accessor; } -template +template inline -const typename PreconditionBlockJacobi::const_iterator::Accessor * -PreconditionBlockJacobi::const_iterator::operator-> () const +const typename PreconditionBlockJacobi::const_iterator::Accessor * +PreconditionBlockJacobi::const_iterator::operator-> () const { return &accessor; } -template +template inline bool -PreconditionBlockJacobi::const_iterator:: +PreconditionBlockJacobi::const_iterator:: operator == (const const_iterator &other) const { if (accessor.a_block == accessor.matrix->size() && @@ -1033,20 +1030,20 @@ operator == (const const_iterator &other) const } -template +template inline bool -PreconditionBlockJacobi::const_iterator:: +PreconditionBlockJacobi::const_iterator:: operator != (const const_iterator &other) const { return ! (*this == other); } -template +template inline bool -PreconditionBlockJacobi::const_iterator:: +PreconditionBlockJacobi::const_iterator:: operator < (const const_iterator &other) const { return (accessor.row() < other.accessor.row() || @@ -1055,28 +1052,28 @@ operator < (const const_iterator &other) const } -template +template inline -typename PreconditionBlockJacobi::const_iterator -PreconditionBlockJacobi::begin () const +typename PreconditionBlockJacobi::const_iterator +PreconditionBlockJacobi::begin () const { return const_iterator(this, 0); } -template +template inline -typename PreconditionBlockJacobi::const_iterator -PreconditionBlockJacobi::end () const +typename PreconditionBlockJacobi::const_iterator +PreconditionBlockJacobi::end () const { return const_iterator(this, this->size() * this->block_size()); } -template +template inline -typename PreconditionBlockJacobi::const_iterator -PreconditionBlockJacobi::begin ( +typename PreconditionBlockJacobi::const_iterator +PreconditionBlockJacobi::begin ( const size_type r) const { Assert (r < this->A->m(), ExcIndexRange(r, 0, this->A->m())); @@ -1085,10 +1082,10 @@ PreconditionBlockJacobi::begin ( -template +template inline -typename PreconditionBlockJacobi::const_iterator -PreconditionBlockJacobi::end ( +typename PreconditionBlockJacobi::const_iterator +PreconditionBlockJacobi::end ( const size_type r) const { Assert (r < this->A->m(), ExcIndexRange(r, 0, this->A->m())); diff --git a/include/deal.II/lac/precondition_block.templates.h b/include/deal.II/lac/precondition_block.templates.h index 260b1f2fea..468815acb8 100644 --- a/include/deal.II/lac/precondition_block.templates.h +++ b/include/deal.II/lac/precondition_block.templates.h @@ -29,12 +29,12 @@ DEAL_II_NAMESPACE_OPEN -template -PreconditionBlock::AdditionalData:: +template +PreconditionBlock::AdditionalData:: AdditionalData (const size_type block_size, - const double relaxation, - const bool invert_diagonal, - const bool same_diagonal) + const double relaxation, + const bool invert_diagonal, + const bool same_diagonal) : relaxation (relaxation), block_size(block_size), @@ -50,21 +50,21 @@ PreconditionBlockBase::~PreconditionBlockBase () {} -template -PreconditionBlock::PreconditionBlock (bool store) +template +PreconditionBlock::PreconditionBlock (bool store) : PreconditionBlockBase(store), blocksize(0), A(0, typeid(*this).name()) {} -template -PreconditionBlock::~PreconditionBlock () +template +PreconditionBlock::~PreconditionBlock () {} -template -void PreconditionBlock::clear () +template +void PreconditionBlock::clear () { PreconditionBlockBase::clear(); blocksize = 0; @@ -72,10 +72,10 @@ void PreconditionBlock::clear () } -template -void PreconditionBlock::initialize ( - const MATRIX &M, - const AdditionalData parameters) +template +void PreconditionBlock::initialize +(const MatrixType &M, + const AdditionalData parameters) { const size_type bsize = parameters.block_size; @@ -100,26 +100,26 @@ void PreconditionBlock::initialize ( } -template -void PreconditionBlock::initialize ( - const MATRIX &M, - const std::vector &permutation, - const std::vector &inverse_permutation, - const AdditionalData parameters) +template +void PreconditionBlock::initialize +(const MatrixType &M, + const std::vector &permutation, + const std::vector &inverse_permutation, + const AdditionalData parameters) { set_permutation(permutation, inverse_permutation); initialize(M, parameters); } -template -void PreconditionBlock::invert_permuted_diagblocks( - const std::vector &permutation, - const std::vector &inverse_permutation) +template +void PreconditionBlock::invert_permuted_diagblocks +(const std::vector &permutation, + const std::vector &inverse_permutation) { Assert (A!=0, ExcNotInitialized()); Assert (blocksize!=0, ExcNotInitialized()); - const MATRIX &M=*A; + const MatrixType &M=*A; Assert (this->inverses_ready()==0, ExcInverseMatricesAlreadyExist()); AssertDimension (permutation.size(), M.m()); AssertDimension (inverse_permutation.size(), M.m()); @@ -132,8 +132,8 @@ void PreconditionBlock::invert_permuted_diagblocks( for (size_type row_cell=0; row_cellcolumn() < blocksize) @@ -180,8 +180,8 @@ void PreconditionBlock::invert_permuted_diagblocks( const size_type row = permutation[urow]; - typename MATRIX::const_iterator entry = M.begin(row); - const typename MATRIX::const_iterator row_end = M.end(row); + typename MatrixType::const_iterator entry = M.begin(row); + const typename MatrixType::const_iterator row_end = M.end(row); for (; entry != row_end; ++entry) { @@ -221,17 +221,17 @@ void PreconditionBlock::invert_permuted_diagblocks( -template +template template -void PreconditionBlock::forward_step ( - Vector &dst, - const Vector &prev, - const Vector &src, - const bool transpose_diagonal) const +void PreconditionBlock::forward_step +(Vector &dst, + const Vector &prev, + const Vector &src, + const bool transpose_diagonal) const { Assert (this->A!=0, ExcNotInitialized()); - const MATRIX &M=*this->A; + const MatrixType &M=*this->A; if (permutation.size() != 0) Assert (permutation.size() == M.m() || permutation.size() == this->size(), @@ -272,8 +272,8 @@ void PreconditionBlock::forward_step ( ++row_cell, ++row) { // deallog << ' ' << row; - const typename MATRIX::const_iterator row_end = M.end(row); - typename MATRIX::const_iterator entry = M.begin(row); + const typename MatrixType::const_iterator row_end = M.end(row); + typename MatrixType::const_iterator entry = M.begin(row); b_cell_row=src(row); for (; entry != row_end; ++entry) @@ -319,17 +319,17 @@ void PreconditionBlock::forward_step ( } -template +template template -void PreconditionBlock::backward_step ( - Vector &dst, - const Vector &prev, - const Vector &src, - const bool transpose_diagonal) const +void PreconditionBlock::backward_step +(Vector &dst, + const Vector &prev, + const Vector &src, + const bool transpose_diagonal) const { Assert (this->A!=0, ExcNotInitialized()); - const MATRIX &M=*this->A; + const MatrixType &M=*this->A; if (permutation.size() != 0) Assert (permutation.size() == M.m() || permutation.size() == this->size(), @@ -364,8 +364,8 @@ void PreconditionBlock::backward_step ( row_cellblocksize; ++row_cell, ++row) { - const typename MATRIX::const_iterator row_end = M.end(row); - typename MATRIX::const_iterator entry = M.begin(row); + const typename MatrixType::const_iterator row_end = M.end(row); + typename MatrixType::const_iterator entry = M.begin(row); b_cell_row=src(row); for (; entry != row_end; ++entry) @@ -417,21 +417,21 @@ void PreconditionBlock::backward_step ( } -template -typename PreconditionBlock::size_type -PreconditionBlock::block_size() const +template +typename PreconditionBlock::size_type +PreconditionBlock::block_size() const { return blocksize; } -template -void PreconditionBlock::invert_diagblocks() +template +void PreconditionBlock::invert_diagblocks() { Assert (A!=0, ExcNotInitialized()); Assert (blocksize!=0, ExcNotInitialized()); - const MATRIX &M=*A; + const MatrixType &M=*A; Assert (this->inverses_ready()==0, ExcInverseMatricesAlreadyExist()); FullMatrix M_cell(blocksize); @@ -441,8 +441,8 @@ void PreconditionBlock::invert_diagblocks() deallog << "PreconditionBlock uses only one diagonal block" << std::endl; for (size_type row_cell=0; row_cellcolumn() < blocksize) @@ -478,8 +478,8 @@ void PreconditionBlock::invert_diagblocks() for (size_type row_cell=0; row_cell::invert_diagblocks() -template -void PreconditionBlock::set_permutation ( - const std::vector &p, - const std::vector &i) +template +void PreconditionBlock::set_permutation +(const std::vector &p, + const std::vector &i) { Assert (p.size() == i.size(), ExcDimensionMismatch(p.size(), i.size())); @@ -539,9 +539,9 @@ void PreconditionBlock::set_permutation ( } -template +template std::size_t -PreconditionBlock::memory_consumption () const +PreconditionBlock::memory_consumption () const { return (sizeof(*this) - sizeof(PreconditionBlockBase) @@ -554,16 +554,16 @@ PreconditionBlock::memory_consumption () const /*--------------------- PreconditionBlockJacobi -----------------------*/ -template +template template -void PreconditionBlockJacobi +void PreconditionBlockJacobi ::do_vmult (Vector &dst, const Vector &src, - bool adding) const + bool adding) const { Assert(this->A!=0, ExcNotInitialized()); - const MATRIX &M=*this->A; + const MatrixType &M=*this->A; Vector b_cell(this->blocksize), x_cell(this->blocksize); @@ -629,9 +629,9 @@ void PreconditionBlockJacobi } -template +template template -void PreconditionBlockJacobi +void PreconditionBlockJacobi ::vmult (Vector &dst, const Vector &src) const { @@ -639,9 +639,9 @@ void PreconditionBlockJacobi } -template +template template -void PreconditionBlockJacobi +void PreconditionBlockJacobi ::Tvmult (Vector &dst, const Vector &src) const { @@ -649,9 +649,9 @@ void PreconditionBlockJacobi } -template +template template -void PreconditionBlockJacobi +void PreconditionBlockJacobi ::vmult_add (Vector &dst, const Vector &src) const { @@ -659,9 +659,9 @@ void PreconditionBlockJacobi } -template +template template -void PreconditionBlockJacobi +void PreconditionBlockJacobi ::Tvmult_add (Vector &dst, const Vector &src) const { @@ -669,9 +669,9 @@ void PreconditionBlockJacobi } -template +template template -void PreconditionBlockJacobi +void PreconditionBlockJacobi ::step (Vector &dst, const Vector &src) const { @@ -684,9 +684,9 @@ void PreconditionBlockJacobi } -template +template template -void PreconditionBlockJacobi +void PreconditionBlockJacobi ::Tstep (Vector &dst, const Vector &src) const { @@ -704,29 +704,29 @@ void PreconditionBlockJacobi /*--------------------- PreconditionBlockSOR -----------------------*/ -template -PreconditionBlockSOR::PreconditionBlockSOR () - : PreconditionBlock (false) +template +PreconditionBlockSOR::PreconditionBlockSOR () + : PreconditionBlock (false) {} -template -PreconditionBlockSOR::PreconditionBlockSOR (bool store) - : PreconditionBlock (store) +template +PreconditionBlockSOR::PreconditionBlockSOR (bool store) + : PreconditionBlock (store) {} -template +template template -void PreconditionBlockSOR::forward ( - Vector &dst, - const Vector &src, - const bool transpose_diagonal, - const bool) const +void PreconditionBlockSOR::forward +(Vector &dst, + const Vector &src, + const bool transpose_diagonal, + const bool) const { Assert (this->A!=0, ExcNotInitialized()); - const MATRIX &M=*this->A; + const MatrixType &M=*this->A; const bool permuted = (this->permutation.size() != 0); if (permuted) { @@ -758,8 +758,8 @@ void PreconditionBlockSOR::forward ( row_cell < this->blocksize; ++row_cell, ++row) { - const typename MATRIX::const_iterator row_end = M.end(row); - typename MATRIX::const_iterator entry = M.begin(row); + const typename MatrixType::const_iterator row_end = M.end(row); + typename MatrixType::const_iterator entry = M.begin(row); b_cell_row=src(row); for (; entry != row_end; ++entry) @@ -806,17 +806,17 @@ void PreconditionBlockSOR::forward ( } -template +template template -void PreconditionBlockSOR::backward ( - Vector &dst, - const Vector &src, - const bool transpose_diagonal, - const bool) const +void PreconditionBlockSOR::backward +(Vector &dst, + const Vector &src, + const bool transpose_diagonal, + const bool) const { Assert (this->A!=0, ExcNotInitialized()); - const MATRIX &M=*this->A; + const MatrixType &M=*this->A; const bool permuted = (this->permutation.size() != 0); if (permuted) { @@ -849,8 +849,8 @@ void PreconditionBlockSOR::backward ( row_cellblocksize; ++row_cell, ++row) { - const typename MATRIX::const_iterator row_end = M.end(row); - typename MATRIX::const_iterator entry = M.begin(row); + const typename MatrixType::const_iterator row_end = M.end(row); + typename MatrixType::const_iterator entry = M.begin(row); b_cell_row=src(row); for (; entry != row_end; ++entry) @@ -903,9 +903,9 @@ void PreconditionBlockSOR::backward ( } -template +template template -void PreconditionBlockSOR +void PreconditionBlockSOR ::vmult (Vector &dst, const Vector &src) const { @@ -913,9 +913,9 @@ void PreconditionBlockSOR } -template +template template -void PreconditionBlockSOR +void PreconditionBlockSOR ::vmult_add (Vector &dst, const Vector &src) const { @@ -923,9 +923,9 @@ void PreconditionBlockSOR } -template +template template -void PreconditionBlockSOR +void PreconditionBlockSOR ::Tvmult (Vector &dst, const Vector &src) const { @@ -933,9 +933,9 @@ void PreconditionBlockSOR } -template +template template -void PreconditionBlockSOR +void PreconditionBlockSOR ::Tvmult_add (Vector &dst, const Vector &src) const { @@ -944,9 +944,9 @@ void PreconditionBlockSOR -template +template template -void PreconditionBlockSOR +void PreconditionBlockSOR ::step (Vector &dst, const Vector &src) const { @@ -954,9 +954,9 @@ void PreconditionBlockSOR } -template +template template -void PreconditionBlockSOR +void PreconditionBlockSOR ::Tstep (Vector &dst, const Vector &src) const { @@ -969,16 +969,16 @@ void PreconditionBlockSOR //--------------------------------------------------------------------------- -template -PreconditionBlockSSOR::PreconditionBlockSSOR () - : PreconditionBlockSOR (true) +template +PreconditionBlockSSOR::PreconditionBlockSSOR () + : PreconditionBlockSOR (true) {} -template +template template -void PreconditionBlockSSOR::vmult (Vector &dst, +void PreconditionBlockSSOR::vmult (Vector &dst, const Vector &src) const { Vector help; @@ -1007,10 +1007,10 @@ void PreconditionBlockSSOR::vmult (Vector &d this->backward(dst, help, false, false); } -template +template template -void PreconditionBlockSSOR::Tvmult (Vector &dst, - const Vector &src) const +void PreconditionBlockSSOR::Tvmult (Vector &dst, + const Vector &src) const { Vector help; help.reinit(dst); @@ -1039,9 +1039,9 @@ void PreconditionBlockSSOR::Tvmult (Vector & } -template +template template -void PreconditionBlockSSOR +void PreconditionBlockSSOR ::step (Vector &dst, const Vector &src) const { @@ -1050,9 +1050,9 @@ void PreconditionBlockSSOR } -template +template template -void PreconditionBlockSSOR +void PreconditionBlockSSOR ::Tstep (Vector &dst, const Vector &src) const { diff --git a/include/deal.II/lac/precondition_selector.h b/include/deal.II/lac/precondition_selector.h index f6bbe079fb..aa1f548aaa 100644 --- a/include/deal.II/lac/precondition_selector.h +++ b/include/deal.II/lac/precondition_selector.h @@ -90,7 +90,7 @@ template class SparseMatrix; * @author Ralf Hartmann, 1999; extension for full compatibility with * LinearOperator class: Jean-Paul Pelteret, 2015 */ -template , +template , typename VectorType = dealii::Vector > class PreconditionSelector : public Subscriptor { @@ -98,7 +98,7 @@ public: /** * Declare type for container size. */ - typedef typename MATRIX::size_type size_type; + typedef typename MatrixType::size_type size_type; /** * Constructor. @p omega denotes the damping parameter of the @@ -116,7 +116,7 @@ public: * Takes the matrix that is needed for preconditionings that involves a * matrix. e.g. for @p precondition_jacobi, ~_sor, ~_ssor. */ - void use_matrix(const MATRIX &M); + void use_matrix(const MatrixType &M); /** * Return the dimension of the codomain (or range) space. To remember: the @@ -171,7 +171,7 @@ private: * Matrix that is used for the matrix-builtin preconditioning function. cf. * also @p PreconditionUseMatrix. */ - SmartPointer > A; + SmartPointer > A; /** * Stores the damping parameter of the preconditioner. @@ -183,42 +183,42 @@ private: /* --------------------- Inline and template functions ------------------- */ -template -PreconditionSelector +template +PreconditionSelector ::PreconditionSelector(const std::string &preconditioning, const typename VectorType::value_type &omega) : preconditioning(preconditioning), omega(omega) {} -template -PreconditionSelector::~PreconditionSelector() +template +PreconditionSelector::~PreconditionSelector() { // release the matrix A A=0; } -template -void PreconditionSelector::use_matrix(const MATRIX &M) +template +void PreconditionSelector::use_matrix(const MatrixType &M) { A=&M; } <<<<<<< fc87b7c22812a5fc7751b36c66b20e6fa54df72c -template -inline typename PreconditionSelector::size_type -PreconditionSelector::m () const +template +inline typename PreconditionSelector::size_type +PreconditionSelector::m () const { Assert(A!=0, ExcNoMatrixGivenToUse()); return A->m(); } -template -inline typename PreconditionSelector::size_type -PreconditionSelector::n () const +template +inline typename PreconditionSelector::size_type +PreconditionSelector::n () const { Assert(A!=0, ExcNoMatrixGivenToUse()); return A->n(); @@ -226,9 +226,9 @@ PreconditionSelector::n () const -template -void PreconditionSelector::vmult (VectorType &dst, - const VectorType &src) const +template +void PreconditionSelector::vmult (VectorType &dst, + const VectorType &src) const { if (preconditioning=="none") { @@ -256,9 +256,9 @@ void PreconditionSelector::vmult (VectorType &dst, } -template -void PreconditionSelector::Tvmult (VectorType &dst, - const VectorType &src) const +template +void PreconditionSelector::Tvmult (VectorType &dst, + const VectorType &src) const { if (preconditioning=="none") { @@ -286,8 +286,8 @@ void PreconditionSelector::Tvmult (VectorType &dst, } -template -std::string PreconditionSelector::get_precondition_names() +template +std::string PreconditionSelector::get_precondition_names() { return "none|jacobi|sor|ssor"; } diff --git a/include/deal.II/lac/relaxation_block.h b/include/deal.II/lac/relaxation_block.h index 0b807d82ca..42949c5ff3 100644 --- a/include/deal.II/lac/relaxation_block.h +++ b/include/deal.II/lac/relaxation_block.h @@ -47,7 +47,7 @@ DEAL_II_NAMESPACE_OPEN * @author Guido Kanschat * @date 2010 */ -template +template class RelaxationBlock : protected PreconditionBlockBase { @@ -55,7 +55,7 @@ private: /** * Define number type of matrix. */ - typedef typename MATRIX::value_type number; + typedef typename MatrixType::value_type number; /** * Value type for inverse matrices. @@ -162,7 +162,7 @@ public: * rather a pointer is stored. Thus, the lifetime of * additional_data hast to exceed the lifetime of this object. */ - void initialize (const MATRIX &A, + void initialize (const MatrixType &A, const AdditionalData ¶meters); /** @@ -222,12 +222,12 @@ protected: * inverse matrices should not be stored) until the last call of the * preconditioning @p vmult function of the derived classes. */ - SmartPointer > A; + SmartPointer > A; /** * Control information. */ - SmartPointer > additional_data; + SmartPointer > additional_data; }; @@ -245,9 +245,9 @@ protected: * @author Guido Kanschat * @date 2010 */ -template +template class RelaxationBlockJacobi : public virtual Subscriptor, - protected RelaxationBlock + protected RelaxationBlock { public: /** @@ -258,43 +258,43 @@ public: /** * Define number type of matrix. */ - typedef typename MATRIX::value_type number; + typedef typename MatrixType::value_type number; /** * Make type publicly available. */ - using typename RelaxationBlock::AdditionalData; + using typename RelaxationBlock::AdditionalData; /** * Make initialization function publicly available. */ - using RelaxationBlock::initialize; + using RelaxationBlock::initialize; /** * Make function of base class public again. */ - using RelaxationBlock::clear; + using RelaxationBlock::clear; /** * Make function of base class public again. */ - using RelaxationBlock::empty; + using RelaxationBlock::empty; /** * Make function of base class public again. */ - using RelaxationBlock::size; + using RelaxationBlock::size; /** * Make function of base class public again. */ - using RelaxationBlock::inverse; + using RelaxationBlock::inverse; /** * Make function of base class public again. */ - using RelaxationBlock::inverse_householder; + using RelaxationBlock::inverse_householder; /** * Make function of base class public again. */ - using RelaxationBlock::inverse_svd; + using RelaxationBlock::inverse_svd; using PreconditionBlockBase::log_statistics; /** * Perform one step of the Jacobi iteration. @@ -329,9 +329,9 @@ public: * @author Guido Kanschat * @date 2010 */ -template +template class RelaxationBlockSOR : public virtual Subscriptor, - protected RelaxationBlock + protected RelaxationBlock { public: /** @@ -342,43 +342,43 @@ public: /** * Define number type of matrix. */ - typedef typename MATRIX::value_type number; + typedef typename MatrixType::value_type number; /** * Make type publicly available. */ - using typename RelaxationBlock::AdditionalData; + using typename RelaxationBlock::AdditionalData; /** * Make initialization function publicly available. */ - using RelaxationBlock::initialize; + using RelaxationBlock::initialize; /** * Make function of base class public again. */ - using RelaxationBlock::clear; + using RelaxationBlock::clear; /** * Make function of base class public again. */ - using RelaxationBlock::empty; + using RelaxationBlock::empty; /** * Make function of base class public again. */ - using RelaxationBlock::size; + using RelaxationBlock::size; /** * Make function of base class public again. */ - using RelaxationBlock::inverse; + using RelaxationBlock::inverse; /** * Make function of base class public again. */ - using RelaxationBlock::inverse_householder; + using RelaxationBlock::inverse_householder; /** * Make function of base class public again. */ - using RelaxationBlock::inverse_svd; + using RelaxationBlock::inverse_svd; using PreconditionBlockBase::log_statistics; /** * Perform one step of the SOR iteration. @@ -409,52 +409,52 @@ public: * @author Guido Kanschat * @date 2010 */ -template +template class RelaxationBlockSSOR : public virtual Subscriptor, - protected RelaxationBlock + protected RelaxationBlock { public: /** * Define number type of matrix. */ - typedef typename MATRIX::value_type number; + typedef typename MatrixType::value_type number; /** * Make type publicly available. */ - using typename RelaxationBlock::AdditionalData; + using typename RelaxationBlock::AdditionalData; /** * Make initialization function publicly available. */ - using RelaxationBlock::initialize; + using RelaxationBlock::initialize; /** * Make function of base class public again. */ - using RelaxationBlock::clear; + using RelaxationBlock::clear; /** * Make function of base class public again. */ - using RelaxationBlock::empty; + using RelaxationBlock::empty; /** * Make function of base class public again. */ - using RelaxationBlock::size; + using RelaxationBlock::size; /** * Make function of base class public again. */ - using RelaxationBlock::inverse; + using RelaxationBlock::inverse; /** * Make function of base class public again. */ - using RelaxationBlock::inverse_householder; + using RelaxationBlock::inverse_householder; /** * Make function of base class public again. */ - using RelaxationBlock::inverse_svd; + using RelaxationBlock::inverse_svd; using PreconditionBlockBase::log_statistics; /** * Perform one step of the SOR iteration. diff --git a/include/deal.II/lac/relaxation_block.templates.h b/include/deal.II/lac/relaxation_block.templates.h index f458df189b..513f14b7b3 100644 --- a/include/deal.II/lac/relaxation_block.templates.h +++ b/include/deal.II/lac/relaxation_block.templates.h @@ -22,12 +22,12 @@ DEAL_II_NAMESPACE_OPEN -template +template inline -RelaxationBlock::AdditionalData::AdditionalData ( - const double relaxation, - const bool invert_diagonal, - const bool same_diagonal) +RelaxationBlock::AdditionalData::AdditionalData +(const double relaxation, + const bool invert_diagonal, + const bool same_diagonal) : relaxation(relaxation), invert_diagonal(invert_diagonal), @@ -37,10 +37,10 @@ RelaxationBlock::AdditionalData::AdditionalData ( {} -template +template inline std::size_t -RelaxationBlock::AdditionalData::memory_consumption() const +RelaxationBlock::AdditionalData::memory_consumption() const { std::size_t result = sizeof(*this) + - sizeof(block_list) + block_list.memory_consumption(); @@ -50,12 +50,11 @@ RelaxationBlock::AdditionalData::memory_consumption() const } -template +template inline void -RelaxationBlock::initialize ( - const MATRIX &M, - const AdditionalData ¶meters) +RelaxationBlock::initialize (const MatrixType &M, + const AdditionalData ¶meters) { Assert (parameters.invert_diagonal, ExcNotImplemented()); @@ -73,10 +72,10 @@ RelaxationBlock::initialize ( } -template +template inline void -RelaxationBlock::clear () +RelaxationBlock::clear () { A = 0; additional_data = 0; @@ -84,12 +83,12 @@ RelaxationBlock::clear () } -template +template inline void -RelaxationBlock::invert_diagblocks () +RelaxationBlock::invert_diagblocks () { - const MATRIX &M=*A; + const MatrixType &M=*A; FullMatrix M_cell; if (this->same_diagonal()) @@ -111,7 +110,7 @@ RelaxationBlock::invert_diagblocks () for (size_type row_cell=0; row_cellcolumn()); + for (typename MatrixType::const_iterator entry = M.begin(row->column()); entry != M.end(row->column()); ++entry) { const size_type column = entry->column(); @@ -152,19 +151,18 @@ RelaxationBlock::invert_diagblocks () } -template +template template inline void -RelaxationBlock::do_step ( - Vector &dst, - const Vector &prev, - const Vector &src, - const bool backward) const +RelaxationBlock::do_step (Vector &dst, + const Vector &prev, + const Vector &src, + const bool backward) const { Assert (additional_data->invert_diagonal, ExcNotImplemented()); - const MATRIX &M=*this->A; + const MatrixType &M=*this->A; Vector b_cell, x_cell; const bool permutation_empty = additional_data->order.size() == 0; @@ -196,7 +194,7 @@ RelaxationBlock::do_step ( for (size_type row_cell=0; row_cellcolumn()); - for (typename MATRIX::const_iterator entry = M.begin(row->column()); + for (typename MatrixType::const_iterator entry = M.begin(row->column()); entry != M.end(row->column()); ++entry) b_cell(row_cell) -= entry->value() * prev(entry->column()); } @@ -219,11 +217,11 @@ RelaxationBlock::do_step ( //----------------------------------------------------------------------// -template +template template -void RelaxationBlockJacobi::step ( - Vector &dst, - const Vector &src) const +void RelaxationBlockJacobi::step +(Vector &dst, + const Vector &src) const { GrowingVectorMemory > mem; typename VectorMemory >::Pointer aux = mem; @@ -233,11 +231,11 @@ void RelaxationBlockJacobi::step ( } -template +template template -void RelaxationBlockJacobi::Tstep ( - Vector &dst, - const Vector &src) const +void RelaxationBlockJacobi::Tstep +(Vector &dst, + const Vector &src) const { GrowingVectorMemory > mem; typename VectorMemory >::Pointer aux = mem; @@ -249,21 +247,21 @@ void RelaxationBlockJacobi::Tstep ( //----------------------------------------------------------------------// -template +template template -void RelaxationBlockSOR::step ( - Vector &dst, - const Vector &src) const +void RelaxationBlockSOR::step +(Vector &dst, + const Vector &src) const { this->do_step(dst, dst, src, false); } -template +template template -void RelaxationBlockSOR::Tstep ( - Vector &dst, - const Vector &src) const +void RelaxationBlockSOR::Tstep +(Vector &dst, + const Vector &src) const { this->do_step(dst, dst, src, true); } @@ -271,22 +269,22 @@ void RelaxationBlockSOR::Tstep ( //----------------------------------------------------------------------// -template +template template -void RelaxationBlockSSOR::step ( - Vector &dst, - const Vector &src) const +void RelaxationBlockSSOR::step +(Vector &dst, + const Vector &src) const { this->do_step(dst, dst, src, false); this->do_step(dst, dst, src, true); } -template +template template -void RelaxationBlockSSOR::Tstep ( - Vector &dst, - const Vector &src) const +void RelaxationBlockSSOR::Tstep +(Vector &dst, + const Vector &src) const { this->do_step(dst, dst, src, true); this->do_step(dst, dst, src, false); diff --git a/include/deal.II/lac/shifted_matrix.h b/include/deal.II/lac/shifted_matrix.h index d754edb124..38ff84a326 100644 --- a/include/deal.II/lac/shifted_matrix.h +++ b/include/deal.II/lac/shifted_matrix.h @@ -39,14 +39,14 @@ DEAL_II_NAMESPACE_OPEN * * @author Guido Kanschat, 2000, 2001 */ -template +template class ShiftedMatrix { public: /** * Constructor. Provide the base matrix and a shift parameter. */ - ShiftedMatrix (const MATRIX &A, const double sigma); + ShiftedMatrix (const MatrixType &A, const double sigma); /** * Set the shift parameter. @@ -74,7 +74,7 @@ private: /** * Storage for base matrix. */ - SmartPointer > A; + SmartPointer > A; /** * Auxiliary vector. @@ -103,16 +103,16 @@ private: * * @author Guido Kanschat, 2001 */ -template +template class ShiftedMatrixGeneralized { public: /** * Constructor. Provide the base matrix and a shift parameter. */ - ShiftedMatrixGeneralized (const MATRIX &A, - const MASSMATRIX &M, - const double sigma); + ShiftedMatrixGeneralized (const MatrixType &A, + const MASSMatrixType &M, + const double sigma); /** * Set the shift parameter. @@ -138,11 +138,11 @@ private: /** * Storage for base matrix. */ - SmartPointer > A; + SmartPointer > A; /** * Storage for mass matrix. */ - SmartPointer > M; + SmartPointer > M; /** * Auxiliary vector. @@ -159,36 +159,37 @@ private: /*@}*/ //--------------------------------------------------------------------------- -template +template inline -ShiftedMatrix::ShiftedMatrix (const MATRIX &A, const double sigma) +ShiftedMatrix::ShiftedMatrix (const MatrixType &A, + const double sigma) : A(&A), sigma(sigma) {} -template +template inline void -ShiftedMatrix::shift (const double s) +ShiftedMatrix::shift (const double s) { sigma = s; } -template +template inline double -ShiftedMatrix::shift () const +ShiftedMatrix::shift () const { return sigma; } -template +template template inline void -ShiftedMatrix::vmult (VectorType &dst, const VectorType &src) const +ShiftedMatrix::vmult (VectorType &dst, const VectorType &src) const { A->vmult(dst, src); if (sigma != 0.) @@ -196,12 +197,12 @@ ShiftedMatrix::vmult (VectorType &dst, const VectorType &src) const } -template +template template inline double -ShiftedMatrix::residual (VectorType &dst, - const VectorType &src, - const VectorType &rhs) const +ShiftedMatrix::residual (VectorType &dst, + const VectorType &src, + const VectorType &rhs) const { A->vmult(dst, src); if (sigma != 0.) @@ -212,36 +213,37 @@ ShiftedMatrix::residual (VectorType &dst, //--------------------------------------------------------------------------- -template +template inline -ShiftedMatrixGeneralized -::ShiftedMatrixGeneralized (const MATRIX &A, - const MASSMATRIX &M, - const double sigma) +ShiftedMatrixGeneralized +::ShiftedMatrixGeneralized (const MatrixType &A, + const MASSMatrixType &M, + const double sigma) : A(&A), M(&M), sigma(sigma) {} -template +template inline void -ShiftedMatrixGeneralized::shift (const double s) +ShiftedMatrixGeneralized::shift (const double s) { sigma = s; } -template +template inline double -ShiftedMatrixGeneralized::shift () const +ShiftedMatrixGeneralized::shift () const { return sigma; } -template +template inline void -ShiftedMatrixGeneralized::vmult (VectorType &dst, - const VectorType &src) const +ShiftedMatrixGeneralized::vmult +(VectorType &dst, + const VectorType &src) const { A->vmult(dst, src); if (sigma != 0.) @@ -253,11 +255,12 @@ ShiftedMatrixGeneralized::vmult (VectorType } -template +template inline double -ShiftedMatrixGeneralized::residual (VectorType &dst, - const VectorType &src, - const VectorType &rhs) const +ShiftedMatrixGeneralized::residual +(VectorType &dst, + const VectorType &src, + const VectorType &rhs) const { A->vmult(dst, src); if (sigma != 0.) diff --git a/include/deal.II/lac/solver_bicgstab.h b/include/deal.II/lac/solver_bicgstab.h index 40f6852931..0ffc4ab648 100644 --- a/include/deal.II/lac/solver_bicgstab.h +++ b/include/deal.II/lac/solver_bicgstab.h @@ -128,9 +128,9 @@ public: /** * Solve primal problem only. */ - template + template void - solve (const MATRIX &A, + solve (const MatrixType &A, VectorType &x, const VectorType &b, const PRECONDITIONER &precondition); @@ -139,8 +139,8 @@ protected: /** * Computation of the stopping criterion. */ - template - double criterion (const MATRIX &A, const VectorType &x, const VectorType &b); + template + double criterion (const MatrixType &A, const VectorType &x, const VectorType &b); /** * Interface for derived class. This function gets the current iteration @@ -229,8 +229,8 @@ private: /** * Everything before the iteration loop. */ - template - SolverControl::State start(const MATRIX &A); + template + SolverControl::State start(const MatrixType &A); /** * A structure returned by the iterate() function representing what it found @@ -253,9 +253,9 @@ private: * The iteration loop itself. The function returns a structure indicating * what happened in this function. */ - template + template IterationResult - iterate(const MATRIX &A, + iterate(const MatrixType &A, const PRECONDITIONER &precondition); }; @@ -307,9 +307,11 @@ SolverBicgstab::~SolverBicgstab () template -template +template double -SolverBicgstab::criterion (const MATRIX &A, const VectorType &x, const VectorType &b) +SolverBicgstab::criterion (const MatrixType &A, + const VectorType &x, + const VectorType &b) { A.vmult(*Vt, x); Vt->add(-1.,b); @@ -321,9 +323,9 @@ SolverBicgstab::criterion (const MATRIX &A, const VectorType &x, con template -template +template SolverControl::State -SolverBicgstab::start(const MATRIX &A) +SolverBicgstab::start (const MatrixType &A) { A.vmult(*Vr, *Vx); Vr->sadd(-1.,1.,*Vb); @@ -345,9 +347,9 @@ SolverBicgstab::print_vectors(const unsigned int, template -template +template typename SolverBicgstab::IterationResult -SolverBicgstab::iterate(const MATRIX &A, +SolverBicgstab::iterate(const MatrixType &A, const PRECONDITIONER &precondition) { //TODO:[GK] Implement "use the length of the computed orthogonal residual" in the BiCGStab method. @@ -432,9 +434,9 @@ SolverBicgstab::iterate(const MATRIX &A, template -template +template void -SolverBicgstab::solve(const MATRIX &A, +SolverBicgstab::solve(const MatrixType &A, VectorType &x, const VectorType &b, const PRECONDITIONER &precondition) diff --git a/include/deal.II/lac/solver_cg.h b/include/deal.II/lac/solver_cg.h index 2829124fcc..942ca5429b 100644 --- a/include/deal.II/lac/solver_cg.h +++ b/include/deal.II/lac/solver_cg.h @@ -175,9 +175,9 @@ public: /** * Solve the linear system $Ax=b$ for x. */ - template + template void - solve (const MATRIX &A, + solve (const MatrixType &A, VectorType &x, const VectorType &b, const PRECONDITIONER &precondition); @@ -453,9 +453,9 @@ SolverCG::compute_eigs_and_cond template -template +template void -SolverCG::solve (const MATRIX &A, +SolverCG::solve (const MatrixType &A, VectorType &x, const VectorType &b, const PRECONDITIONER &precondition) diff --git a/include/deal.II/lac/solver_gmres.h b/include/deal.II/lac/solver_gmres.h index 650b7411b1..2a9ec8ce1d 100644 --- a/include/deal.II/lac/solver_gmres.h +++ b/include/deal.II/lac/solver_gmres.h @@ -259,9 +259,9 @@ public: /** * Solve the linear system $Ax=b$ for x. */ - template + template void - solve (const MATRIX &A, + solve (const MatrixType &A, VectorType &x, const VectorType &b, const PRECONDITIONER &precondition); @@ -452,9 +452,9 @@ public: /** * Solve the linear system $Ax=b$ for x. */ - template + template void - solve (const MATRIX &A, + solve (const MatrixType &A, VectorType &x, const VectorType &b, const PRECONDITIONER &precondition); @@ -746,9 +746,9 @@ SolverGMRES::compute_eigs_and_cond template -template +template void -SolverGMRES::solve (const MATRIX &A, +SolverGMRES::solve (const MatrixType &A, VectorType &x, const VectorType &b, const PRECONDITIONER &precondition) @@ -1114,9 +1114,9 @@ SolverFGMRES::SolverFGMRES (SolverControl &cn, template -template +template void -SolverFGMRES::solve (const MATRIX &A, +SolverFGMRES::solve (const MatrixType &A, VectorType &x, const VectorType &b, const PRECONDITIONER &precondition) diff --git a/include/deal.II/lac/solver_minres.h b/include/deal.II/lac/solver_minres.h index 05d14847a1..c334cd7f21 100644 --- a/include/deal.II/lac/solver_minres.h +++ b/include/deal.II/lac/solver_minres.h @@ -98,9 +98,9 @@ public: /** * Solve the linear system $Ax=b$ for x. */ - template + template void - solve (const MATRIX &A, + solve (const MatrixType &A, VectorType &x, const VectorType &b, const PRECONDITIONER &precondition); @@ -196,9 +196,9 @@ SolverMinRes::print_vectors(const unsigned int, template -template +template void -SolverMinRes::solve (const MATRIX &A, +SolverMinRes::solve (const MatrixType &A, VectorType &x, const VectorType &b, const PRECONDITIONER &precondition) diff --git a/include/deal.II/lac/solver_qmrs.h b/include/deal.II/lac/solver_qmrs.h index 5f20184ae9..dc128bb2ef 100644 --- a/include/deal.II/lac/solver_qmrs.h +++ b/include/deal.II/lac/solver_qmrs.h @@ -125,9 +125,9 @@ public: /** * Solve the linear system $Ax=b$ for x. */ - template + template void - solve (const MATRIX &A, + solve (const MatrixType &A, VectorType &x, const VectorType &b, const PRECONDITIONER &precondition); @@ -198,9 +198,9 @@ private: * The iteration loop itself. The function returns a structure indicating * what happened in this function. */ - template + template IterationResult - iterate (const MATRIX &A, + iterate (const MatrixType &A, const PRECONDITIONER &precondition); /** @@ -264,9 +264,9 @@ SolverQMRS::print_vectors(const unsigned int, template -template +template void -SolverQMRS::solve (const MATRIX &A, +SolverQMRS::solve (const MatrixType &A, VectorType &x, const VectorType &b, const PRECONDITIONER &precondition) @@ -322,9 +322,9 @@ SolverQMRS::solve (const MATRIX &A, template -template +template typename SolverQMRS::IterationResult -SolverQMRS::iterate(const MATRIX &A, +SolverQMRS::iterate(const MatrixType &A, const PRECONDITIONER &precondition) { /* Remark: the matrix A in the article is the preconditioned matrix. diff --git a/include/deal.II/lac/solver_relaxation.h b/include/deal.II/lac/solver_relaxation.h index b371f63df8..1c67e3080e 100644 --- a/include/deal.II/lac/solver_relaxation.h +++ b/include/deal.II/lac/solver_relaxation.h @@ -79,9 +79,9 @@ public: * R(x_k,b)$. The matrix A itself is only used to compute the * residual. */ - template + template void - solve (const MATRIX &A, + solve (const MatrixType &A, VectorType &x, const VectorType &b, const RELAXATION &R); @@ -104,9 +104,9 @@ SolverRelaxation::~SolverRelaxation() template -template +template void -SolverRelaxation::solve (const MATRIX &A, +SolverRelaxation::solve (const MatrixType &A, VectorType &x, const VectorType &b, const RELAXATION &R) diff --git a/include/deal.II/lac/solver_richardson.h b/include/deal.II/lac/solver_richardson.h index ac8e3e1144..34d6bb9638 100644 --- a/include/deal.II/lac/solver_richardson.h +++ b/include/deal.II/lac/solver_richardson.h @@ -107,9 +107,9 @@ public: /** * Solve the linear system $Ax=b$ for x. */ - template + template void - solve (const MATRIX &A, + solve (const MatrixType &A, VectorType &x, const VectorType &b, const PRECONDITIONER &precondition); @@ -117,9 +117,9 @@ public: /** * Solve $A^Tx=b$ for $x$. */ - template + template void - Tsolve (const MATRIX &A, + Tsolve (const MatrixType &A, VectorType &x, const VectorType &b, const PRECONDITIONER &precondition); @@ -214,9 +214,9 @@ SolverRichardson::~SolverRichardson() template -template +template void -SolverRichardson::solve (const MATRIX &A, +SolverRichardson::solve (const MatrixType &A, VectorType &x, const VectorType &b, const PRECONDITIONER &precondition) @@ -285,9 +285,9 @@ SolverRichardson::solve (const MATRIX &A, template -template +template void -SolverRichardson::Tsolve (const MATRIX &A, +SolverRichardson::Tsolve (const MatrixType &A, VectorType &x, const VectorType &b, const PRECONDITIONER &precondition) diff --git a/include/deal.II/lac/sparse_matrix_ez.h b/include/deal.II/lac/sparse_matrix_ez.h index ad4f3b2c5e..b75558a04d 100644 --- a/include/deal.II/lac/sparse_matrix_ez.h +++ b/include/deal.II/lac/sparse_matrix_ez.h @@ -539,9 +539,9 @@ public: * * The function returns a reference to @p this. */ - template + template SparseMatrixEZ & - copy_from (const MATRIX &source, const bool elide_zero_values = true); + copy_from (const MatrixType &source, const bool elide_zero_values = true); /** * Add @p matrix scaled by @p factor to this matrix. @@ -550,9 +550,9 @@ public: * type is convertible to the data type of this matrix and it has the * standard @p const_iterator. */ - template - void add (const number factor, - const MATRIX &matrix); + template + void add (const number factor, + const MatrixType &matrix); //@} /** * @name Entry Access @@ -673,10 +673,10 @@ public: * matrix entries and that @p A has a function el(i,j) for access * to a specific entry. */ - template - void conjugate_add (const MATRIXA &A, - const MATRIXB &B, - const bool transpose = false); + template + void conjugate_add (const MatrixTypeA &A, + const MatrixTypeB &B, + const bool transpose = false); //@} /** * @name Iterators @@ -1392,10 +1392,10 @@ SparseMatrixEZ::end (const size_type r) const } template -template +template inline SparseMatrixEZ & -SparseMatrixEZ::copy_from (const MATRIX &M, const bool elide_zero_values) +SparseMatrixEZ::copy_from (const MatrixType &M, const bool elide_zero_values) { reinit(M.m(), M.n(), @@ -1407,8 +1407,8 @@ SparseMatrixEZ::copy_from (const MATRIX &M, const bool elide_zero_values // copy them into the current object for (size_type row = 0; row < M.m(); ++row) { - const typename MATRIX::const_iterator end_row = M.end(row); - for (typename MATRIX::const_iterator entry = M.begin(row); + const typename MatrixType::const_iterator end_row = M.end(row); + for (typename MatrixType::const_iterator entry = M.begin(row); entry != end_row; ++entry) set(row, entry->column(), entry->value(), elide_zero_values); } @@ -1417,11 +1417,11 @@ SparseMatrixEZ::copy_from (const MATRIX &M, const bool elide_zero_values } template -template +template inline void -SparseMatrixEZ::add (const number factor, - const MATRIX &M) +SparseMatrixEZ::add (const number factor, + const MatrixType &M) { Assert (M.m() == m(), ExcDimensionMismatch(M.m(), m())); Assert (M.n() == n(), ExcDimensionMismatch(M.n(), n())); @@ -1434,8 +1434,8 @@ SparseMatrixEZ::add (const number factor, // add them into the current object for (size_type row = 0; row < M.m(); ++row) { - const typename MATRIX::const_iterator end_row = M.end(row); - for (typename MATRIX::const_iterator entry = M.begin(row); + const typename MatrixType::const_iterator end_row = M.end(row); + for (typename MatrixType::const_iterator entry = M.begin(row); entry != end_row; ++entry) if (entry->value() != 0) add(row, entry->column(), factor * entry->value()); @@ -1445,11 +1445,11 @@ SparseMatrixEZ::add (const number factor, template -template +template inline void -SparseMatrixEZ::conjugate_add (const MATRIXA &A, - const MATRIXB &B, - const bool transpose) +SparseMatrixEZ::conjugate_add (const MatrixTypeA &A, + const MatrixTypeB &B, + const bool transpose) { // Compute the result // r_ij = \sum_kl b_ik b_jl a_kl @@ -1467,20 +1467,20 @@ SparseMatrixEZ::conjugate_add (const MATRIXA &A, // corresponding rows of B only. // For the non-transpose case, we // must find a trick. - typename MATRIXB::const_iterator b1 = B.begin(); - const typename MATRIXB::const_iterator b_final = B.end(); + typename MatrixTypeB::const_iterator b1 = B.begin(); + const typename MatrixTypeB::const_iterator b_final = B.end(); if (transpose) while (b1 != b_final) { const size_type i = b1->column(); const size_type k = b1->row(); - typename MATRIXB::const_iterator b2 = B.begin(); + typename MatrixTypeB::const_iterator b2 = B.begin(); while (b2 != b_final) { const size_type j = b2->column(); const size_type l = b2->row(); - const typename MATRIXA::value_type a = A.el(k,l); + const typename MatrixTypeA::value_type a = A.el(k,l); if (a != 0.) add (i, j, a * b1->value() * b2->value()); @@ -1506,12 +1506,12 @@ SparseMatrixEZ::conjugate_add (const MATRIXA &A, ++b1; } - typename MATRIXA::const_iterator ai = A.begin(); - const typename MATRIXA::const_iterator ae = A.end(); + typename MatrixTypeA::const_iterator ai = A.begin(); + const typename MatrixTypeA::const_iterator ae = A.end(); while (ai != ae) { - const typename MATRIXA::value_type a = ai->value(); + const typename MatrixTypeA::value_type a = ai->value(); // Don't do anything if // this entry is zero. if (a == 0.) continue; @@ -1521,9 +1521,9 @@ SparseMatrixEZ::conjugate_add (const MATRIXA &A, // nonzero entry in column // ai->row() b1 = B.begin(minrow[ai->row()]); - const typename MATRIXB::const_iterator + const typename MatrixTypeB::const_iterator be1 = B.end(maxrow[ai->row()]); - const typename MATRIXB::const_iterator + const typename MatrixTypeB::const_iterator be2 = B.end(maxrow[ai->column()]); while (b1 != be1) @@ -1537,7 +1537,7 @@ SparseMatrixEZ::conjugate_add (const MATRIXA &A, { const size_type i = b1->row(); - typename MATRIXB::const_iterator + typename MatrixTypeB::const_iterator b2 = B.begin(minrow[ai->column()]); while (b2 != be2) { diff --git a/include/deal.II/lac/transpose_matrix.h b/include/deal.II/lac/transpose_matrix.h index 34ccd08d7d..bfb4790480 100644 --- a/include/deal.II/lac/transpose_matrix.h +++ b/include/deal.II/lac/transpose_matrix.h @@ -40,7 +40,7 @@ DEAL_II_NAMESPACE_OPEN * @ingroup Matrix2 * @author Guido Kanschat, 2006 */ -template +template class TransposeMatrix : public PointerMatrixBase { @@ -52,7 +52,7 @@ public: * * If M is zero, no matrix is stored. */ - TransposeMatrix (const MATRIX *M=0); + TransposeMatrix (const MatrixType *M=0); /** * Constructor. The name argument is used to identify the SmartPointer for @@ -65,8 +65,8 @@ public: * the TransposeMatrix. The name argument is used to identify the * SmartPointer for this object. */ - TransposeMatrix(const MATRIX *M, - const char *name); + TransposeMatrix(const MatrixType *M, + const char *name); // Use doc from base class virtual void clear(); @@ -81,7 +81,7 @@ public: * matrix. * @see SmartPointer */ - const TransposeMatrix &operator= (const MATRIX *M); + const TransposeMatrix &operator= (const MatrixType *M); /** * Matrix-vector product. @@ -111,93 +111,92 @@ private: /** * The pointer to the actual matrix. */ - SmartPointer > m; + SmartPointer > m; }; //----------------------------------------------------------------------// -template -TransposeMatrix::TransposeMatrix (const MATRIX *M) +template +TransposeMatrix::TransposeMatrix (const MatrixType *M) : m(M) {} -template -TransposeMatrix::TransposeMatrix (const char *name) +template +TransposeMatrix::TransposeMatrix (const char *name) : m(0, name) {} -template -TransposeMatrix::TransposeMatrix ( - const MATRIX *M, - const char *name) +template +TransposeMatrix::TransposeMatrix (const MatrixType *M, + const char *name) : m(M, name) {} -template +template inline void -TransposeMatrix::clear () +TransposeMatrix::clear () { m = 0; } -template -inline const TransposeMatrix & -TransposeMatrix::operator= (const MATRIX *M) +template +inline const TransposeMatrix & +TransposeMatrix::operator= (const MatrixType *M) { m = M; return *this; } -template +template inline bool -TransposeMatrix::empty () const +TransposeMatrix::empty () const { if (m == 0) return true; return m->empty(); } -template +template inline void -TransposeMatrix::vmult (VectorType &dst, - const VectorType &src) const +TransposeMatrix::vmult (VectorType &dst, + const VectorType &src) const { Assert (m != 0, ExcNotInitialized()); m->Tvmult (dst, src); } -template +template inline void -TransposeMatrix::Tvmult (VectorType &dst, - const VectorType &src) const +TransposeMatrix::Tvmult (VectorType &dst, + const VectorType &src) const { Assert (m != 0, ExcNotInitialized()); m->vmult (dst, src); } -template +template inline void -TransposeMatrix::vmult_add (VectorType &dst, - const VectorType &src) const +TransposeMatrix::vmult_add (VectorType &dst, + const VectorType &src) const { Assert (m != 0, ExcNotInitialized()); m->Tvmult_add (dst, src); } -template +template inline void -TransposeMatrix::Tvmult_add (VectorType &dst, - const VectorType &src) const +TransposeMatrix::Tvmult_add (VectorType &dst, + const VectorType &src) const { Assert (m != 0, ExcNotInitialized()); m->vmult_add (dst, src); diff --git a/include/deal.II/meshworker/assembler.h b/include/deal.II/meshworker/assembler.h index 9d1e78e04e..b63c138c83 100644 --- a/include/deal.II/meshworker/assembler.h +++ b/include/deal.II/meshworker/assembler.h @@ -93,8 +93,8 @@ namespace MeshWorker * used locally. * * In the block model, each of the blocks of the local vectors corresponds - * to the restriction of a single block of the system to this cell ( - * @ref GlossBlock). + * to the restriction of a single block of the system to this cell + (* @ref GlossBlock). * Thus, the size of this local block is the number of degrees of freedom * of the corresponding base element of the FESystem. * @@ -192,7 +192,7 @@ namespace MeshWorker * @ingroup MeshWorker * @author Guido Kanschat, 2009 */ - template + template class MatrixLocalBlocksToGlobalBlocks { public: @@ -207,7 +207,7 @@ namespace MeshWorker * initialize cell matrix vectors. */ void initialize(const BlockInfo *block_info, - MatrixBlockVector &matrices); + MatrixBlockVector &matrices); /** * Initialize the constraints. @@ -241,30 +241,29 @@ namespace MeshWorker /** * Assemble a single local matrix into a global one. */ - void assemble( - MatrixBlock &global, - const FullMatrix &local, - const unsigned int block_row, - const unsigned int block_col, - const std::vector &dof1, - const std::vector &dof2); + void assemble(MatrixBlock &global, + const FullMatrix &local, + const unsigned int block_row, + const unsigned int block_col, + const std::vector &dof1, + const std::vector &dof2); /** * The global matrices, stored as a vector of pointers. */ - SmartPointer, - MatrixLocalBlocksToGlobalBlocks > matrices; + SmartPointer, + MatrixLocalBlocksToGlobalBlocks > matrices; /** * A pointer to the object containing the block structure. */ SmartPointer > block_info; + MatrixLocalBlocksToGlobalBlocks > block_info; /** * A pointer to the object containing constraints. */ SmartPointer > constraints; + MatrixLocalBlocksToGlobalBlocks > constraints; /** * The smallest positive number that will be entered into the global @@ -299,12 +298,12 @@ namespace MeshWorker * @ingroup MeshWorker * @author Guido Kanschat, 2009 */ - template + template class MGMatrixLocalBlocksToGlobalBlocks { public: - typedef MGMatrixBlockVector MatrixPtrVector; - typedef SmartPointer > + typedef MGMatrixBlockVector MatrixPtrVector; + typedef SmartPointer > MatrixPtrVectorPtr; /** @@ -366,81 +365,75 @@ namespace MeshWorker /** * Assemble a single local matrix into a global one. */ - void assemble( - MATRIX &global, - const FullMatrix &local, - const unsigned int block_row, - const unsigned int block_col, - const std::vector &dof1, - const std::vector &dof2, - const unsigned int level1, - const unsigned int level2, - bool transpose = false); + void assemble(MatrixType &global, + const FullMatrix &local, + const unsigned int block_row, + const unsigned int block_col, + const std::vector &dof1, + const std::vector &dof2, + const unsigned int level1, + const unsigned int level2, + bool transpose = false); /** * Assemble a single local matrix into a global one. */ - void assemble_fluxes( - MATRIX &global, - const FullMatrix &local, - const unsigned int block_row, - const unsigned int block_col, - const std::vector &dof1, - const std::vector &dof2, - const unsigned int level1, - const unsigned int level2); + void assemble_fluxes(MatrixType &global, + const FullMatrix &local, + const unsigned int block_row, + const unsigned int block_col, + const std::vector &dof1, + const std::vector &dof2, + const unsigned int level1, + const unsigned int level2); /** * Assemble a single local matrix into a global one. */ - void assemble_up( - MATRIX &global, - const FullMatrix &local, - const unsigned int block_row, - const unsigned int block_col, - const std::vector &dof1, - const std::vector &dof2, - const unsigned int level1, - const unsigned int level2); + void assemble_up(MatrixType &global, + const FullMatrix &local, + const unsigned int block_row, + const unsigned int block_col, + const std::vector &dof1, + const std::vector &dof2, + const unsigned int level1, + const unsigned int level2); /** * Assemble a single local matrix into a global one. */ - void assemble_down( - MATRIX &global, - const FullMatrix &local, - const unsigned int block_row, - const unsigned int block_col, - const std::vector &dof1, - const std::vector &dof2, - const unsigned int level1, - const unsigned int level2); + void assemble_down(MatrixType &global, + const FullMatrix &local, + const unsigned int block_row, + const unsigned int block_col, + const std::vector &dof1, + const std::vector &dof2, + const unsigned int level1, + const unsigned int level2); /** * Assemble a single local matrix into a global one. */ - void assemble_in( - MATRIX &global, - const FullMatrix &local, - const unsigned int block_row, - const unsigned int block_col, - const std::vector &dof1, - const std::vector &dof2, - const unsigned int level1, - const unsigned int level2); + void assemble_in(MatrixType &global, + const FullMatrix &local, + const unsigned int block_row, + const unsigned int block_col, + const std::vector &dof1, + const std::vector &dof2, + const unsigned int level1, + const unsigned int level2); /** * Assemble a single local matrix into a global one. */ - void assemble_out( - MATRIX &global, - const FullMatrix &local, - const unsigned int block_row, - const unsigned int block_col, - const std::vector &dof1, - const std::vector &dof2, - const unsigned int level1, - const unsigned int level2); + void assemble_out(MatrixType &global, + const FullMatrix &local, + const unsigned int block_row, + const unsigned int block_col, + const std::vector &dof1, + const std::vector &dof2, + const unsigned int level1, + const unsigned int level2); /** * The level matrices, stored as a vector of pointers. @@ -474,12 +467,12 @@ namespace MeshWorker /** * A pointer to the object containing the block structure. */ - SmartPointer > block_info; + SmartPointer > block_info; /** * A pointer to the object containing constraints. */ - SmartPointer > mg_constrained_dofs; + SmartPointer > mg_constrained_dofs; /** @@ -577,20 +570,20 @@ namespace MeshWorker //----------------------------------------------------------------------// - template + template inline - MatrixLocalBlocksToGlobalBlocks::MatrixLocalBlocksToGlobalBlocks( - double threshold) + MatrixLocalBlocksToGlobalBlocks::MatrixLocalBlocksToGlobalBlocks + (double threshold) : threshold(threshold) {} - template + template inline void - MatrixLocalBlocksToGlobalBlocks::initialize( - const BlockInfo *b, - MatrixBlockVector &m) + MatrixLocalBlocksToGlobalBlocks::initialize + (const BlockInfo *b, + MatrixBlockVector &m) { block_info = b; matrices = &m; @@ -598,37 +591,37 @@ namespace MeshWorker - template + template inline void - MatrixLocalBlocksToGlobalBlocks::initialize( - const ConstraintMatrix &c) + MatrixLocalBlocksToGlobalBlocks::initialize + (const ConstraintMatrix &c) { constraints = &c; } - template + template template inline void - MatrixLocalBlocksToGlobalBlocks::initialize_info( - DOFINFO &info, - bool face) const + MatrixLocalBlocksToGlobalBlocks::initialize_info + (DOFINFO &info, + bool face) const { info.initialize_matrices(*matrices, face); } - template + template inline void - MatrixLocalBlocksToGlobalBlocks::assemble( - MatrixBlock &global, - const FullMatrix &local, - const unsigned int block_row, - const unsigned int block_col, - const std::vector &dof1, - const std::vector &dof2) + MatrixLocalBlocksToGlobalBlocks::assemble + (MatrixBlock &global, + const FullMatrix &local, + const unsigned int block_row, + const unsigned int block_col, + const std::vector &dof1, + const std::vector &dof2) { if (constraints == 0) { @@ -667,11 +660,10 @@ namespace MeshWorker } - template + template template inline void - MatrixLocalBlocksToGlobalBlocks::assemble( - const DOFINFO &info) + MatrixLocalBlocksToGlobalBlocks::assemble (const DOFINFO &info) { for (unsigned int i=0; isize(); ++i) { @@ -685,12 +677,11 @@ namespace MeshWorker } - template + template template inline void - MatrixLocalBlocksToGlobalBlocks::assemble( - const DOFINFO &info1, - const DOFINFO &info2) + MatrixLocalBlocksToGlobalBlocks::assemble (const DOFINFO &info1, + const DOFINFO &info2) { for (unsigned int i=0; isize(); ++i) { @@ -709,20 +700,20 @@ namespace MeshWorker // ----------------------------------------------------------------------// - template + template inline - MGMatrixLocalBlocksToGlobalBlocks::MGMatrixLocalBlocksToGlobalBlocks( - double threshold) + MGMatrixLocalBlocksToGlobalBlocks::MGMatrixLocalBlocksToGlobalBlocks + (double threshold) : threshold(threshold) {} - template + template inline void - MGMatrixLocalBlocksToGlobalBlocks::initialize( - const BlockInfo *b, - MatrixPtrVector &m) + MGMatrixLocalBlocksToGlobalBlocks::initialize + (const BlockInfo *b, + MatrixPtrVector &m) { block_info = b; AssertDimension(block_info->local().size(), block_info->global().size()); @@ -730,61 +721,61 @@ namespace MeshWorker } - template + template inline void - MGMatrixLocalBlocksToGlobalBlocks::initialize( - const MGConstrainedDoFs &mg_c) + MGMatrixLocalBlocksToGlobalBlocks::initialize + (const MGConstrainedDoFs &mg_c) { mg_constrained_dofs = &mg_c; } - template + template template inline void - MGMatrixLocalBlocksToGlobalBlocks::initialize_info( - DOFINFO &info, - bool face) const + MGMatrixLocalBlocksToGlobalBlocks::initialize_info + (DOFINFO &info, + bool face) const { info.initialize_matrices(*matrices, face); } - template + template inline void - MGMatrixLocalBlocksToGlobalBlocks::initialize_edge_flux( - MatrixPtrVector &up, - MatrixPtrVector &down) + MGMatrixLocalBlocksToGlobalBlocks::initialize_edge_flux + (MatrixPtrVector &up, + MatrixPtrVector &down) { flux_up = up; flux_down = down; } - template + template inline void - MGMatrixLocalBlocksToGlobalBlocks::initialize_interfaces( - MatrixPtrVector &in, - MatrixPtrVector &out) + MGMatrixLocalBlocksToGlobalBlocks::initialize_interfaces + (MatrixPtrVector &in, + MatrixPtrVector &out) { interface_in = in; interface_out = out; } - template + template inline void - MGMatrixLocalBlocksToGlobalBlocks::assemble( - MATRIX &global, - const FullMatrix &local, - const unsigned int block_row, - const unsigned int block_col, - const std::vector &dof1, - const std::vector &dof2, - const unsigned int level1, - const unsigned int level2, - bool transpose) + MGMatrixLocalBlocksToGlobalBlocks::assemble + (MatrixType &global, + const FullMatrix &local, + const unsigned int block_row, + const unsigned int block_col, + const std::vector &dof1, + const std::vector &dof2, + const unsigned int level1, + const unsigned int level2, + bool transpose) { for (unsigned int j=0; j + template inline void - MGMatrixLocalBlocksToGlobalBlocks::assemble_fluxes( - MATRIX &global, - const FullMatrix &local, - const unsigned int block_row, - const unsigned int block_col, - const std::vector &dof1, - const std::vector &dof2, - const unsigned int level1, - const unsigned int level2) + MGMatrixLocalBlocksToGlobalBlocks::assemble_fluxes + (MatrixType &global, + const FullMatrix &local, + const unsigned int block_row, + const unsigned int block_col, + const std::vector &dof1, + const std::vector &dof2, + const unsigned int level1, + const unsigned int level2) { for (unsigned int j=0; j + template inline void - MGMatrixLocalBlocksToGlobalBlocks::assemble_up( - MATRIX &global, - const FullMatrix &local, - const unsigned int block_row, - const unsigned int block_col, - const std::vector &dof1, - const std::vector &dof2, - const unsigned int level1, - const unsigned int level2) + MGMatrixLocalBlocksToGlobalBlocks::assemble_up + (MatrixType &global, + const FullMatrix &local, + const unsigned int block_row, + const unsigned int block_col, + const std::vector &dof1, + const std::vector &dof2, + const unsigned int level1, + const unsigned int level2) { for (unsigned int j=0; j + template inline void - MGMatrixLocalBlocksToGlobalBlocks::assemble_down( - MATRIX &global, - const FullMatrix &local, - const unsigned int block_row, - const unsigned int block_col, - const std::vector &dof1, - const std::vector &dof2, - const unsigned int level1, - const unsigned int level2) + MGMatrixLocalBlocksToGlobalBlocks::assemble_down + (MatrixType &global, + const FullMatrix &local, + const unsigned int block_row, + const unsigned int block_col, + const std::vector &dof1, + const std::vector &dof2, + const unsigned int level1, + const unsigned int level2) { for (unsigned int j=0; j + template inline void - MGMatrixLocalBlocksToGlobalBlocks::assemble_in( - MATRIX &global, - const FullMatrix &local, - const unsigned int block_row, - const unsigned int block_col, - const std::vector &dof1, - const std::vector &dof2, - const unsigned int level1, - const unsigned int level2) + MGMatrixLocalBlocksToGlobalBlocks::assemble_in + (MatrixType &global, + const FullMatrix &local, + const unsigned int block_row, + const unsigned int block_col, + const std::vector &dof1, + const std::vector &dof2, + const unsigned int level1, + const unsigned int level2) { // AssertDimension(local.n(), dof1.size()); // AssertDimension(local.m(), dof2.size()); @@ -1076,17 +1067,17 @@ namespace MeshWorker } } - template + template inline void - MGMatrixLocalBlocksToGlobalBlocks::assemble_out( - MATRIX &global, - const FullMatrix &local, - const unsigned int block_row, - const unsigned int block_col, - const std::vector &dof1, - const std::vector &dof2, - const unsigned int level1, - const unsigned int level2) + MGMatrixLocalBlocksToGlobalBlocks::assemble_out + (MatrixType &global, + const FullMatrix &local, + const unsigned int block_row, + const unsigned int block_col, + const std::vector &dof1, + const std::vector &dof2, + const unsigned int level1, + const unsigned int level2) { // AssertDimension(local.n(), dof1.size()); // AssertDimension(local.m(), dof2.size()); @@ -1142,10 +1133,10 @@ namespace MeshWorker } - template + template template inline void - MGMatrixLocalBlocksToGlobalBlocks::assemble(const DOFINFO &info) + MGMatrixLocalBlocksToGlobalBlocks::assemble(const DOFINFO &info) { const unsigned int level = info.cell->level(); @@ -1176,19 +1167,19 @@ namespace MeshWorker } - template + template template inline void - MGMatrixLocalBlocksToGlobalBlocks::assemble( - const DOFINFO &info1, - const DOFINFO &info2) + MGMatrixLocalBlocksToGlobalBlocks::assemble + (const DOFINFO &info1, + const DOFINFO &info2) { const unsigned int level1 = info1.cell->level(); const unsigned int level2 = info2.cell->level(); for (unsigned int i=0; isize(); ++i) { - MGLevelObject > &o = matrices->block(i); + MGLevelObject > &o = matrices->block(i); // Row and column index of // the block we are dealing with diff --git a/include/deal.II/meshworker/local_results.h b/include/deal.II/meshworker/local_results.h index d518774741..637103a126 100644 --- a/include/deal.II/meshworker/local_results.h +++ b/include/deal.II/meshworker/local_results.h @@ -321,8 +321,8 @@ namespace MeshWorker * * @note This function is usually only called by the assembler. */ - template - void initialize_matrices(const MatrixBlockVector &matrices, + template + void initialize_matrices(const MatrixBlockVector &matrices, bool both); /** @@ -332,8 +332,8 @@ namespace MeshWorker * * @note This function is usually only called by the assembler. */ - template - void initialize_matrices(const MGMatrixBlockVector &matrices, + template + void initialize_matrices(const MGMatrixBlockVector &matrices, bool both); /** @@ -416,11 +416,11 @@ namespace MeshWorker template - template + template inline void - LocalResults::initialize_matrices( - const MatrixBlockVector &matrices, - bool both) + LocalResults::initialize_matrices + (const MatrixBlockVector &matrices, + bool both) { M1.resize(matrices.size()); if (both) @@ -442,18 +442,18 @@ namespace MeshWorker template - template + template inline void - LocalResults::initialize_matrices( - const MGMatrixBlockVector &matrices, - bool both) + LocalResults::initialize_matrices + (const MGMatrixBlockVector &matrices, + bool both) { M1.resize(matrices.size()); if (both) M2.resize(matrices.size()); for (unsigned int i=0; i > &o = matrices.block(i); + const MGLevelObject > &o = matrices.block(i); const unsigned int row = o[o.min_level()].row; const unsigned int col = o[o.min_level()].column; diff --git a/include/deal.II/meshworker/simple.h b/include/deal.II/meshworker/simple.h index 58e6a039c2..8fc1d01009 100644 --- a/include/deal.II/meshworker/simple.h +++ b/include/deal.II/meshworker/simple.h @@ -150,7 +150,7 @@ namespace MeshWorker * @ingroup MeshWorker * @author Guido Kanschat, 2009 */ - template + template class MatrixSimple { public: @@ -163,12 +163,12 @@ namespace MeshWorker /** * Store the result matrix for later assembling. */ - void initialize(MATRIX &m); + void initialize(MatrixType &m); /** * Store several result matrices for later assembling. */ - void initialize(std::vector &m); + void initialize(std::vector &m); /** * Initialize the constraints. After this function has been called with @@ -216,11 +216,11 @@ namespace MeshWorker /** * The vector of global matrices being assembled. */ - std::vector > > matrix; + std::vector > > matrix; /** * A pointer to the object containing constraints. */ - SmartPointer > constraints; + SmartPointer > constraints; /** * The smallest positive number that will be entered into the global @@ -242,7 +242,7 @@ namespace MeshWorker * @ingroup MeshWorker * @author Guido Kanschat, 2009 */ - template + template class MGMatrixSimple { public: @@ -255,7 +255,7 @@ namespace MeshWorker /** * Store the result matrix for later assembling. */ - void initialize(MGLevelObject &m); + void initialize(MGLevelObject &m); /** * Initialize the multilevel constraints. @@ -266,16 +266,16 @@ namespace MeshWorker * Initialize the matrices #flux_up and #flux_down used for local * refinement with discontinuous Galerkin methods. */ - void initialize_fluxes(MGLevelObject &flux_up, - MGLevelObject &flux_down); + void initialize_fluxes(MGLevelObject &flux_up, + MGLevelObject &flux_down); /** * Initialize the matrices #interface_in and #interface_out used for * local refinement with continuous Galerkin methods. */ - void initialize_interfaces(MGLevelObject &interface_in, - MGLevelObject &interface_out); + void initialize_interfaces(MGLevelObject &interface_in, + MGLevelObject &interface_out); /** * Initialize the local data in the DoFInfo object used later for * assembling. @@ -303,7 +303,7 @@ namespace MeshWorker /** * Assemble a single matrix into a global matrix. */ - void assemble(MATRIX &G, + void assemble(MatrixType &G, const FullMatrix &M, const std::vector &i1, const std::vector &i2); @@ -311,7 +311,7 @@ namespace MeshWorker /** * Assemble a single matrix into a global matrix. */ - void assemble(MATRIX &G, + void assemble(MatrixType &G, const FullMatrix &M, const std::vector &i1, const std::vector &i2, @@ -321,7 +321,7 @@ namespace MeshWorker * Assemble a single matrix into a global matrix. */ - void assemble_up(MATRIX &G, + void assemble_up(MatrixType &G, const FullMatrix &M, const std::vector &i1, const std::vector &i2, @@ -330,7 +330,7 @@ namespace MeshWorker * Assemble a single matrix into a global matrix. */ - void assemble_down(MATRIX &G, + void assemble_down(MatrixType &G, const FullMatrix &M, const std::vector &i1, const std::vector &i2, @@ -340,7 +340,7 @@ namespace MeshWorker * Assemble a single matrix into a global matrix. */ - void assemble_in(MATRIX &G, + void assemble_in(MatrixType &G, const FullMatrix &M, const std::vector &i1, const std::vector &i2, @@ -350,7 +350,7 @@ namespace MeshWorker * Assemble a single matrix into a global matrix. */ - void assemble_out(MATRIX &G, + void assemble_out(MatrixType &G, const FullMatrix &M, const std::vector &i1, const std::vector &i2, @@ -359,35 +359,35 @@ namespace MeshWorker /** * The global matrix being assembled. */ - SmartPointer,MGMatrixSimple > matrix; + SmartPointer,MGMatrixSimple > matrix; /** * The matrix used for face flux terms across the refinement edge, * coupling coarse to fine. */ - SmartPointer,MGMatrixSimple > flux_up; + SmartPointer,MGMatrixSimple > flux_up; /** * The matrix used for face flux terms across the refinement edge, * coupling fine to coarse. */ - SmartPointer,MGMatrixSimple > flux_down; + SmartPointer,MGMatrixSimple > flux_down; /** * The matrix used for face contributions for continuous elements across * the refinement edge, coupling coarse to fine. */ - SmartPointer,MGMatrixSimple > interface_in; + SmartPointer,MGMatrixSimple > interface_in; /** * The matrix used for face contributions for continuous elements across * the refinement edge, coupling fine to coarse. */ - SmartPointer,MGMatrixSimple > interface_out; + SmartPointer,MGMatrixSimple > interface_out; /** * A pointer to the object containing constraints. */ - SmartPointer > mg_constrained_dofs; + SmartPointer > mg_constrained_dofs; /** * The smallest positive number that will be entered into the global @@ -409,9 +409,9 @@ namespace MeshWorker * @ingroup MeshWorker * @author Guido Kanschat, 2009 */ - template + template class SystemSimple : - private MatrixSimple, + private MatrixSimple, private ResidualSimple { public: @@ -423,7 +423,7 @@ namespace MeshWorker /** * Store the two objects data is assembled into. */ - void initialize(MATRIX &m, VectorType &rhs); + void initialize(MatrixType &m, VectorType &rhs); /** * Initialize the constraints. After this function has been called with @@ -477,9 +477,9 @@ namespace MeshWorker } - template + template inline void - ResidualSimple::initialize_local_blocks(const BlockIndices &) + ResidualSimple::initialize_local_blocks(const BlockIndices &) {} @@ -562,26 +562,26 @@ namespace MeshWorker //----------------------------------------------------------------------// - template + template inline - MatrixSimple::MatrixSimple(double threshold) + MatrixSimple::MatrixSimple(double threshold) : threshold(threshold) {} - template + template inline void - MatrixSimple::initialize(MATRIX &m) + MatrixSimple::initialize(MatrixType &m) { matrix.resize(1); matrix[0] = &m; } - template + template inline void - MatrixSimple::initialize(std::vector &m) + MatrixSimple::initialize(std::vector &m) { matrix.resize(m.size()); for (unsigned int i=0; i + template inline void - MatrixSimple::initialize(const ConstraintMatrix &c) + MatrixSimple::initialize(const ConstraintMatrix &c) { constraints = &c; } - template + template template inline void - MatrixSimple::initialize_info(DOFINFO &info, bool face) const + MatrixSimple::initialize_info(DOFINFO &info, bool face) const { Assert(matrix.size() != 0, ExcNotInitialized()); @@ -629,9 +629,9 @@ namespace MeshWorker - template + template inline void - MatrixSimple::assemble(const FullMatrix &M, + MatrixSimple::assemble(const FullMatrix &M, const unsigned int index, const std::vector &i1, const std::vector &i2) @@ -651,10 +651,10 @@ namespace MeshWorker } - template + template template inline void - MatrixSimple::assemble(const DOFINFO &info) + MatrixSimple::assemble(const DOFINFO &info) { Assert(!info.level_cell, ExcMessage("Cell may not access level dofs")); const unsigned int n = info.indices_by_block.size(); @@ -675,10 +675,10 @@ namespace MeshWorker } - template + template template inline void - MatrixSimple::assemble(const DOFINFO &info1, const DOFINFO &info2) + MatrixSimple::assemble(const DOFINFO &info1, const DOFINFO &info2) { Assert(!info1.level_cell, ExcMessage("Cell may not access level dofs")); Assert(!info2.level_cell, ExcMessage("Cell may not access level dofs")); @@ -719,53 +719,53 @@ namespace MeshWorker //----------------------------------------------------------------------// - template + template inline - MGMatrixSimple::MGMatrixSimple(double threshold) + MGMatrixSimple::MGMatrixSimple(double threshold) : threshold(threshold) {} - template + template inline void - MGMatrixSimple::initialize(MGLevelObject &m) + MGMatrixSimple::initialize(MGLevelObject &m) { matrix = &m; } - template + template inline void - MGMatrixSimple::initialize(const MGConstrainedDoFs &c) + MGMatrixSimple::initialize(const MGConstrainedDoFs &c) { mg_constrained_dofs = &c; } - template + template inline void - MGMatrixSimple::initialize_fluxes( - MGLevelObject &up, MGLevelObject &down) + MGMatrixSimple::initialize_fluxes(MGLevelObject &up, + MGLevelObject &down) { flux_up = &up; flux_down = &down; } - template + template inline void - MGMatrixSimple::initialize_interfaces( - MGLevelObject &in, MGLevelObject &out) + MGMatrixSimple::initialize_interfaces + (MGLevelObject &in, MGLevelObject &out) { interface_in = ∈ interface_out = &out; } - template + template template inline void - MGMatrixSimple::initialize_info(DOFINFO &info, bool face) const + MGMatrixSimple::initialize_info(DOFINFO &info, bool face) const { const unsigned int n = info.indices_by_block.size(); @@ -790,13 +790,13 @@ namespace MeshWorker } - template + template inline void - MGMatrixSimple::assemble( - MATRIX &G, - const FullMatrix &M, - const std::vector &i1, - const std::vector &i2) + MGMatrixSimple::assemble + (MatrixType &G, + const FullMatrix &M, + const std::vector &i1, + const std::vector &i2) { AssertDimension(M.m(), i1.size()); AssertDimension(M.n(), i2.size()); @@ -810,14 +810,14 @@ namespace MeshWorker } - template + template inline void - MGMatrixSimple::assemble( - MATRIX &G, - const FullMatrix &M, - const std::vector &i1, - const std::vector &i2, - const unsigned int level) + MGMatrixSimple::assemble + (MatrixType &G, + const FullMatrix &M, + const std::vector &i1, + const std::vector &i2, + const unsigned int level) { AssertDimension(M.m(), i1.size()); AssertDimension(M.n(), i2.size()); @@ -863,14 +863,14 @@ namespace MeshWorker } - template + template inline void - MGMatrixSimple::assemble_up( - MATRIX &G, - const FullMatrix &M, - const std::vector &i1, - const std::vector &i2, - const unsigned int level) + MGMatrixSimple::assemble_up + (MatrixType &G, + const FullMatrix &M, + const std::vector &i1, + const std::vector &i2, + const unsigned int level) { AssertDimension(M.n(), i1.size()); AssertDimension(M.m(), i2.size()); @@ -892,14 +892,14 @@ namespace MeshWorker } } - template + template inline void - MGMatrixSimple::assemble_down( - MATRIX &G, - const FullMatrix &M, - const std::vector &i1, - const std::vector &i2, - const unsigned int level) + MGMatrixSimple::assemble_down + (MatrixType &G, + const FullMatrix &M, + const std::vector &i1, + const std::vector &i2, + const unsigned int level) { AssertDimension(M.m(), i1.size()); AssertDimension(M.n(), i2.size()); @@ -921,14 +921,14 @@ namespace MeshWorker } } - template + template inline void - MGMatrixSimple::assemble_in( - MATRIX &G, - const FullMatrix &M, - const std::vector &i1, - const std::vector &i2, - const unsigned int level) + MGMatrixSimple::assemble_in + (MatrixType &G, + const FullMatrix &M, + const std::vector &i1, + const std::vector &i2, + const unsigned int level) { AssertDimension(M.m(), i1.size()); AssertDimension(M.n(), i2.size()); @@ -962,14 +962,14 @@ namespace MeshWorker } - template + template inline void - MGMatrixSimple::assemble_out( - MATRIX &G, - const FullMatrix &M, - const std::vector &i1, - const std::vector &i2, - const unsigned int level) + MGMatrixSimple::assemble_out + (MatrixType &G, + const FullMatrix &M, + const std::vector &i1, + const std::vector &i2, + const unsigned int level) { AssertDimension(M.n(), i1.size()); AssertDimension(M.m(), i2.size()); @@ -992,10 +992,10 @@ namespace MeshWorker } - template + template template inline void - MGMatrixSimple::assemble(const DOFINFO &info) + MGMatrixSimple::assemble(const DOFINFO &info) { Assert(info.level_cell, ExcMessage("Cell must access level dofs")); const unsigned int level = info.cell->level(); @@ -1032,10 +1032,10 @@ namespace MeshWorker } - template + template template inline void - MGMatrixSimple::assemble(const DOFINFO &info1, + MGMatrixSimple::assemble(const DOFINFO &info1, const DOFINFO &info2) { Assert(info1.level_cell, ExcMessage("Cell must access level dofs")); @@ -1097,62 +1097,62 @@ namespace MeshWorker //----------------------------------------------------------------------// - template - SystemSimple::SystemSimple(double t) + template + SystemSimple::SystemSimple(double t) : - MatrixSimple(t) + MatrixSimple(t) {} - template + template inline void - SystemSimple::initialize(MATRIX &m, VectorType &rhs) + SystemSimple::initialize(MatrixType &m, VectorType &rhs) { AnyData data; VectorType *p = &rhs; data.add(p, "right hand side"); - MatrixSimple::initialize(m); + MatrixSimple::initialize(m); ResidualSimple::initialize(data); } - template + template inline void - SystemSimple::initialize(const ConstraintMatrix &c) + SystemSimple::initialize(const ConstraintMatrix &c) { - MatrixSimple::initialize(c); + MatrixSimple::initialize(c); ResidualSimple::initialize(c); } - template + template template inline void - SystemSimple::initialize_info(DOFINFO &info, + SystemSimple::initialize_info(DOFINFO &info, bool face) const { - MatrixSimple::initialize_info(info, face); + MatrixSimple::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); + MatrixSimple::assemble(info); ResidualSimple::assemble(info); } - template + template template inline void - SystemSimple::assemble(const DOFINFO &info1, + SystemSimple::assemble(const DOFINFO &info1, const DOFINFO &info2) { - MatrixSimple::assemble(info1, info2); + MatrixSimple::assemble(info1, info2); ResidualSimple::assemble(info1, info2); } } diff --git a/include/deal.II/multigrid/mg_block_smoother.h b/include/deal.II/multigrid/mg_block_smoother.h index ea3bed848d..a39ef8ee7e 100644 --- a/include/deal.II/multigrid/mg_block_smoother.h +++ b/include/deal.II/multigrid/mg_block_smoother.h @@ -43,7 +43,7 @@ DEAL_II_NAMESPACE_OPEN * * @author Guido Kanschat, 2005 */ -template +template class MGSmootherBlock : public MGSmootherBase > { @@ -51,18 +51,18 @@ public: /** * Constructor. Sets memory and smoothing parameters. */ - MGSmootherBlock(VectorMemory > &mem, - const unsigned int steps = 1, - const bool variable = false, - const bool symmetric = false, - const bool transpose = false, - const bool reverse = false); + MGSmootherBlock (VectorMemory > &mem, + const unsigned int steps = 1, + const bool variable = false, + const bool symmetric = false, + const bool transpose = false, + const bool reverse = false); /** * Initialize for matrices. The parameter matrices can be any * object having functions get_minlevel() and * get_maxlevel() as well as an operator[] returning a - * reference to @p MATRIX. + * reference to @p MatrixType. * * The same convention is used for the parameter smoothers, such * that operator[] returns the object doing the block-smoothing on @@ -71,9 +71,9 @@ public: * This function stores pointers to the level matrices and smoothing * operator for each level. */ - template - void initialize (const MGMATRIX &matrices, - const MGRELAX &smoothers); + template + void initialize (const MGMatrixType &matrices, + const MGRELAX &smoothers); /** * Empty all vectors. @@ -117,7 +117,7 @@ private: /** * Pointer to the matrices. */ - MGLevelObject > > matrices; + MGLevelObject > > matrices; /** * Pointer to the matrices. @@ -162,15 +162,15 @@ private: #ifndef DOXYGEN -template +template inline -MGSmootherBlock::MGSmootherBlock( - VectorMemory > &mem, - const unsigned int steps, - const bool variable, - const bool symmetric, - const bool transpose, - const bool reverse) +MGSmootherBlock::MGSmootherBlock +(VectorMemory > &mem, + const unsigned int steps, + const bool variable, + const bool symmetric, + const bool transpose, + const bool reverse) : steps(steps), variable(variable), @@ -181,9 +181,9 @@ MGSmootherBlock::MGSmootherBlock( {} -template +template inline void -MGSmootherBlock::clear () +MGSmootherBlock::clear () { unsigned int i=matrices.min_level(), max_level=matrices.max_level(); @@ -195,12 +195,11 @@ MGSmootherBlock::clear () } -template -template +template +template inline void -MGSmootherBlock::initialize ( - const MGMATRIX &m, - const MGRELAX &s) +MGSmootherBlock::initialize (const MGMatrixType &m, + const MGRELAX &s) { const unsigned int min = m.min_level(); const unsigned int max = m.max_level(); @@ -215,56 +214,55 @@ MGSmootherBlock::initialize ( } } -template +template inline void -MGSmootherBlock:: +MGSmootherBlock:: set_steps (const unsigned int s) { steps = s; } -template +template inline void -MGSmootherBlock:: +MGSmootherBlock:: set_variable (const bool flag) { variable = flag; } -template +template inline void -MGSmootherBlock:: +MGSmootherBlock:: set_symmetric (const bool flag) { symmetric = flag; } -template +template inline void -MGSmootherBlock:: +MGSmootherBlock:: set_transpose (const bool flag) { transpose = flag; } -template +template inline void -MGSmootherBlock:: +MGSmootherBlock:: set_reverse (const bool flag) { reverse = flag; } -template +template inline void -MGSmootherBlock::smooth( - const unsigned int level, - BlockVector &u, +MGSmootherBlock::smooth(const unsigned int level, + BlockVector &u, const BlockVector &rhs) const { deallog.push("Smooth"); diff --git a/include/deal.II/multigrid/mg_coarse.h b/include/deal.II/multigrid/mg_coarse.h index 74a2a679c3..65a5eaffa5 100644 --- a/include/deal.II/multigrid/mg_coarse.h +++ b/include/deal.II/multigrid/mg_coarse.h @@ -32,7 +32,7 @@ DEAL_II_NAMESPACE_OPEN * transforming a triplet of iterative solver, matrix and preconditioner into * a coarse grid solver. * - * The type of the matrix (i.e. the template parameter @p MATRIX) should be + * The type of the matrix (i.e. the template parameter @p MatrixType) should be * derived from @p Subscriptor to allow for the use of a smart pointer to it. * * @author Guido Kanschat, 1999, Ralf Hartmann, 2002. @@ -50,9 +50,9 @@ public: * Constructor. Store solver, matrix and preconditioning method for later * use. */ - template + template MGCoarseGridLACIteration (SOLVER &, - const MATRIX &, + const MatrixType &, const PRECOND &); /** @@ -63,9 +63,9 @@ public: /** * Initialize new data. */ - template + template void initialize (SOLVER &, - const MATRIX &, + const MatrixType &, const PRECOND &); /** @@ -85,8 +85,8 @@ public: * Sets the matrix. This gives the possibility to replace the matrix that * was given to the constructor by a new matrix. */ - template - void set_matrix (const MATRIX &); + template + void set_matrix (const MatrixType &); private: /** @@ -198,15 +198,15 @@ MGCoarseGridLACIteration template -template +template MGCoarseGridLACIteration -::MGCoarseGridLACIteration(SOLVER &s, - const MATRIX &m, - const PRECOND &p) +::MGCoarseGridLACIteration (SOLVER &s, + const MatrixType &m, + const PRECOND &p) : solver(&s, typeid(*this).name()) { - matrix = new PointerMatrix(&m); + matrix = new PointerMatrix(&m); precondition = new PointerMatrix(&p); } @@ -220,17 +220,17 @@ MGCoarseGridLACIteration template -template +template void MGCoarseGridLACIteration -::initialize(SOLVER &s, - const MATRIX &m, - const PRECOND &p) +::initialize (SOLVER &s, + const MatrixType &m, + const PRECOND &p) { solver = &s; if (matrix) delete matrix; - matrix = new PointerMatrix(&m); + matrix = new PointerMatrix(&m); if (precondition) delete precondition; precondition = new PointerMatrix(&p); @@ -267,21 +267,21 @@ MGCoarseGridLACIteration template -template +template void MGCoarseGridLACIteration -::set_matrix(const MATRIX &m) +::set_matrix(const MatrixType &m) { if (matrix) delete matrix; - matrix = new PointerMatrix(&m); + matrix = new PointerMatrix(&m); } //--------------------------------------------------------------------------- template -MGCoarseGridHouseholder::MGCoarseGridHouseholder( - const FullMatrix *A) +MGCoarseGridHouseholder::MGCoarseGridHouseholder +(const FullMatrix *A) { if (A != 0) householder.initialize(*A); } @@ -290,8 +290,7 @@ MGCoarseGridHouseholder::MGCoarseGridHouseholder( template void -MGCoarseGridHouseholder::initialize( - const FullMatrix &A) +MGCoarseGridHouseholder::initialize(const FullMatrix &A) { householder.initialize(A); } @@ -300,10 +299,9 @@ MGCoarseGridHouseholder::initialize( template void -MGCoarseGridHouseholder::operator() ( - const unsigned int /*level*/, - VectorType &dst, - const VectorType &src) const +MGCoarseGridHouseholder::operator() (const unsigned int /*level*/, + VectorType &dst, + const VectorType &src) const { householder.least_squares(dst, src); } @@ -319,9 +317,8 @@ MGCoarseGridSVD::MGCoarseGridSVD() template void -MGCoarseGridSVD::initialize( - const FullMatrix &A, - double threshold) +MGCoarseGridSVD::initialize (const FullMatrix &A, + double threshold) { matrix.reinit(A.n_rows(), A.n_cols()); matrix = A; diff --git a/include/deal.II/multigrid/mg_matrix.h b/include/deal.II/multigrid/mg_matrix.h index 51887c87d7..6301fbda9d 100644 --- a/include/deal.II/multigrid/mg_matrix.h +++ b/include/deal.II/multigrid/mg_matrix.h @@ -52,16 +52,16 @@ namespace mg * Constructor setting up pointers to the matrices in M by * calling initialize(). */ - template - Matrix(const MGLevelObject &M); + template + Matrix(const MGLevelObject &M); /** * Initialize the object such that the level multiplication uses the * matrices in M */ - template + template void - initialize(const MGLevelObject &M); + initialize(const MGLevelObject &M); /** * Access matrix on a level. @@ -86,7 +86,7 @@ namespace mg /** * Multilevel matrix selecting from block matrices. This class implements the - * interface defined by MGMatrixBase. The template parameter @p MATRIX should + * interface defined by MGMatrixBase. The template parameter @p MatrixType should * be a block matrix class like BlockSparseMatrix or @p BlockSparseMatrixEZ. * Then, this class stores a pointer to a MGLevelObject of this matrix class. * In each @p vmult, the block selected on initialization will be multiplied @@ -94,7 +94,7 @@ namespace mg * * @author Guido Kanschat, 2002 */ -template +template class MGMatrixSelect : public MGMatrixBase > { public: @@ -102,15 +102,15 @@ public: * Constructor. @p row and @p col are the coordinate of the selected block. * The other argument is handed over to the @p SmartPointer constructor. */ - MGMatrixSelect (const unsigned int row = 0, - const unsigned int col = 0, - MGLevelObject *matrix = 0); + MGMatrixSelect (const unsigned int row = 0, + const unsigned int col = 0, + MGLevelObject *matrix = 0); /** * Set the matrix object to be used. The matrix object must exist longer as * the @p MGMatrix object, since only a pointer is stored. */ - void set_matrix (MGLevelObject *M); + void set_matrix (MGLevelObject *M); /** * Select the block for multiplication. @@ -150,7 +150,7 @@ private: /** * Pointer to the matrix objects on each level. */ - SmartPointer,MGMatrixSelect > matrix; + SmartPointer,MGMatrixSelect > matrix; /** * Row coordinate of selected block. */ @@ -169,10 +169,10 @@ private: namespace mg { template - template + template inline void - Matrix::initialize (const MGLevelObject &p) + Matrix::initialize (const MGLevelObject &p) { matrices.resize(p.min_level(), p.max_level()); for (unsigned int level=p.min_level(); level <= p.max_level(); ++level) @@ -182,9 +182,9 @@ namespace mg template - template + template inline - Matrix::Matrix (const MGLevelObject &p) + Matrix::Matrix (const MGLevelObject &p) { initialize(p); } @@ -257,11 +257,11 @@ namespace mg /*----------------------------------------------------------------------*/ -template -MGMatrixSelect:: -MGMatrixSelect (const unsigned int row, - const unsigned int col, - MGLevelObject *p) +template +MGMatrixSelect:: +MGMatrixSelect (const unsigned int row, + const unsigned int col, + MGLevelObject *p) : matrix (p, typeid(*this).name()), row(row), @@ -270,17 +270,17 @@ MGMatrixSelect (const unsigned int row, -template +template void -MGMatrixSelect::set_matrix (MGLevelObject *p) +MGMatrixSelect::set_matrix (MGLevelObject *p) { matrix = p; } -template +template void -MGMatrixSelect:: +MGMatrixSelect:: select_block (const unsigned int brow, const unsigned int bcol) { @@ -289,58 +289,58 @@ select_block (const unsigned int brow, } -template +template void -MGMatrixSelect:: -vmult (const unsigned int level, - Vector &dst, +MGMatrixSelect:: +vmult (const unsigned int level, + Vector &dst, const Vector &src) const { Assert(matrix != 0, ExcNotInitialized()); - const MGLevelObject &m = *matrix; + const MGLevelObject &m = *matrix; m[level].block(row, col).vmult(dst, src); } -template +template void -MGMatrixSelect:: -vmult_add (const unsigned int level, - Vector &dst, +MGMatrixSelect:: +vmult_add (const unsigned int level, + Vector &dst, const Vector &src) const { Assert(matrix != 0, ExcNotInitialized()); - const MGLevelObject &m = *matrix; + const MGLevelObject &m = *matrix; m[level].block(row, col).vmult_add(dst, src); } -template +template void -MGMatrixSelect:: -Tvmult (const unsigned int level, - Vector &dst, +MGMatrixSelect:: +Tvmult (const unsigned int level, + Vector &dst, const Vector &src) const { Assert(matrix != 0, ExcNotInitialized()); - const MGLevelObject &m = *matrix; + const MGLevelObject &m = *matrix; m[level].block(row, col).Tvmult(dst, src); } -template +template void -MGMatrixSelect:: -Tvmult_add (const unsigned int level, - Vector &dst, +MGMatrixSelect:: +Tvmult_add (const unsigned int level, + Vector &dst, const Vector &src) const { Assert(matrix != 0, ExcNotInitialized()); - const MGLevelObject &m = *matrix; + const MGLevelObject &m = *matrix; m[level].block(row, col).Tvmult_add(dst, src); } diff --git a/include/deal.II/multigrid/mg_smoother.h b/include/deal.II/multigrid/mg_smoother.h index 96dcd81dc1..4d999ea068 100644 --- a/include/deal.II/multigrid/mg_smoother.h +++ b/include/deal.II/multigrid/mg_smoother.h @@ -199,8 +199,8 @@ namespace mg * @p additional_data is an object of type @p RELAX::AdditionalData and is * handed to the initialization function of the relaxation method. */ - template - void initialize (const MGLevelObject &matrices, + template + void initialize (const MGLevelObject &matrices, const typename RELAX::AdditionalData &additional_data = typename RELAX::AdditionalData()); /** @@ -210,9 +210,9 @@ namespace mg * common range is utilized. This way, smoothing can be restricted to * certain levels even if the matrix was generated for all levels. */ - template - void initialize (const MGLevelObject &matrices, - const MGLevelObject &additional_data); + template + void initialize (const MGLevelObject &matrices, + const MGLevelObject &additional_data); /** * Empty all vectors. @@ -270,7 +270,7 @@ namespace mg * * @author Guido Kanschat, 2003 */ -template +template class MGSmootherRelaxation : public MGSmoother { public: @@ -290,8 +290,8 @@ public: * @p additional_data is an object of type @p RELAX::AdditionalData and is * handed to the initialization function of the relaxation method. */ - template - void initialize (const MGLevelObject &matrices, + template + void initialize (const MGLevelObject &matrices, const typename RELAX::AdditionalData &additional_data = typename RELAX::AdditionalData()); /** @@ -302,9 +302,9 @@ public: * @p additional_data is an object of type @p RELAX::AdditionalData and is * handed to the initialization function of the relaxation method. */ - template - void initialize (const MGLevelObject &matrices, - const MGLevelObject &additional_data); + template + void initialize (const MGLevelObject &matrices, + const MGLevelObject &additional_data); /** * Initialize for single blocks of matrices. Of this block matrix, the block @@ -315,11 +315,11 @@ public: * @p additional_data is an object of type @p RELAX::AdditionalData and is * handed to the initialization function of the relaxation method. */ - template - void initialize (const MGLevelObject &matrices, - const DATA &additional_data, - const unsigned int block_row, - const unsigned int block_col); + template + void initialize (const MGLevelObject &matrices, + const DATA &additional_data, + const unsigned int block_row, + const unsigned int block_col); /** * Initialize for single blocks of matrices. Of this block matrix, the block @@ -330,11 +330,11 @@ public: * @p additional_data is an object of type @p RELAX::AdditionalData and is * handed to the initialization function of the relaxation method. */ - template - void initialize (const MGLevelObject &matrices, - const MGLevelObject &additional_data, - const unsigned int block_row, - const unsigned int block_col); + template + void initialize (const MGLevelObject &matrices, + const MGLevelObject &additional_data, + const unsigned int block_row, + const unsigned int block_col); /** * Empty all vectors. @@ -363,7 +363,7 @@ private: /** * Pointer to the matrices. */ - MGLevelObject > matrices; + MGLevelObject > matrices; }; @@ -399,7 +399,7 @@ private: * * @author Guido Kanschat, 2009 */ -template +template class MGSmootherPrecondition : public MGSmoother { public: @@ -419,8 +419,8 @@ public: * @p additional_data is an object of type @p PRECONDITIONER::AdditionalData * and is handed to the initialization function of the relaxation method. */ - template - void initialize (const MGLevelObject &matrices, + template + void initialize (const MGLevelObject &matrices, const typename PRECONDITIONER::AdditionalData &additional_data = typename PRECONDITIONER::AdditionalData()); /** @@ -431,9 +431,9 @@ public: * @p additional_data is an object of type @p PRECONDITIONER::AdditionalData * and is handed to the initialization function of the relaxation method. */ - template - void initialize (const MGLevelObject &matrices, - const MGLevelObject &additional_data); + template + void initialize (const MGLevelObject &matrices, + const MGLevelObject &additional_data); /** * Initialize for single blocks of matrices. Of this block matrix, the block @@ -444,11 +444,11 @@ public: * @p additional_data is an object of type @p PRECONDITIONER::AdditionalData * and is handed to the initialization function of the relaxation method. */ - template - void initialize (const MGLevelObject &matrices, - const DATA &additional_data, - const unsigned int block_row, - const unsigned int block_col); + template + void initialize (const MGLevelObject &matrices, + const DATA &additional_data, + const unsigned int block_row, + const unsigned int block_col); /** * Initialize for single blocks of matrices. Of this block matrix, the block @@ -459,11 +459,11 @@ public: * @p additional_data is an object of type @p PRECONDITIONER::AdditionalData * and is handed to the initialization function of the relaxation method. */ - template - void initialize (const MGLevelObject &matrices, - const MGLevelObject &additional_data, - const unsigned int block_row, - const unsigned int block_col); + template + void initialize (const MGLevelObject &matrices, + const MGLevelObject &additional_data, + const unsigned int block_row, + const unsigned int block_col); /** * Empty all vectors. @@ -492,7 +492,7 @@ private: /** * Pointer to the matrices. */ - MGLevelObject > matrices; + MGLevelObject > matrices; }; @@ -518,11 +518,10 @@ MGSmootherIdentity::clear () template inline -MGSmoother::MGSmoother( - const unsigned int steps, - const bool variable, - const bool symmetric, - const bool transpose) +MGSmoother::MGSmoother (const unsigned int steps, + const bool variable, + const bool symmetric, + const bool transpose) : steps(steps), variable(variable), @@ -577,11 +576,11 @@ namespace mg { template inline - SmootherRelaxation::SmootherRelaxation( - const unsigned int steps, - const bool variable, - const bool symmetric, - const bool transpose) + SmootherRelaxation::SmootherRelaxation + (const unsigned int steps, + const bool variable, + const bool symmetric, + const bool transpose) : MGSmoother(steps, variable, symmetric, transpose) {} @@ -595,11 +594,11 @@ namespace mg template - template + template inline void - SmootherRelaxation::initialize ( - const MGLevelObject &m, - const typename RELAX::AdditionalData &data) + SmootherRelaxation::initialize + (const MGLevelObject &m, + const typename RELAX::AdditionalData &data) { const unsigned int min = m.min_level(); const unsigned int max = m.max_level(); @@ -612,11 +611,11 @@ namespace mg template - template + template inline void - SmootherRelaxation::initialize ( - const MGLevelObject &m, - const MGLevelObject &data) + SmootherRelaxation::initialize + (const MGLevelObject &m, + const MGLevelObject &data) { const unsigned int min = std::max(m.min_level(), data.min_level()); const unsigned int max = std::min(m.max_level(), data.max_level()); @@ -674,22 +673,22 @@ namespace mg //----------------------------------------------------------------------// -template +template inline -MGSmootherRelaxation::MGSmootherRelaxation( - const unsigned int steps, - const bool variable, - const bool symmetric, - const bool transpose) +MGSmootherRelaxation::MGSmootherRelaxation +(const unsigned int steps, + const bool variable, + const bool symmetric, + const bool transpose) : MGSmoother(steps, variable, symmetric, transpose) {} -template +template inline void -MGSmootherRelaxation::clear () +MGSmootherRelaxation::clear () { smoothers.clear(); @@ -700,12 +699,12 @@ MGSmootherRelaxation::clear () } -template -template +template +template inline void -MGSmootherRelaxation::initialize ( - const MGLevelObject &m, - const typename RELAX::AdditionalData &data) +MGSmootherRelaxation::initialize +(const MGLevelObject &m, + const typename RELAX::AdditionalData &data) { const unsigned int min = m.min_level(); const unsigned int max = m.max_level(); @@ -720,12 +719,12 @@ MGSmootherRelaxation::initialize ( } } -template -template +template +template inline void -MGSmootherRelaxation::initialize ( - const MGLevelObject &m, - const MGLevelObject &data) +MGSmootherRelaxation::initialize +(const MGLevelObject &m, + const MGLevelObject &data) { const unsigned int min = m.min_level(); const unsigned int max = m.max_level(); @@ -745,14 +744,14 @@ MGSmootherRelaxation::initialize ( } } -template -template +template +template inline void -MGSmootherRelaxation::initialize ( - const MGLevelObject &m, - const DATA &data, - const unsigned int row, - const unsigned int col) +MGSmootherRelaxation::initialize +(const MGLevelObject &m, + const DATA &data, + const unsigned int row, + const unsigned int col) { const unsigned int min = m.min_level(); const unsigned int max = m.max_level(); @@ -767,14 +766,14 @@ MGSmootherRelaxation::initialize ( } } -template -template +template +template inline void -MGSmootherRelaxation::initialize ( - const MGLevelObject &m, - const MGLevelObject &data, - const unsigned int row, - const unsigned int col) +MGSmootherRelaxation::initialize +(const MGLevelObject &m, + const MGLevelObject &data, + const unsigned int row, + const unsigned int col) { const unsigned int min = m.min_level(); const unsigned int max = m.max_level(); @@ -795,11 +794,11 @@ MGSmootherRelaxation::initialize ( } -template +template inline void -MGSmootherRelaxation::smooth (const unsigned int level, - VectorType &u, - const VectorType &rhs) const +MGSmootherRelaxation::smooth (const unsigned int level, + VectorType &u, + const VectorType &rhs) const { unsigned int maxlevel = smoothers.max_level(); unsigned int steps2 = this->steps; @@ -826,10 +825,10 @@ MGSmootherRelaxation::smooth (const unsigned int leve -template +template inline std::size_t -MGSmootherRelaxation:: +MGSmootherRelaxation:: memory_consumption () const { return sizeof(*this) @@ -841,22 +840,22 @@ memory_consumption () const //----------------------------------------------------------------------// -template +template inline -MGSmootherPrecondition::MGSmootherPrecondition( - const unsigned int steps, - const bool variable, - const bool symmetric, - const bool transpose) +MGSmootherPrecondition::MGSmootherPrecondition +(const unsigned int steps, + const bool variable, + const bool symmetric, + const bool transpose) : MGSmoother(steps, variable, symmetric, transpose) {} -template +template inline void -MGSmootherPrecondition::clear () +MGSmootherPrecondition::clear () { smoothers.clear(); @@ -868,12 +867,12 @@ MGSmootherPrecondition::clear () -template -template +template +template inline void -MGSmootherPrecondition::initialize ( - const MGLevelObject &m, - const typename PRECONDITIONER::AdditionalData &data) +MGSmootherPrecondition::initialize +(const MGLevelObject &m, + const typename PRECONDITIONER::AdditionalData &data) { const unsigned int min = m.min_level(); const unsigned int max = m.max_level(); @@ -890,12 +889,12 @@ MGSmootherPrecondition::initialize ( -template -template +template +template inline void -MGSmootherPrecondition::initialize ( - const MGLevelObject &m, - const MGLevelObject &data) +MGSmootherPrecondition::initialize +(const MGLevelObject &m, + const MGLevelObject &data) { const unsigned int min = m.min_level(); const unsigned int max = m.max_level(); @@ -917,14 +916,14 @@ MGSmootherPrecondition::initialize ( -template -template +template +template inline void -MGSmootherPrecondition::initialize ( - const MGLevelObject &m, - const DATA &data, - const unsigned int row, - const unsigned int col) +MGSmootherPrecondition::initialize +(const MGLevelObject &m, + const DATA &data, + const unsigned int row, + const unsigned int col) { const unsigned int min = m.min_level(); const unsigned int max = m.max_level(); @@ -941,14 +940,14 @@ MGSmootherPrecondition::initialize ( -template -template +template +template inline void -MGSmootherPrecondition::initialize ( - const MGLevelObject &m, - const MGLevelObject &data, - const unsigned int row, - const unsigned int col) +MGSmootherPrecondition::initialize +(const MGLevelObject &m, + const MGLevelObject &data, + const unsigned int row, + const unsigned int col) { const unsigned int min = m.min_level(); const unsigned int max = m.max_level(); @@ -970,9 +969,9 @@ MGSmootherPrecondition::initialize ( -template +template inline void -MGSmootherPrecondition::smooth +MGSmootherPrecondition::smooth (const unsigned int level, VectorType &u, const VectorType &rhs) const @@ -1041,10 +1040,10 @@ MGSmootherPrecondition::smooth -template +template inline std::size_t -MGSmootherPrecondition:: +MGSmootherPrecondition:: memory_consumption () const { return sizeof(*this)