16 #ifndef dealii_block_sparse_matrix_ez_h 17 #define dealii_block_sparse_matrix_ez_h 22 #include <deal.II/base/config.h> 23 #include <deal.II/base/exceptions.h> 24 #include <deal.II/base/subscriptor.h> 25 #include <deal.II/base/table.h> 26 #include <deal.II/base/smartpointer.h> 27 #include <deal.II/lac/block_indices.h> 28 #include <deal.II/lac/sparse_matrix_ez.h> 30 DEAL_II_NAMESPACE_OPEN
51 template <
typename Number>
70 const unsigned int block_cols);
122 block (
const unsigned int row,
123 const unsigned int column);
131 block (
const unsigned int row,
132 const unsigned int column)
const;
190 template <
typename somenumber>
199 template <
typename somenumber>
207 template <
typename somenumber>
216 template <
typename somenumber>
226 template <
class StreamType>
252 template <
typename Number>
257 return row_indices.size();
262 template <
typename Number>
267 return column_indices.size();
272 template <
typename Number>
276 const unsigned int column)
281 return blocks[row][column];
286 template <
typename Number>
290 const unsigned int column)
const 295 return blocks[row][column];
300 template <
typename Number>
305 return row_indices.total_size();
310 template <
typename Number>
315 return column_indices.total_size();
320 template <
typename Number>
330 const std::pair<size_type,size_type>
331 row_index = row_indices.global_to_local (i),
332 col_index = column_indices.global_to_local (j);
333 block(row_index.first,col_index.first).set (row_index.second,
340 template <
typename Number>
350 const std::pair<unsigned int,size_type>
351 row_index = row_indices.global_to_local (i),
352 col_index = column_indices.global_to_local (j);
353 block(row_index.first,col_index.first).add (row_index.second,
359 template <
typename Number>
360 template <
typename somenumber>
372 for (
unsigned int row=0; row<n_block_rows(); ++row)
373 for (
unsigned int col=0; col<n_block_cols(); ++col)
374 block(row,col).vmult_add (dst.
block(row),
380 template <
typename Number>
381 template <
typename somenumber>
392 for (
unsigned int row=0; row<n_block_rows(); ++row)
393 for (
unsigned int col=0; col<n_block_cols(); ++col)
394 block(row,col).vmult_add (dst.
block(row),
401 template <
typename Number>
402 template <
typename somenumber>
415 for (
unsigned int row=0; row<n_block_rows(); ++row)
416 for (
unsigned int col=0; col<n_block_cols(); ++col)
417 block(row,col).Tvmult_add (dst.
block(col),
423 template <
typename Number>
424 template <
typename somenumber>
435 for (
unsigned int row=0; row<n_block_rows(); ++row)
436 for (
unsigned int col=0; col<n_block_cols(); ++col)
437 block(row,col).Tvmult_add (dst.
block(col),
442 template <
typename number>
443 template <
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 (used, allocated, reserved,
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
481 <<
"\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
495 <<
"\trows\t" << used_by_line_total[i]
501 DEAL_II_NAMESPACE_CLOSE
503 #endif //dealii_block_sparse_matrix_ez_h void Tvmult_add(BlockVector< somenumber > &dst, const BlockVector< somenumber > &src) const
types::global_dof_index size_type
Table< 2, SparseMatrixEZ< Number > > blocks
SparseMatrixEZ< Number > & block(const unsigned int row, const unsigned int column)
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
void add(const size_type i, const size_type j, const Number value)
unsigned int n_block_cols() const
unsigned int global_dof_index
void vmult(BlockVector< somenumber > &dst, const BlockVector< somenumber > &src) const
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
void reinit(const unsigned int n_block_rows, const unsigned int n_block_cols)
BlockSparseMatrixEZ()=default
void set(const size_type i, const size_type j, const Number value)
unsigned int n_blocks() const
void Tvmult(BlockVector< somenumber > &dst, const BlockVector< somenumber > &src) const
BlockIndices column_indices
BlockSparseMatrixEZ & operator=(const BlockSparseMatrixEZ< Number > &)
void print_statistics(StreamType &s, bool full=false)
void vmult_add(BlockVector< somenumber > &dst, const BlockVector< somenumber > &src) const
BlockType & block(const unsigned int i)
#define AssertIsFinite(number)
unsigned int n_block_rows() const