17 #ifndef __deal2__block_sparse_matrix_ez_templates_h
18 #define __deal2__block_sparse_matrix_ez_templates_h
21 #include <deal.II/base/config.h>
22 #include <deal.II/base/memory_consumption.h>
23 #include <deal.II/lac/block_sparse_matrix_ez.h>
28 template <
typename number>
34 template <
typename number>
37 const unsigned int cols)
39 row_indices (rows, 0),
40 column_indices (cols, 0)
55 template <
typename number>
68 for (
unsigned int r=0; r<n_block_rows(); ++r)
69 for (
unsigned int c=0; c<n_block_cols(); ++c)
70 block(r,c) = m.
block(r,c);
76 template <
typename number>
82 for (
unsigned int r=0; r<n_block_rows(); ++r)
83 for (
unsigned int c=0; c<n_block_cols(); ++c)
91 template <
typename number>
96 row_indices(m.row_indices),
97 column_indices(m.column_indices),
103 template <
typename number>
106 const unsigned int cols)
108 row_indices.reinit(rows, 0);
109 column_indices.reinit(cols, 0);
110 blocks.reinit(rows, cols);
115 template <
typename number>
119 row_indices.reinit(0, 0);
120 column_indices.reinit(0, 0);
126 template <
typename number>
130 for (
unsigned int r=0; r<n_block_rows(); ++r)
131 for (
unsigned int c=0; c<n_block_cols(); ++c)
132 if (block(r,c).empty () ==
false)
139 template <
typename number>
143 const unsigned int rows = n_block_rows();
144 const unsigned int columns = n_block_cols();
145 std::vector<size_type> row_sizes (rows);
146 std::vector<size_type> col_sizes (columns);
150 for (
unsigned int r=0; r<rows; ++r)
151 row_sizes[r] = blocks[r][0].m();
155 for (
unsigned int c=1; c<columns; ++c)
156 for (
unsigned int r=0; r<rows; ++r)
157 Assert (row_sizes[r] == blocks[r][c].m(),
162 row_indices.reinit (row_sizes);
166 for (
unsigned int c=0; c<columns; ++c)
167 col_sizes[c] = blocks[0][c].n();
168 for (
unsigned int r=1; r<rows; ++r)
169 for (
unsigned int c=0; c<columns; ++c)
170 Assert (col_sizes[c] == blocks[r][c].n(),
175 column_indices.reinit (col_sizes);
217 DEAL_II_NAMESPACE_CLOSE
219 #endif // ifdef block_sparse_matrix_templates_h
void reinit(const unsigned int n_block_rows, const unsigned int n_block_cols)
unsigned int n_block_rows() const
SparseMatrixEZ< Number > & block(const unsigned int row, const unsigned int column)
#define Assert(cond, exc)
unsigned int n_block_cols() const
BlockSparseMatrixEZ & operator=(const BlockSparseMatrixEZ< Number > &)
::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
::ExceptionBase & ExcScalarAssignmentOnlyForZeroValue()