16 #ifndef dealii_block_matrix_array_h
17 #define dealii_block_matrix_array_h
19 #include <deal.II/base/config.h>
21 #include <deal.II/base/subscriptor.h>
22 #include <deal.II/base/table.h>
24 #include <deal.II/lac/block_vector.h>
25 #include <deal.II/lac/pointer_matrix.h>
26 #include <deal.II/lac/vector_memory.h>
34 DEAL_II_NAMESPACE_OPEN
116 template <
typename number = double,
136 const unsigned int n_block_cols);
143 initialize(
const unsigned int n_block_rows,
const unsigned int n_block_cols);
149 reinit(
const unsigned int n_block_rows,
const unsigned int n_block_cols);
161 template <
typename MatrixType>
163 enter(
const MatrixType & matrix,
164 const unsigned int row,
165 const unsigned int col,
166 const number prefix = 1.,
179 n_block_rows()
const;
185 n_block_cols()
const;
191 vmult(BlockVectorType &dst,
const BlockVectorType &src)
const;
197 vmult_add(BlockVectorType &dst,
const BlockVectorType &src)
const;
203 Tvmult(BlockVectorType &dst,
const BlockVectorType &src)
const;
209 Tvmult_add(BlockVectorType &dst,
const BlockVectorType &src)
const;
216 matrix_scalar_product(
const BlockVectorType &u,
217 const BlockVectorType &v)
const;
224 matrix_norm_square(
const BlockVectorType &u)
const;
265 template <
class StreamType>
267 print_latex(StreamType &out)
const;
286 template <
typename MatrixType>
287 Entry(
const MatrixType &matrix,
341 operator=(
const Entry &) =
delete;
419 template <
typename number = double,
446 reinit(
const unsigned int n_block_rows);
453 template <
typename MatrixType>
455 enter(
const MatrixType &matrix,
458 const number prefix = 1.,
465 vmult(BlockVectorType &dst,
const BlockVectorType &src)
const;
471 vmult_add(BlockVectorType &dst,
const BlockVectorType &src)
const;
477 Tvmult(BlockVectorType &dst,
const BlockVectorType &src)
const;
483 Tvmult_add(BlockVectorType &dst,
const BlockVectorType &src)
const;
514 <<
"No diagonal entry was added for block " << arg1);
522 <<
"Inverse diagonal entries may not be added in block "
531 do_row(BlockVectorType &dst,
size_type row_num)
const;
543 template <
typename number,
typename BlockVectorType>
544 template <
typename MatrixType>
556 typename BlockVectorType::BlockType(),
557 typeid(*this).name()))
562 template <
typename number,
typename BlockVectorType>
563 template <
typename MatrixType>
573 entries.push_back(Entry(matrix, row, col, prefix,
transpose));
577 template <
typename number,
typename BlockVectorType>
578 template <
class StreamType>
582 out <<
"\\begin{array}{" << std::string(n_block_cols(),
'c') <<
"}"
588 std::map<const PointerMatrixBase<typename BlockVectorType::BlockType> *,
590 NameMap matrix_names;
592 typename std::vector<Entry>::const_iterator m = entries.begin();
593 typename std::vector<Entry>::const_iterator end = entries.end();
596 for (; m != end; ++m)
598 if (matrix_names.find(m->matrix) == matrix_names.end())
600 std::pair<typename NameMap::iterator, bool> x = matrix_names.insert(
603 std::string>(m->matrix, std::string(
"M")));
604 std::ostringstream stream;
605 stream << matrix_number++;
607 x.first->second += stream.str();
610 std::ostringstream stream;
612 if (!array(m->row, m->col).empty() && m->prefix >= 0)
615 stream << m->prefix <<
'x';
616 stream << matrix_names.find(m->matrix)->second;
621 array(m->row, m->col) += stream.str();
623 for (
unsigned int i = 0; i < n_block_rows(); ++i)
624 for (
unsigned int j = 0; j < n_block_cols(); ++j)
626 out <<
'\t' << array(i, j);
627 if (j == n_block_cols() - 1)
629 if (i != n_block_rows() - 1)
630 out <<
"\\\\" << std::endl;
637 out <<
"\\end{array}" << std::endl;
640 template <
typename number,
typename BlockVectorType>
641 template <
typename MatrixType>
644 const MatrixType &matrix,
658 DEAL_II_NAMESPACE_CLOSE