24template <
class SparsityPatternType>
32template <
class SparsityPatternType>
43template <
class SparsityPatternType>
51 "This constructor can only be called if the provided argument "
52 "is the sparsity pattern for an empty matrix. This constructor can "
53 "not be used to copy-construct a non-empty sparsity pattern."));
58template <
class SparsityPatternType>
64 sub_objects.reinit(0, 0);
69 sub_objects.reinit(block_rows, block_columns);
70 for (
size_type i = 0; i < n_block_rows(); ++i)
72 sub_objects[i][
j] = std::make_unique<SparsityPatternType>();
76template <
class SparsityPatternType>
84 for (
size_type i = 0; i < n_block_rows(); ++i)
86 *sub_objects[i][
j] = *
bsp.sub_objects[i][
j];
95template <
class SparsityPatternType>
102 for (
size_type r = 0; r < n_block_rows(); ++r)
103 count += sub_objects[r][0]->n_rows();
109template <
class SparsityPatternType>
116 for (
size_type c = 0; c < n_block_cols(); ++c)
117 count += sub_objects[0][c]->n_cols();
123template <
class SparsityPatternType>
129 std::vector<size_type>
row_sizes(n_block_rows());
130 std::vector<size_type>
col_sizes(n_block_cols());
134 for (
size_type r = 0; r < n_block_rows(); ++r)
139 for (
size_type c = 1; c < n_block_cols(); ++c)
140 for (
size_type r = 0; r < n_block_rows(); ++r)
142 ExcIncompatibleRowNumbers(r, 0, r, c));
150 for (
size_type c = 0; c < n_block_cols(); ++c)
151 col_sizes[c] = sub_objects[0][c]->n_cols();
153 for (
size_type c = 0; c < n_block_cols(); ++c)
155 ExcIncompatibleRowNumbers(0, c, r, c));
162 block_column_indices.resize(n_block_cols());
163 counter_within_block.resize(n_block_cols());
168template <
class SparsityPatternType>
172 for (
size_type i = 0; i < n_block_rows(); ++i)
174 sub_objects[i][
j]->compress();
179template <
class SparsityPatternType>
183 for (
size_type i = 0; i < n_block_rows(); ++i)
185 if (sub_objects[i][
j]->
empty() ==
false)
192template <
class SparsityPatternType>
197 for (
size_type block_row = 0; block_row < n_block_rows(); ++block_row)
200 for (
size_type c = 0; c < n_block_cols(); ++c)
201 this_row += sub_objects[block_row][c]->max_entries_per_row();
211template <
class SparsityPatternType>
216 for (
size_type i = 0; i < n_block_rows(); ++i)
218 count += sub_objects[i][
j]->n_nonzero_elements();
224template <
class SparsityPatternType>
231 for (
size_type i = 0; i < block(
ib, 0).n_rows(); ++i)
243 out <<
']' << std::endl;
245 k += block(
ib, 0).n_rows();
256 for (size_type
ib = 0;
ib < n_block_rows(); ++
ib)
258 for (size_type i = 0; i < block(
ib, 0).n_rows(); ++i)
262 for (size_type
jb = 0;
jb < n_block_cols(); ++
jb)
265 if (b.row_index_set().
size() == 0 ||
266 b.row_index_set().is_element(i))
267 for (size_type
j = 0;
j < b.n_cols(); ++
j)
272 out <<
']' << std::endl;
274 k += block(
ib, 0).n_rows();
281template <
class SparsityPatternType>
284 std::ostream &out)
const
289 for (
size_type i = 0; i < block(
ib, 0).n_rows(); ++i)
297 out << l +
j <<
" " << -
static_cast<signed int>(i +
k)
302 k += block(
ib, 0).n_rows();
308template <
class SparsityPatternType>
311 std::ostream &out)
const
313 const unsigned int m = this->n_rows();
314 const unsigned int n = this->n_cols();
316 <<
"<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 "
317 << n + 2 <<
" " << m + 2
319 "<style type=\"text/css\" >\n"
327 << n + 2 <<
"\" height=\"" << m + 2
328 <<
"\" fill=\"rgb(128, 128, 128)\"/>\n"
329 " <rect x=\"1\" y=\"1\" width=\""
330 << n + 0.1 <<
"\" height=\"" << m + 0.1
331 <<
"\" fill=\"rgb(255, 255, 255)\"/>\n\n";
337 out <<
" <rect class=\"pixel\" x=\""
338 << column_indices.local_to_global(
block_j, entry.column()) + 1
340 << row_indices.local_to_global(
block_i, entry.row()) + 1
341 <<
"\" width=\".9\" height=\".9\"/>\n";
344 out <<
"</svg>" << std::endl;
349template <
class SparsityPatternType>
359 for (
size_type r = 0; r < n_block_rows(); ++r)
360 for (
size_type c = 0; c < n_block_cols(); ++c)
378 const std::vector<std::vector<unsigned int>> &
row_lengths)
452 const std::vector<size_type> &row_indices,
533#ifdef DEAL_II_WITH_TRILINOS
544 const std::vector<size_type> &row_indices,
667#ifdef DEAL_II_WITH_TRILINOS
void reinit(value_type *starting_element, const std::size_t n_elements)
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::enable_if_t< std::is_fundamental< T >::value, std::size_t > memory_consumption(const T &t)