From f28ff5e565a9c4fa88d641edb1aae49bba23c7e0 Mon Sep 17 00:00:00 2001 From: David Wells Date: Thu, 12 Nov 2015 14:37:50 -0500 Subject: [PATCH] Prefer BlockVectorType to BLOCK_VECTOR. --- include/deal.II/lac/block_matrix_array.h | 110 +++++++------- source/lac/block_matrix_array.cc | 180 +++++++++++------------ 2 files changed, 145 insertions(+), 145 deletions(-) diff --git a/include/deal.II/lac/block_matrix_array.h b/include/deal.II/lac/block_matrix_array.h index 854ffd9c3c..e99c2025f8 100644 --- a/include/deal.II/lac/block_matrix_array.h +++ b/include/deal.II/lac/block_matrix_array.h @@ -110,7 +110,7 @@ DEAL_II_NAMESPACE_OPEN * @author Guido Kanschat * @date 2000-2005, 2010 */ -template > +template > class BlockMatrixArray : public Subscriptor { public: @@ -179,39 +179,39 @@ public: /** * Matrix-vector multiplication. */ - void vmult (BLOCK_VECTOR &dst, - const BLOCK_VECTOR &src) const; + void vmult (BlockVectorType &dst, + const BlockVectorType &src) const; /** * Matrix-vector multiplication adding to dst. */ - void vmult_add(BLOCK_VECTOR &dst, - const BLOCK_VECTOR &src) const; + void vmult_add(BlockVectorType &dst, + const BlockVectorType &src) const; /** * Transposed matrix-vector multiplication. */ - void Tvmult (BLOCK_VECTOR &dst, - const BLOCK_VECTOR &src) const; + void Tvmult (BlockVectorType &dst, + const BlockVectorType &src) const; /** * Transposed matrix-vector multiplication adding to dst. */ - void Tvmult_add (BLOCK_VECTOR &dst, - const BLOCK_VECTOR &src) const; + void Tvmult_add (BlockVectorType &dst, + const BlockVectorType &src) const; /** * Matrix scalar product between two vectors (at least for a symmetric * matrix). */ - number matrix_scalar_product (const BLOCK_VECTOR &u, - const BLOCK_VECTOR &v) const; + number matrix_scalar_product (const BlockVectorType &u, + const BlockVectorType &v) const; /** * Compute $u^T M u$. This is the square of the norm induced by the matrix * assuming the matrix is symmetric positive definitive. */ - number matrix_norm_square (const BLOCK_VECTOR &u) const; + number matrix_norm_square (const BlockVectorType &u) const; /** * Print the block structure as a LaTeX-array. This output will not be very @@ -317,7 +317,7 @@ protected: /** * The matrix block itself. */ - PointerMatrixBase *matrix; + PointerMatrixBase *matrix; }; /** @@ -393,9 +393,9 @@ private: * @ingroup Preconditioners * @author Guido Kanschat, 2001, 2005 */ -template > +template > class BlockTrianglePrecondition - : private BlockMatrixArray + : private BlockMatrixArray { public: /** @@ -435,44 +435,44 @@ public: /** * Preconditioning. */ - void vmult (BLOCK_VECTOR &dst, - const BLOCK_VECTOR &src) const; + void vmult (BlockVectorType &dst, + const BlockVectorType &src) const; /** * Preconditioning adding to dst. */ - void vmult_add (BLOCK_VECTOR &dst, - const BLOCK_VECTOR &src) const; + void vmult_add (BlockVectorType &dst, + const BlockVectorType &src) const; /** * Transposed preconditioning */ - void Tvmult (BLOCK_VECTOR &dst, - const BLOCK_VECTOR &src) const; + void Tvmult (BlockVectorType &dst, + const BlockVectorType &src) const; /** * Transposed preconditioning adding to dst. */ - void Tvmult_add (BLOCK_VECTOR &dst, - const BLOCK_VECTOR &src) const; + void Tvmult_add (BlockVectorType &dst, + const BlockVectorType &src) const; /** * Make function of base class available. */ - using BlockMatrixArray::print_latex; + using BlockMatrixArray::print_latex; /** * Make function of base class available. */ - using BlockMatrixArray::n_block_rows; + using BlockMatrixArray::n_block_rows; /** * Make function of base class available. */ - using BlockMatrixArray::n_block_cols; - using BlockMatrixArray::clear; - using BlockMatrixArray::Subscriptor::subscribe; - using BlockMatrixArray::Subscriptor::unsubscribe; + using BlockMatrixArray::n_block_cols; + using BlockMatrixArray::clear; + using BlockMatrixArray::Subscriptor::subscribe; + using BlockMatrixArray::Subscriptor::unsubscribe; /** * @addtogroup Exceptions @@ -501,7 +501,7 @@ private: * Add all off-diagonal contributions and return the entry of the diagonal * element for one row. */ - void do_row (BLOCK_VECTOR &dst, + void do_row (BlockVectorType &dst, size_type row_num) const; /** @@ -514,34 +514,34 @@ private: #ifndef DOXYGEN //--------------------------------------------------------------------------- -template +template template inline -BlockMatrixArray::Entry::Entry ( - const MatrixType &m, - size_type row, - size_type col, - number prefix, - bool transpose) +BlockMatrixArray::Entry::Entry +(const MatrixType &m, + size_type row, + size_type col, + number prefix, + bool transpose) : row (row), col (col), prefix (prefix), transpose (transpose), - matrix (new_pointer_matrix_base(m, typename BLOCK_VECTOR::BlockType(), typeid(*this).name())) + matrix (new_pointer_matrix_base(m, typename BlockVectorType::BlockType(), typeid(*this).name())) {} -template +template template inline void -BlockMatrixArray::enter (const MatrixType &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::enter (const MatrixType &matrix, } -template +template template inline void -BlockMatrixArray::print_latex (STREAM &out) const +BlockMatrixArray::print_latex (STREAM &out) const { out << "\\begin{array}{" << std::string(n_block_cols(), 'c') @@ -561,7 +561,7 @@ BlockMatrixArray::print_latex (STREAM &out) const Table<2,std::string> array(n_block_rows(), n_block_cols()); - typedef std::map *, std::string> NameMap; + typedef std::map *, std::string> NameMap; NameMap matrix_names; typename std::vector::const_iterator m = entries.begin(); @@ -574,7 +574,7 @@ BlockMatrixArray::print_latex (STREAM &out) const { std::pair x = matrix_names.insert( - std::pair*, std::string> (m->matrix, + std::pair*, std::string> (m->matrix, std::string("M"))); std::ostringstream stream; stream << matrix_number++; @@ -612,17 +612,17 @@ BlockMatrixArray::print_latex (STREAM &out) const out << "\\end{array}" << std::endl; } -template +template template inline void -BlockTrianglePrecondition::enter (const MatrixType &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); + BlockMatrixArray::enter(matrix, row, col, prefix, transpose); } diff --git a/source/lac/block_matrix_array.cc b/source/lac/block_matrix_array.cc index dcf39f548a..58c4746291 100644 --- a/source/lac/block_matrix_array.cc +++ b/source/lac/block_matrix_array.cc @@ -26,8 +26,8 @@ DEAL_II_NAMESPACE_OPEN -template -BlockMatrixArray::Entry::Entry (const Entry &e) +template +BlockMatrixArray::Entry::Entry (const Entry &e) : row(e.row), col(e.col), @@ -41,36 +41,36 @@ BlockMatrixArray::Entry::Entry (const Entry &e) -template -BlockMatrixArray::Entry::~Entry () +template +BlockMatrixArray::Entry::~Entry () { if (matrix) delete matrix; } -template -BlockMatrixArray::BlockMatrixArray () +template +BlockMatrixArray::BlockMatrixArray () : block_rows (0), block_cols (0) {} -template -BlockMatrixArray::BlockMatrixArray ( - const unsigned int n_block_rows, - const unsigned int n_block_cols) +template +BlockMatrixArray::BlockMatrixArray +(const unsigned int n_block_rows, + const unsigned int n_block_cols) : block_rows (n_block_rows), block_cols (n_block_cols) {} -template +template void -BlockMatrixArray::initialize ( - const unsigned int n_block_rows, - const unsigned int n_block_cols) +BlockMatrixArray::initialize +(const unsigned int n_block_rows, + const unsigned int n_block_cols) { block_rows = n_block_rows; block_cols = n_block_cols; @@ -78,11 +78,11 @@ BlockMatrixArray::initialize ( -template +template void -BlockMatrixArray::reinit ( - const unsigned int n_block_rows, - const unsigned int n_block_cols) +BlockMatrixArray::reinit +(const unsigned int n_block_rows, + const unsigned int n_block_cols) { clear(); block_rows = n_block_rows; @@ -91,27 +91,27 @@ BlockMatrixArray::reinit ( -template +template void -BlockMatrixArray::clear () +BlockMatrixArray::clear () { entries.clear(); } -template +template void -BlockMatrixArray::vmult_add (BLOCK_VECTOR &dst, - const BLOCK_VECTOR &src) const +BlockMatrixArray::vmult_add (BlockVectorType &dst, + const BlockVectorType &src) const { - GrowingVectorMemory mem; + GrowingVectorMemory mem; Assert (dst.n_blocks() == block_rows, ExcDimensionMismatch(dst.n_blocks(), block_rows)); Assert (src.n_blocks() == block_cols, ExcDimensionMismatch(src.n_blocks(), block_cols)); - typename VectorMemory::Pointer p_aux(mem); - typename BLOCK_VECTOR::BlockType &aux = *p_aux; + typename VectorMemory::Pointer p_aux(mem); + typename BlockVectorType::BlockType &aux = *p_aux; typename std::vector::const_iterator m = entries.begin(); typename std::vector::const_iterator end = entries.end(); @@ -130,10 +130,10 @@ BlockMatrixArray::vmult_add (BLOCK_VECTOR &dst, -template +template void -BlockMatrixArray::vmult (BLOCK_VECTOR &dst, - const BLOCK_VECTOR &src) const +BlockMatrixArray::vmult (BlockVectorType &dst, + const BlockVectorType &src) const { dst = 0.; vmult_add (dst, src); @@ -142,12 +142,12 @@ BlockMatrixArray::vmult (BLOCK_VECTOR &dst, -template +template void -BlockMatrixArray::Tvmult_add (BLOCK_VECTOR &dst, - const BLOCK_VECTOR &src) const +BlockMatrixArray::Tvmult_add (BlockVectorType &dst, + const BlockVectorType &src) const { - GrowingVectorMemory mem; + GrowingVectorMemory mem; Assert (dst.n_blocks() == block_cols, ExcDimensionMismatch(dst.n_blocks(), block_cols)); Assert (src.n_blocks() == block_rows, @@ -156,8 +156,8 @@ BlockMatrixArray::Tvmult_add (BLOCK_VECTOR &dst, typename std::vector::const_iterator m = entries.begin(); typename std::vector::const_iterator end = entries.end(); - typename VectorMemory::Pointer p_aux(mem); - typename BLOCK_VECTOR::BlockType &aux = *p_aux; + typename VectorMemory::Pointer p_aux(mem); + typename BlockVectorType::BlockType &aux = *p_aux; for (; m != end ; ++m) { @@ -172,10 +172,10 @@ BlockMatrixArray::Tvmult_add (BLOCK_VECTOR &dst, -template +template void -BlockMatrixArray::Tvmult (BLOCK_VECTOR &dst, - const BLOCK_VECTOR &src) const +BlockMatrixArray::Tvmult (BlockVectorType &dst, + const BlockVectorType &src) const { dst = 0.; Tvmult_add (dst, src); @@ -184,20 +184,20 @@ BlockMatrixArray::Tvmult (BLOCK_VECTOR &dst, -template +template number -BlockMatrixArray::matrix_scalar_product ( - const BLOCK_VECTOR &u, - const BLOCK_VECTOR &v) const +BlockMatrixArray::matrix_scalar_product +(const BlockVectorType &u, + const BlockVectorType &v) const { - GrowingVectorMemory mem; + GrowingVectorMemory mem; Assert (u.n_blocks() == block_rows, ExcDimensionMismatch(u.n_blocks(), block_rows)); Assert (v.n_blocks() == block_cols, ExcDimensionMismatch(v.n_blocks(), block_cols)); - typename VectorMemory::Pointer p_aux(mem); - typename BLOCK_VECTOR::BlockType &aux = *p_aux; + typename VectorMemory::Pointer p_aux(mem); + typename BlockVectorType::BlockType &aux = *p_aux; typename std::vector::const_iterator m; typename std::vector::const_iterator end = entries.end(); @@ -224,28 +224,28 @@ BlockMatrixArray::matrix_scalar_product ( -template +template number -BlockMatrixArray::matrix_norm_square ( - const BLOCK_VECTOR &u) const +BlockMatrixArray::matrix_norm_square +(const BlockVectorType &u) const { return matrix_scalar_product(u,u); } -template +template unsigned int -BlockMatrixArray::n_block_rows () const +BlockMatrixArray::n_block_rows () const { return block_rows; } -template +template unsigned int -BlockMatrixArray::n_block_cols () const +BlockMatrixArray::n_block_cols () const { return block_cols; } @@ -254,47 +254,47 @@ BlockMatrixArray::n_block_cols () const //--------------------------------------------------------------------------- -template -BlockTrianglePrecondition::BlockTrianglePrecondition() - : BlockMatrixArray (), +template +BlockTrianglePrecondition::BlockTrianglePrecondition() + : BlockMatrixArray (), backward(false) {} -template -BlockTrianglePrecondition::BlockTrianglePrecondition( - const unsigned int block_rows) +template +BlockTrianglePrecondition::BlockTrianglePrecondition +(const unsigned int block_rows) : - BlockMatrixArray (block_rows, block_rows), + BlockMatrixArray (block_rows, block_rows), backward(false) {} -template +template void -BlockTrianglePrecondition::reinit ( - const unsigned int n) +BlockTrianglePrecondition::reinit +(const unsigned int n) { - BlockMatrixArray::reinit(n,n); + BlockMatrixArray::reinit(n,n); } -template +template void -BlockTrianglePrecondition::do_row ( - BLOCK_VECTOR &dst, - size_type row_num) const +BlockTrianglePrecondition::do_row +(BlockVectorType &dst, + size_type row_num) const { - GrowingVectorMemory mem; - typename std::vector::Entry>::const_iterator + GrowingVectorMemory mem; + typename std::vector::Entry>::const_iterator m = this->entries.begin(); - typename std::vector::Entry>::const_iterator + typename std::vector::Entry>::const_iterator end = this->entries.end(); - std::vector::Entry>::const_iterator> + std::vector::Entry>::const_iterator> diagonals; - typename VectorMemory::Pointer p_aux(mem); - typename BLOCK_VECTOR::BlockType &aux = *p_aux; + typename VectorMemory::Pointer p_aux(mem); + typename BlockVectorType::BlockType &aux = *p_aux; aux.reinit(dst.block(row_num), true); @@ -361,18 +361,18 @@ BlockTrianglePrecondition::do_row ( -template +template void -BlockTrianglePrecondition::vmult_add ( - BLOCK_VECTOR &dst, - const BLOCK_VECTOR &src) const +BlockTrianglePrecondition::vmult_add +(BlockVectorType &dst, + const BlockVectorType &src) const { Assert (dst.n_blocks() == n_block_rows(), ExcDimensionMismatch(dst.n_blocks(), n_block_rows())); Assert (src.n_blocks() == n_block_cols(), ExcDimensionMismatch(src.n_blocks(), n_block_cols())); - BLOCK_VECTOR aux; + BlockVectorType aux; aux.reinit(dst); vmult(aux, src); dst.add(aux); @@ -380,11 +380,11 @@ BlockTrianglePrecondition::vmult_add ( -template +template void -BlockTrianglePrecondition::vmult ( - BLOCK_VECTOR &dst, - const BLOCK_VECTOR &src) const +BlockTrianglePrecondition::vmult +(BlockVectorType &dst, + const BlockVectorType &src) const { Assert (dst.n_blocks() == n_block_rows(), ExcDimensionMismatch(dst.n_blocks(), n_block_rows())); @@ -406,21 +406,21 @@ BlockTrianglePrecondition::vmult ( } -template +template void -BlockTrianglePrecondition::Tvmult ( - BLOCK_VECTOR &, - const BLOCK_VECTOR &) const +BlockTrianglePrecondition::Tvmult +(BlockVectorType &, + const BlockVectorType &) const { Assert (false, ExcNotImplemented()); } -template +template void -BlockTrianglePrecondition::Tvmult_add ( - BLOCK_VECTOR &, - const BLOCK_VECTOR &) const +BlockTrianglePrecondition::Tvmult_add +(BlockVectorType &, + const BlockVectorType &) const { Assert (false, ExcNotImplemented()); } -- 2.39.5