16#ifndef dealii_block_sparse_matrix_ez_h
17#define dealii_block_sparse_matrix_ez_h
39template <
typename Number>
59template <
typename Number>
78 const unsigned int block_cols);
134 block(
const unsigned int row,
const unsigned int column);
142 block(
const unsigned int row,
const unsigned int column)
const;
204 template <
typename somenumber>
213 template <
typename somenumber>
222 template <
typename somenumber>
232 template <
typename somenumber>
243 template <
class StreamType>
270template <
typename Number>
274 return row_indices.size();
279template <
typename Number>
283 return column_indices.size();
288template <
typename Number>
291 const unsigned int column)
296 return blocks[row][column];
301template <
typename Number>
304 const unsigned int column)
const
309 return blocks[row][column];
314template <
typename Number>
318 return row_indices.total_size();
323template <
typename Number>
327 return column_indices.total_size();
332template <
typename Number>
340 const std::pair<size_type, size_type> row_index =
341 row_indices.global_to_local(i),
343 column_indices.global_to_local(j);
344 block(row_index.first, col_index.first)
345 .set(row_index.second, col_index.second, value);
350template <
typename Number>
358 const std::pair<unsigned int, size_type> row_index =
359 row_indices.global_to_local(i),
361 column_indices.global_to_local(j);
362 block(row_index.first, col_index.first)
363 .add(row_index.second, col_index.second, value);
367template <
typename Number>
368template <
typename somenumber>
380 for (
unsigned int row = 0; row < n_block_rows(); ++row)
381 for (
unsigned int col = 0; col < n_block_cols(); ++col)
382 block(row, col).vmult_add(dst.
block(row), src.
block(col));
387template <
typename Number>
388template <
typename somenumber>
398 for (
unsigned int row = 0; row < n_block_rows(); ++row)
399 for (
unsigned int col = 0; col < n_block_cols(); ++col)
400 block(row, col).vmult_add(dst.
block(row), src.
block(col));
405template <
typename Number>
406template <
typename somenumber>
418 for (
unsigned int row = 0; row < n_block_rows(); ++row)
419 for (
unsigned int col = 0; col < n_block_cols(); ++col)
420 block(row, col).Tvmult_add(dst.
block(col), src.
block(row));
425template <
typename Number>
426template <
typename somenumber>
437 for (
unsigned int row = 0; row < n_block_rows(); ++row)
438 for (
unsigned int col = 0; col < n_block_cols(); ++col)
439 block(row, col).Tvmult_add(dst.
block(col), src.
block(row));
443template <
typename number>
444template <
class StreamType>
451 std::vector<size_type> used_by_line_total;
456 std::vector<size_type> used_by_line;
458 for (
size_type i = 0; i < n_block_rows(); ++i)
459 for (
size_type j = 0; j < n_block_cols(); ++j)
461 used_by_line.clear();
462 out <<
"block:\t" << i <<
'\t' << j << std::endl;
463 block(i, j).compute_statistics(
464 used, allocated, reserved, used_by_line, full);
466 out <<
"used:" << used << std::endl
467 <<
"allocated:" << allocated << std::endl
468 <<
"reserved:" << reserved << std::endl;
471 allocated_total += allocated;
472 reserved_total += reserved;
476 used_by_line_total.resize(used_by_line.size());
477 for (
size_type i = 0; i < used_by_line.size(); ++i)
478 if (used_by_line[i] != 0)
480 out <<
"row-entries\t" << i <<
"\trows\t" << used_by_line[i]
482 used_by_line_total[i] += used_by_line[i];
486 out <<
"Total" << std::endl
487 <<
"used:" << used_total << std::endl
488 <<
"allocated:" << allocated_total << std::endl
489 <<
"reserved:" << reserved_total << std::endl;
490 for (
size_type i = 0; i < used_by_line_total.size(); ++i)
491 if (used_by_line_total[i] != 0)
493 out <<
"row-entries\t" << i <<
"\trows\t" << used_by_line_total[i]
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
unsigned int n_blocks() const
#define Assert(cond, exc)
#define AssertIsFinite(number)
#define AssertIndexRange(index, range)
BlockType & block(const unsigned int i)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
types::global_dof_index size_type
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
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
unsigned int global_dof_index