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();
595 size_type matrix_number = 0;
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
std::vector< Entry > entries
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
PointerMatrixBase< typename BlockVectorType::BlockType > * matrix
PointerMatrixBase< VectorType > * new_pointer_matrix_base(MatrixType &matrix, const VectorType &, const char *name="PointerMatrixAux")
void vmult(BlockVectorType &dst, const BlockVectorType &src) const
types::global_dof_index size_type
void vmult_add(BlockVectorType &dst, const BlockVectorType &src) const
#define DeclException1(Exception1, type1, outsequence)
#define Assert(cond, exc)
void print_latex(StreamType &out) const
void Tvmult(BlockVectorType &dst, const BlockVectorType &src) const
SymmetricTensor< rank_, dim, Number > transpose(const SymmetricTensor< rank_, dim, Number > &t)
Entry(const MatrixType &matrix, size_type row, size_type col, number prefix, bool transpose)
void reinit(const unsigned int n_block_rows, const unsigned int n_block_cols)
void enter(const MatrixType &matrix, const size_type row, const size_type col, const number prefix=1., const bool transpose=false)
unsigned int global_dof_index
void Tvmult_add(BlockVectorType &dst, const BlockVectorType &src) const
void enter(const MatrixType &matrix, const unsigned int row, const unsigned int col, const number prefix=1., const bool transpose=false)