16#ifndef dealii_block_sparse_matrix_ez_h
17#define dealii_block_sparse_matrix_ez_h
39template <
typename Number>
60template <
typename Number>
79 const unsigned int block_cols);
135 block(
const unsigned int row,
const unsigned int column);
143 block(
const unsigned int row,
const unsigned int column)
const;
205 template <
typename somenumber>
214 template <
typename somenumber>
223 template <
typename somenumber>
233 template <
typename somenumber>
244 template <
class StreamType>
271template <
typename Number>
275 return row_indices.size();
280template <
typename Number>
284 return column_indices.size();
289template <
typename Number>
292 const unsigned int column)
297 return blocks[row][column];
302template <
typename Number>
305 const unsigned int column)
const
310 return blocks[row][column];
315template <
typename Number>
319 return row_indices.total_size();
324template <
typename Number>
328 return column_indices.total_size();
333template <
typename Number>
341 const std::pair<size_type, size_type> row_index =
342 row_indices.global_to_local(i),
344 column_indices.global_to_local(j);
345 block(row_index.first, col_index.first)
346 .set(row_index.second, col_index.second, value);
351template <
typename Number>
359 const std::pair<unsigned int, size_type> row_index =
360 row_indices.global_to_local(i),
362 column_indices.global_to_local(j);
363 block(row_index.first, col_index.first)
364 .add(row_index.second, col_index.second, value);
368template <
typename Number>
369template <
typename somenumber>
381 for (
unsigned int row = 0; row < n_block_rows(); ++row)
382 for (
unsigned int col = 0; col < n_block_cols(); ++col)
383 block(row, col).vmult_add(dst.
block(row), src.
block(col));
388template <
typename Number>
389template <
typename somenumber>
399 for (
unsigned int row = 0; row < n_block_rows(); ++row)
400 for (
unsigned int col = 0; col < n_block_cols(); ++col)
401 block(row, col).vmult_add(dst.
block(row), src.
block(col));
406template <
typename Number>
407template <
typename somenumber>
419 for (
unsigned int row = 0; row < n_block_rows(); ++row)
420 for (
unsigned int col = 0; col < n_block_cols(); ++col)
421 block(row, col).Tvmult_add(dst.
block(col), src.
block(row));
426template <
typename Number>
427template <
typename somenumber>
438 for (
unsigned int row = 0; row < n_block_rows(); ++row)
439 for (
unsigned int col = 0; col < n_block_cols(); ++col)
440 block(row, col).Tvmult_add(dst.
block(col), src.
block(row));
444template <
typename number>
445template <
class StreamType>
452 std::vector<size_type> used_by_line_total;
457 std::vector<size_type> used_by_line;
459 for (
size_type i = 0; i < n_block_rows(); ++i)
460 for (
size_type j = 0; j < n_block_cols(); ++j)
462 used_by_line.clear();
463 out <<
"block:\t" << i <<
'\t' << j << std::endl;
464 block(i, j).compute_statistics(
465 used, allocated, reserved, used_by_line, full);
467 out <<
"used:" << used << std::endl
468 <<
"allocated:" << allocated << std::endl
469 <<
"reserved:" << reserved << std::endl;
472 allocated_total += allocated;
473 reserved_total += reserved;
477 used_by_line_total.resize(used_by_line.size());
478 for (
size_type i = 0; i < used_by_line.size(); ++i)
479 if (used_by_line[i] != 0)
481 out <<
"row-entries\t" << i <<
"\trows\t" << used_by_line[i]
483 used_by_line_total[i] += used_by_line[i];
487 out <<
"Total" << std::endl
488 <<
"used:" << used_total << std::endl
489 <<
"allocated:" << allocated_total << std::endl
490 <<
"reserved:" << reserved_total << std::endl;
491 for (
size_type i = 0; i < used_by_line_total.size(); ++i)
492 if (used_by_line_total[i] != 0)
494 out <<
"row-entries\t" << i <<
"\trows\t" << used_by_line_total[i]
void print_statistics(StreamType &s, bool full=false)
unsigned int n_block_cols() const
unsigned int n_block_rows() const
BlockSparseMatrixEZ()=default
void reinit(const unsigned int n_block_rows, const unsigned int n_block_cols)
void Tvmult_add(BlockVector< somenumber > &dst, const BlockVector< somenumber > &src) const
BlockSparseMatrixEZ & operator=(const BlockSparseMatrixEZ< Number > &)
BlockSparseMatrixEZ & operator=(const double d)
void vmult(BlockVector< somenumber > &dst, const BlockVector< somenumber > &src) const
Table< 2, SparseMatrixEZ< Number > > blocks
void Tvmult(BlockVector< somenumber > &dst, const BlockVector< somenumber > &src) const
SparseMatrixEZ< Number > & block(const unsigned int row, const unsigned int column)
BlockSparseMatrixEZ(const unsigned int block_rows, const unsigned int block_cols)
void set(const size_type i, const size_type j, const Number value)
void add(const size_type i, const size_type j, const Number value)
void vmult_add(BlockVector< somenumber > &dst, const BlockVector< somenumber > &src) const
BlockSparseMatrixEZ(const BlockSparseMatrixEZ< Number > &)
BlockIndices column_indices
unsigned int n_blocks() const
BlockType & block(const unsigned int i)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertIsFinite(number)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
unsigned int global_dof_index