From f0c632a1103a1615fe313cb413b2217a3c831f31 Mon Sep 17 00:00:00 2001 From: bangerth Date: Sun, 16 Feb 2014 18:21:54 +0000 Subject: [PATCH] Adjust one test, augment documentation. git-svn-id: https://svn.dealii.org/trunk@32495 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/deal.II/lac/block_matrix_array.h | 68 +++++++++++++------ tests/bits/block_matrix_array_01.cc | 5 +- tests/bits/block_matrix_array_01.output | 4 +- 3 files changed, 50 insertions(+), 27 deletions(-) diff --git a/deal.II/include/deal.II/lac/block_matrix_array.h b/deal.II/include/deal.II/lac/block_matrix_array.h index 6f9a21d10b..e0a3b5be34 100644 --- a/deal.II/include/deal.II/lac/block_matrix_array.h +++ b/deal.II/include/deal.II/lac/block_matrix_array.h @@ -301,18 +301,49 @@ public: * Print the block structure as a * LaTeX-array. This output will * not be very intuitive, since - * the matrix object lacks - * important information. What - * you see is an entry for each + * the current object lacks + * knowledge about what the individual blocks represent or + * how they should be named. Instead, what + * you will see is an entry for each * block showing all the matrices - * with their multiplicaton + * with their multiplication * factors and possibly transpose - * mark. The matrices itself are - * numbered successively upon - * being entred. If the same + * marks. The matrices itself are + * named successively as they are encountered. If the same * matrix is entered several * times, it will be listed with - * the same number everytime. + * different names. + * + * As an example, consider the following code: + * @code + * FullMatrix A1(4,4); + * FullMatrix A2(4,4); + * FullMatrix B(4,3); + * FullMatrix C(3,3); + * + * BlockMatrixArray block(2,2); + * + * block.enter(A1,0,0); + * block.enter(A2,0,0,2,true); + * block.enter(B,0,1,-3.); + * block.enter(B,0,1,-3.,true); + * block.enter(C,1,1,1.,true); + * + * block.print_latex(std::cout); + * @endcode + * The current function will then produce output of the following + * kind: + * @code + * \begin{array}{cc} + * M0+2xM1^T & -3xM2-3xM3^T\\ + * & M4^T + * \end{array} + * @endcode + * Note how the individual blocks here are just numbered successively + * as M0 to M4 and that the output misses + * the fact that M2 and M3 are, in fact, + * the same matrix. Nevertheless, the output at least gives some + * kind of idea of the block structure of this matrix. */ template void print_latex (STREAM &out) const; @@ -713,17 +744,6 @@ BlockMatrixArray::enter_aux ( } -template -struct BlockMatrixArrayPointerMatrixLess -{ - bool operator () (const PointerMatrixBase > *a, - const PointerMatrixBase > *b) const - { - return *a < *b; - } -}; - - template template inline @@ -736,8 +756,7 @@ BlockMatrixArray::print_latex (STREAM &out) const Table<2,std::string> array(n_block_rows(), n_block_cols()); - typedef std::map > *, - std::string, BlockMatrixArrayPointerMatrixLess > NameMap; + typedef std::map > *, std::string> NameMap; NameMap matrix_names; typename std::vector::const_iterator m = entries.begin(); @@ -776,7 +795,12 @@ BlockMatrixArray::print_latex (STREAM &out) const { out << '\t' << array(i,j); if (j==n_block_cols()-1) - out << "\\\\" << std::endl; + { + if (i != n_block_rows() - 1) + out << "\\\\" << std::endl; + else + out << std::endl; + } else out << " &"; } diff --git a/tests/bits/block_matrix_array_01.cc b/tests/bits/block_matrix_array_01.cc index 692a2eb5b1..901b4e0e5e 100644 --- a/tests/bits/block_matrix_array_01.cc +++ b/tests/bits/block_matrix_array_01.cc @@ -1,7 +1,7 @@ // --------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2005 - 2013 by the deal.II authors +// Copyright (C) 2005 - 2014 by the deal.II authors // // This file is part of the deal.II library. // @@ -38,9 +38,8 @@ int main () FullMatrix A2(4,4); FullMatrix B(4,3); FullMatrix C(3,3); - PrimitiveVectorMemory > mem; - BlockMatrixArray block(2,2,mem); + BlockMatrixArray block(2,2); block.enter(A1,0,0); block.enter(A2,0,0,2,true); diff --git a/tests/bits/block_matrix_array_01.output b/tests/bits/block_matrix_array_01.output index 3a8202dfb2..084edb26a4 100644 --- a/tests/bits/block_matrix_array_01.output +++ b/tests/bits/block_matrix_array_01.output @@ -1,5 +1,5 @@ DEAL::\begin{array}{cc} -DEAL:: M0+2xM1^T & -3xM2-3xM2^T\\ -DEAL:: & M3^T\\ +DEAL:: M0+2xM1^T & -3xM2-3xM3^T\\ +DEAL:: & M4^T DEAL::\end{array} -- 2.39.5