16 #ifndef dealii__block_matrix_array_h 17 #define dealii__block_matrix_array_h 19 #include <deal.II/base/config.h> 20 #include <deal.II/base/subscriptor.h> 21 #include <deal.II/base/table.h> 23 #include <deal.II/lac/pointer_matrix.h> 24 #include <deal.II/lac/vector_memory.h> 25 #include <deal.II/lac/block_vector.h> 33 DEAL_II_NAMESPACE_OPEN
113 template <
typename number =
double,
typename BlockVectorType=BlockVector<number> >
157 template <
typename MatrixType>
158 void enter (
const MatrixType &matrix,
159 const unsigned int row,
160 const unsigned int col,
161 const number prefix = 1.,
162 const bool transpose =
false);
182 void vmult (BlockVectorType &dst,
183 const BlockVectorType &src)
const;
189 const BlockVectorType &src)
const;
194 void Tvmult (BlockVectorType &dst,
195 const BlockVectorType &src)
const;
201 const BlockVectorType &src)
const;
208 const BlockVectorType &v)
const;
255 template <
class StreamType>
275 template<
typename MatrixType>
403 template <
typename number =
double,
typename BlockVectorType = BlockVector<number> >
435 template <
typename MatrixType>
436 void enter (
const MatrixType &matrix,
439 const number prefix = 1.,
440 const bool transpose =
false);
445 void vmult (BlockVectorType &dst,
446 const BlockVectorType &src)
const;
452 const BlockVectorType &src)
const;
457 void Tvmult (BlockVectorType &dst,
458 const BlockVectorType &src)
const;
464 const BlockVectorType &src)
const;
495 <<
"No diagonal entry was added for block " << arg1);
503 <<
"Inverse diagonal entries may not be added in block " 511 void do_row (BlockVectorType &dst,
524 template <
typename number,
typename BlockVectorType>
525 template <
typename MatrixType>
528 (
const MatrixType &m,
543 template <
typename number,
typename BlockVectorType>
544 template <
typename MatrixType>
555 entries.push_back(Entry(matrix, row, col, prefix,
transpose));
559 template <
typename number,
typename BlockVectorType>
560 template <
class StreamType>
565 out <<
"\\begin{array}{" 566 << std::string(n_block_cols(),
'c')
571 typedef std::map<const PointerMatrixBase<typename BlockVectorType::BlockType > *, std::string> NameMap;
572 NameMap matrix_names;
574 typename std::vector<Entry>::const_iterator m = entries.begin();
575 typename std::vector<Entry>::const_iterator end = entries.end();
578 for (; m != end ; ++m)
580 if (matrix_names.find(m->matrix) == matrix_names.end())
582 std::pair<typename NameMap::iterator, bool> x =
586 std::ostringstream stream;
587 stream << matrix_number++;
589 x.first->second += stream.str();
592 std::ostringstream stream;
594 if (array(m->row, m->col) !=
"" && m->prefix >= 0)
597 stream << m->prefix <<
'x';
598 stream << matrix_names.find(m->matrix)->second;
603 array(m->row, m->col) += stream.str();
605 for (
unsigned int i=0; i<n_block_rows(); ++i)
606 for (
unsigned int j=0; j<n_block_cols(); ++j)
608 out <<
'\t' << array(i,j);
609 if (j==n_block_cols()-1)
611 if (i != n_block_rows() - 1)
612 out <<
"\\\\" << std::endl;
619 out <<
"\\end{array}" << std::endl;
622 template <
typename number,
typename BlockVectorType>
623 template <
typename MatrixType>
639 DEAL_II_NAMESPACE_CLOSE
types::global_dof_index size_type
std::vector< Entry > entries
number matrix_norm_square(const BlockVectorType &u) const
types::global_dof_index size_type
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
void Tvmult(BlockVectorType &dst, const BlockVectorType &src) const
PointerMatrixBase< VectorType > * new_pointer_matrix_base(MatrixType &matrix, const VectorType &, const char *name="PointerMatrixAux")
void vmult(BlockVectorType &dst, const BlockVectorType &src) const
void vmult_add(BlockVectorType &dst, const BlockVectorType &src) const
unsigned int n_block_cols() const
#define DeclException1(Exception1, type1, outsequence)
void initialize(const unsigned int n_block_rows, const unsigned int n_block_cols)
unsigned int global_dof_index
#define Assert(cond, exc)
void vmult_add(BlockVectorType &dst, const BlockVectorType &src) const
unsigned int n_block_rows() const
void print_latex(StreamType &out) const
void Tvmult(BlockVectorType &dst, const BlockVectorType &src) const
static ::ExceptionBase & ExcMultipleDiagonal(size_type arg1)
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)
Entry & operator=(const Entry &)
BlockTrianglePrecondition()
void enter(const MatrixType &matrix, const size_type row, const size_type col, const number prefix=1., const bool transpose=false)
types::global_dof_index size_type
void Tvmult_add(BlockVectorType &dst, const BlockVectorType &src) const
static ::ExceptionBase & ExcNoDiagonal(size_type arg1)
void Tvmult_add(BlockVectorType &dst, const BlockVectorType &src) const
PointerMatrixBase< typename BlockVectorType::BlockType > * matrix
void reinit(const unsigned int n_block_rows)
void vmult(BlockVectorType &dst, const BlockVectorType &src) const
void do_row(BlockVectorType &dst, size_type row_num) const
number matrix_scalar_product(const BlockVectorType &u, const BlockVectorType &v) const
void enter(const MatrixType &matrix, const unsigned int row, const unsigned int col, const number prefix=1., const bool transpose=false)