23template <
typename SparsityPatternType>
31template <
typename SparsityPatternType>
42template <
typename SparsityPatternType>
50 "This constructor can only be called if the provided argument "
51 "is the sparsity pattern for an empty matrix. This constructor can "
52 "not be used to copy-construct a non-empty sparsity pattern."));
57template <
typename SparsityPatternType>
63 sub_objects.reinit(0, 0);
68 sub_objects.reinit(block_rows, block_columns);
69 for (
size_type i = 0; i < n_block_rows(); ++i)
71 sub_objects[i][
j] = std::make_unique<SparsityPatternType>();
75template <
typename SparsityPatternType>
83 for (
size_type i = 0; i < n_block_rows(); ++i)
85 *sub_objects[i][
j] = *
bsp.sub_objects[i][
j];
94template <
typename SparsityPatternType>
108template <
typename SparsityPatternType>
115 for (
size_type c = 0; c < n_block_cols(); ++c)
116 count += sub_objects[0][c]->n_cols();
122template <
typename SparsityPatternType>
128 std::vector<size_type>
row_sizes(n_block_rows());
129 std::vector<size_type>
col_sizes(n_block_cols());
138 for (
size_type c = 1; c < n_block_cols(); ++c)
141 ExcIncompatibleRowNumbers(
r, 0,
r, c));
149 for (
size_type c = 0; c < n_block_cols(); ++c)
150 col_sizes[c] = sub_objects[0][c]->n_cols();
152 for (
size_type c = 0; c < n_block_cols(); ++c)
154 ExcIncompatibleRowNumbers(0, c,
r, c));
161 block_column_indices.resize(n_block_cols());
162 counter_within_block.resize(n_block_cols());
167template <
typename SparsityPatternType>
171 for (
size_type i = 0; i < n_block_rows(); ++i)
173 sub_objects[i][
j]->compress();
178template <
typename SparsityPatternType>
182 for (
size_type i = 0; i < n_block_rows(); ++i)
184 if (sub_objects[i][
j]->empty() ==
false)
191template <
typename SparsityPatternType>
196 for (
size_type block_row = 0; block_row < n_block_rows(); ++block_row)
199 for (
size_type c = 0; c < n_block_cols(); ++c)
200 this_row += sub_objects[block_row][c]->max_entries_per_row();
210template <
typename SparsityPatternType>
215 for (
size_type i = 0; i < n_block_rows(); ++i)
217 count += sub_objects[i][
j]->n_nonzero_elements();
223template <
typename SparsityPatternType>
230 for (
size_type i = 0; i < block(
ib, 0).n_rows(); ++i)
242 out <<
']' << std::endl;
244 k += block(
ib, 0).n_rows();
255 for (size_type
ib = 0;
ib < n_block_rows(); ++
ib)
257 for (size_type i = 0; i < block(
ib, 0).n_rows(); ++i)
261 for (size_type
jb = 0;
jb < n_block_cols(); ++
jb)
264 if (b.row_index_set().size() == 0 ||
265 b.row_index_set().is_element(i))
266 for (size_type
j = 0;
j < b.n_cols(); ++
j)
271 out <<
']' << std::endl;
273 k += block(
ib, 0).n_rows();
280template <
typename SparsityPatternType>
283 std::ostream &out)
const
288 for (
size_type i = 0; i < block(
ib, 0).n_rows(); ++i)
296 out << l +
j <<
" " << -
static_cast<signed int>(i +
k)
301 k += block(
ib, 0).n_rows();
307template <
typename SparsityPatternType>
310 std::ostream &out)
const
312 const unsigned int m = this->n_rows();
313 const unsigned int n = this->n_cols();
315 <<
"<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 "
316 << n + 2 <<
" " << m + 2
318 "<style type=\"text/css\" >\n"
326 << n + 2 <<
"\" height=\"" << m + 2
327 <<
"\" fill=\"rgb(128, 128, 128)\"/>\n"
328 " <rect x=\"1\" y=\"1\" width=\""
329 << n + 0.1 <<
"\" height=\"" << m + 0.1
330 <<
"\" fill=\"rgb(255, 255, 255)\"/>\n\n";
336 out <<
" <rect class=\"pixel\" x=\""
337 << column_indices.local_to_global(
block_j, entry.column()) + 1
339 << row_indices.local_to_global(
block_i, entry.row()) + 1
340 <<
"\" width=\".9\" height=\".9\"/>\n";
343 out <<
"</svg>" << std::endl;
348template <
typename SparsityPatternType>
359 for (
size_type c = 0; c < n_block_cols(); ++c)
377 const std::vector<std::vector<unsigned int>> &
row_lengths)
451 const std::vector<size_type> &row_indices,
532#ifdef DEAL_II_WITH_TRILINOS
543 const std::vector<size_type> &row_indices,
666#ifdef DEAL_II_WITH_TRILINOS
void reinit(const std::vector< size_type > &row_block_sizes, const std::vector< size_type > &col_block_sizes)
BlockDynamicSparsityPattern()=default
size_type block_size(const unsigned int i) const
unsigned int size() const
void print_gnuplot(std::ostream &out) const
size_type n_block_rows() const
BlockSparsityPatternBase()
Table< 2, std::unique_ptr< SparsityPattern > > sub_objects
SparsityPattern & block(const size_type row, const size_type column)
size_type n_nonzero_elements() const
void print(std::ostream &out) const
std::size_t memory_consumption() const
void print_svg(std::ostream &out) const
size_type max_entries_per_row() const
size_type compute_n_rows() const
void reinit(const size_type n_block_rows, const size_type n_block_columns)
size_type n_block_cols() const
BlockIndices column_indices
BlockSparsityPatternBase & operator=(const BlockSparsityPatternBase &)
size_type compute_n_cols() const
void copy_from(const BlockDynamicSparsityPattern &dsp)
void reinit(const size_type n_block_rows, const size_type n_block_columns)
BlockSparsityPattern()=default
bool is_compressed() const
void reinit(const size_type m, const size_type n, const IndexSet &rowset=IndexSet())
virtual void resize(const size_type rows, const size_type cols)
void reinit(const size_type m, const size_type n, const ArrayView< const unsigned int > &row_lengths)
void copy_from(const size_type n_rows, const size_type n_cols, const ForwardIterator begin, const ForwardIterator end)
BlockSparsityPattern()=default
void reinit(const std::vector< size_type > &row_block_sizes, const std::vector< size_type > &col_block_sizes)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
std::vector< index_type > data
std::enable_if_t< std::is_fundamental_v< T >, std::size_t > memory_consumption(const T &t)