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
115 template <
typename number =
double,
typename BlockVectorType=BlockVector<number> >
134 const unsigned int n_block_cols);
140 void initialize (
const unsigned int n_block_rows,
141 const unsigned int n_block_cols);
146 void reinit (
const unsigned int n_block_rows,
147 const unsigned int n_block_cols);
159 template <
typename MatrixType>
160 void enter (
const MatrixType &matrix,
161 const unsigned int row,
162 const unsigned int col,
163 const number prefix = 1.,
174 unsigned int n_block_rows ()
const;
179 unsigned int n_block_cols ()
const;
184 void vmult (BlockVectorType &dst,
185 const BlockVectorType &src)
const;
190 void vmult_add(BlockVectorType &dst,
191 const BlockVectorType &src)
const;
196 void Tvmult (BlockVectorType &dst,
197 const BlockVectorType &src)
const;
202 void Tvmult_add (BlockVectorType &dst,
203 const BlockVectorType &src)
const;
209 number matrix_scalar_product (
const BlockVectorType &u,
210 const BlockVectorType &v)
const;
216 number matrix_norm_square (
const BlockVectorType &u)
const;
257 template <
class StreamType>
258 void print_latex (StreamType &out)
const;
277 template <
typename MatrixType>
278 Entry (
const MatrixType &matrix,
409 template <
typename number =
double,
typename BlockVectorType = BlockVector<number> >
434 void reinit (
const unsigned int n_block_rows);
441 template <
typename MatrixType>
442 void enter (
const MatrixType &matrix,
445 const number prefix = 1.,
451 void vmult (BlockVectorType &dst,
452 const BlockVectorType &src)
const;
458 const BlockVectorType &src)
const;
463 void Tvmult (BlockVectorType &dst,
464 const BlockVectorType &src)
const;
470 const BlockVectorType &src)
const;
501 <<
"No diagonal entry was added for block " << arg1);
509 <<
"Inverse diagonal entries may not be added in block " 517 void do_row (BlockVectorType &dst,
530 template <
typename number,
typename BlockVectorType>
531 template <
typename MatrixType>
534 (
const MatrixType &m,
549 template <
typename number,
typename BlockVectorType>
550 template <
typename MatrixType>
561 entries.push_back(Entry(matrix, row, col, prefix,
transpose));
565 template <
typename number,
typename BlockVectorType>
566 template <
class StreamType>
571 out <<
"\\begin{array}{" 572 << std::string(n_block_cols(),
'c')
577 typedef std::map<const PointerMatrixBase<typename BlockVectorType::BlockType > *, std::string> NameMap;
578 NameMap matrix_names;
580 typename std::vector<Entry>::const_iterator m = entries.begin();
581 typename std::vector<Entry>::const_iterator end = entries.end();
584 for (; m != end ; ++m)
586 if (matrix_names.find(m->matrix) == matrix_names.end())
588 std::pair<typename NameMap::iterator, bool> x =
592 std::ostringstream stream;
593 stream << matrix_number++;
595 x.first->second += stream.str();
598 std::ostringstream stream;
600 if (array(m->row, m->col) !=
"" && m->prefix >= 0)
603 stream << m->prefix <<
'x';
604 stream << matrix_names.find(m->matrix)->second;
609 array(m->row, m->col) += stream.str();
611 for (
unsigned int i=0; i<n_block_rows(); ++i)
612 for (
unsigned int j=0; j<n_block_cols(); ++j)
614 out <<
'\t' << array(i,j);
615 if (j==n_block_cols()-1)
617 if (i != n_block_rows() - 1)
618 out <<
"\\\\" << std::endl;
625 out <<
"\\end{array}" << std::endl;
628 template <
typename number,
typename BlockVectorType>
629 template <
typename MatrixType>
645 DEAL_II_NAMESPACE_CLOSE
types::global_dof_index size_type
std::vector< Entry > entries
types::global_dof_index size_type
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
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
#define DeclException1(Exception1, type1, outsequence)
unsigned int global_dof_index
#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)
types::global_dof_index size_type
void Tvmult_add(BlockVectorType &dst, const BlockVectorType &src) const
PointerMatrixBase< typename BlockVectorType::BlockType > * matrix
void enter(const MatrixType &matrix, const unsigned int row, const unsigned int col, const number prefix=1., const bool transpose=false)