17 #ifndef __deal2__block_matrix_array_h
18 #define __deal2__block_matrix_array_h
20 #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/pointer_matrix.h>
25 #include <deal.II/lac/vector_memory.h>
36 template <
typename>
class Vector;
127 template <
typename number =
double>
182 void initialize (const
unsigned int n_block_rows,
183 const
unsigned int n_block_cols,
190 void reinit (const
unsigned int n_block_rows,
191 const
unsigned int n_block_cols);
214 const
unsigned int row,
215 const
unsigned int col,
216 const
double prefix = 1.,
217 const
bool transpose = false);
232 const
unsigned int row,
233 const
unsigned int col,
234 const
double prefix = 1.,
235 const
bool transpose = false) DEAL_II_DEPRECATED;
248 unsigned int n_block_rows () const;
254 unsigned int n_block_cols () const;
317 template <class STREAM>
343 template<
class MATRIX>
344 Entry (
const MATRIX &matrix,
345 size_type row, size_type col,
346 double prefix,
bool transpose);
361 Entry(
const Entry &);
479 template <
typename number =
double>
528 void initialize (const
unsigned int n_block_rows,
536 void reinit (const
unsigned int n_block_rows);
550 const
double prefix = 1.,
551 const
bool transpose = false);
569 const
double prefix = 1.,
570 const
bool transpose = false) DEAL_II_DEPRECATED;
628 << "No diagonal entry was added for block " << arg1);
639 << "Inverse diagonal
entries may not be added in block "
650 size_type row_num) const;
662 template <
typename number>
663 template <
class MATRIX>
675 transpose (transpose),
676 matrix (new_pointer_matrix_base(m,
Vector<number>(), typeid(*this).name()))
681 template <
typename number>
682 template <
class MATRIX>
694 entries.push_back(Entry(matrix, row, col, prefix, transpose));
698 template <
typename number>
699 template <
class MATRIX>
712 entries.push_back(Entry(matrix, row, col, prefix, transpose, mem));
716 template<
typename number>
717 struct BlockMatrixArrayPointerMatrixLess
727 template <
typename number>
728 template <
class STREAM>
733 out <<
"\\begin{array}{"
734 << std::string(n_block_cols(),
'c')
739 typedef std::map<const PointerMatrixBase<Vector<number> > *,
740 std::string, BlockMatrixArrayPointerMatrixLess<number> > NameMap;
741 NameMap matrix_names;
743 typename std::vector<Entry>::const_iterator m = entries.begin();
744 typename std::vector<Entry>::const_iterator end = entries.end();
746 size_type matrix_number = 0;
747 for (; m != end ; ++m)
749 if (matrix_names.find(m->matrix) == matrix_names.end())
751 std::pair<typename NameMap::iterator, bool> x =
755 std::ostringstream stream;
756 stream << matrix_number++;
758 x.first->second += stream.str();
761 std::ostringstream stream;
763 if (array(m->row, m->col) !=
"" && m->prefix >= 0)
766 stream << m->prefix <<
'x';
767 stream << matrix_names.find(m->matrix)->second;
772 array(m->row, m->col) += stream.str();
774 for (
unsigned int i=0; i<n_block_rows(); ++i)
775 for (
unsigned int j=0; j<n_block_cols(); ++j)
777 out <<
'\t' << array(i,j);
778 if (j==n_block_cols()-1)
779 out <<
"\\\\" << std::endl;
783 out <<
"\\end{array}" << std::endl;
786 template <
typename number>
787 template <
class MATRIX>
791 size_type row, size_type col,
792 double prefix,
bool transpose)
799 template <
typename number>
800 template <
class MATRIX>
818 DEAL_II_NAMESPACE_CLOSE
void Tvmult_add(BlockVector< number > &dst, const BlockVector< number > &src) const
void unsubscribe(const char *identifier=0) const
std::vector< Entry > entries
void subscribe(const char *identifier=0) const
void do_row(BlockVector< number > &dst, size_type row_num) const
void initialize(const unsigned int n_block_rows, VectorMemory< Vector< number > > &mem, const bool backward=false) DEAL_II_DEPRECATED
void enter(const MATRIX &matrix, const unsigned int row, const unsigned int col, const double prefix=1., const bool transpose=false)
void vmult(BlockVector< number > &dst, const BlockVector< number > &src) const
unsigned int n_block_cols() const
void vmult(BlockVector< number > &dst, const BlockVector< number > &src) const
void Tvmult(BlockVector< number > &dst, const BlockVector< number > &src) const
PointerMatrixBase< Vector< number > > * matrix
void vmult_add(BlockVector< number > &dst, const BlockVector< number > &src) const
void print_latex(STREAM &out) const
Entry(const MATRIX &matrix, size_type row, size_type col, double prefix, bool transpose)
types::global_dof_index size_type
void Tvmult(BlockVector< number > &dst, const BlockVector< number > &src) const
unsigned int global_dof_index
void reinit(const unsigned int n_block_rows)
#define Assert(cond, exc)
::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
void reinit(const unsigned int n_block_rows, const unsigned int n_block_cols)
BlockCompressedSparsityPattern CompressedBlockSparsityPattern DEAL_II_DEPRECATED
DeclException1(ExcNoDiagonal, size_type,<< "No diagonal entry was added for block "<< arg1)
void enter_aux(VectorMemory< Vector< number > > &mem, const MATRIX &matrix, const unsigned int row, const unsigned int col, const double prefix=1., const bool transpose=false) DEAL_II_DEPRECATED
void vmult_add(BlockVector< number > &dst, const BlockVector< number > &src) const
number matrix_scalar_product(const BlockVector< number > &u, const BlockVector< number > &v) const
void Tvmult_add(BlockVector< number > &dst, const BlockVector< number > &src) const
void enter_aux(VectorMemory< Vector< double > > &mem, const MATRIX &matrix, const size_type row, const size_type col, const double prefix=1., const bool transpose=false) DEAL_II_DEPRECATED
number matrix_norm_square(const BlockVector< number > &u) const
void enter(const MATRIX &matrix, const size_type row, const size_type col, const double prefix=1., const bool transpose=false)
unsigned int n_block_rows() const
void initialize(const unsigned int n_block_rows, const unsigned int n_block_cols)
BlockTrianglePrecondition()
types::global_dof_index size_type