24 template <
class SparsityPatternBase>
32 template <
class SparsityPatternBase>
44 template <
class SparsityPatternBase>
54 "This constructor can only be called if the provided argument "
55 "is the sparsity pattern for an empty matrix. This constructor can "
56 "not be used to copy-construct a non-empty sparsity pattern."));
61 template <
class SparsityPatternBase>
75 template <
class SparsityPatternBase>
88 sub_objects[i][j] =
nullptr;
95 columns = n_block_columns;
96 sub_objects.reinit(rows, columns);
103 sub_objects[i][j] = p;
108 template <
class SparsityPatternBase>
127 template <
class SparsityPatternBase>
131 std::vector<size_type> row_sizes(rows);
132 std::vector<size_type> col_sizes(columns);
137 row_sizes[r] = sub_objects[r][0]->n_rows();
143 Assert(row_sizes[r] == sub_objects[r][c]->n_rows(),
144 ExcIncompatibleRowNumbers(r, 0, r, c));
148 row_indices.reinit(row_sizes);
153 col_sizes[c] = sub_objects[0][c]->n_cols();
156 Assert(col_sizes[c] == sub_objects[r][c]->n_cols(),
157 ExcIncompatibleRowNumbers(0, c, r, c));
161 column_indices.reinit(col_sizes);
166 template <
class SparsityPatternBase>
177 template <
class SparsityPatternBase>
183 if (sub_objects[i][j]->empty() ==
false)
190 template <
class SparsityPatternBase>
195 for (
size_type block_row = 0; block_row < rows; ++block_row)
199 this_row += sub_objects[block_row][c]->max_entries_per_row();
201 if (this_row > max_entries)
202 max_entries = this_row;
209 template <
class SparsityPatternBase>
217 count += sub_objects[r][0]->n_rows();
223 template <
class SparsityPatternBase>
231 count += sub_objects[0][c]->n_cols();
237 template <
class SparsityPatternBase>
244 count += sub_objects[i][j]->n_nonzero_elements();
250 template <
class SparsityPatternBase>
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)
269 out <<
']' << std::endl;
271 k += block(ib, 0).n_rows();
291 if (
b.row_index_set().size() == 0 ||
292 b.row_index_set().is_element(i))
298 out <<
']' << std::endl;
300 k +=
block(ib, 0).n_rows();
306 template <
class SparsityPatternBase>
309 std::ostream &out)
const
312 for (
size_type ib = 0; ib < n_block_rows(); ++ib)
314 for (
size_type i = 0; i < block(ib, 0).n_rows(); ++i)
317 for (
size_type jb = 0; jb < n_block_cols(); ++jb)
322 out <<
l + j <<
" " << -
static_cast<signed int>(i + k)
327 k += block(ib, 0).n_rows();
343 const std::vector<std::vector<unsigned int>> &row_lengths)
354 if (row_lengths[j].size() == 1)
361 row_lengths[j].
end(),
434 const std::vector<size_type> &row_indices,
435 const std::vector<size_type> &col_indices)
440 for (
size_type j = 0; j < col_indices.size(); ++j)
447 const std::vector<IndexSet> &partitioning)
451 for (
size_type i = 0; i < partitioning.size(); ++i)
452 for (
size_type j = 0; j < partitioning.size(); ++j)
454 partitioning[j].size(),
470 const std::vector<size_type> &row_block_sizes,
471 const std::vector<size_type> &col_block_sizes)
474 row_block_sizes.size(), col_block_sizes.size());
475 for (
size_type i = 0; i < row_block_sizes.size(); ++i)
476 for (
size_type j = 0; j < col_block_sizes.size(); ++j)
477 this->
block(i, j).
reinit(row_block_sizes[i], col_block_sizes[j]);
485 partitioning.size());
486 for (
size_type i = 0; i < partitioning.size(); ++i)
487 for (
size_type j = 0; j < partitioning.size(); ++j)
489 partitioning[j].size(),
508 #ifdef DEAL_II_WITH_TRILINOS
519 const std::vector<size_type> &row_indices,
520 const std::vector<size_type> &col_indices)
525 for (
size_type j = 0; j < col_indices.size(); ++j)
533 const std::vector<IndexSet> ¶llel_partitioning,
536 parallel_partitioning.size())
538 for (
size_type i = 0; i < parallel_partitioning.size(); ++i)
539 for (
size_type j = 0; j < parallel_partitioning.size(); ++j)
541 parallel_partitioning[j],
549 const std::vector<IndexSet> &row_parallel_partitioning,
550 const std::vector<IndexSet> &col_parallel_partitioning,
551 const std::vector<IndexSet> &writable_rows,
554 row_parallel_partitioning.size(),
555 col_parallel_partitioning.size())
557 for (
size_type i = 0; i < row_parallel_partitioning.size(); ++i)
558 for (
size_type j = 0; j < col_parallel_partitioning.size(); ++j)
559 this->
block(i, j).
reinit(row_parallel_partitioning[i],
560 col_parallel_partitioning[j],
570 const std::vector<size_type> &col_block_sizes)
573 row_block_sizes.size(), col_block_sizes.size());
574 for (
size_type i = 0; i < row_block_sizes.size(); ++i)
575 for (
size_type j = 0; j < col_block_sizes.size(); ++j)
576 this->
block(i, j).
reinit(row_block_sizes[i], col_block_sizes[j]);
584 const std::vector<IndexSet> ¶llel_partitioning,
588 parallel_partitioning.size(), parallel_partitioning.size());
589 for (
size_type i = 0; i < parallel_partitioning.size(); ++i)
590 for (
size_type j = 0; j < parallel_partitioning.size(); ++j)
592 parallel_partitioning[j],
601 const std::vector<IndexSet> &row_parallel_partitioning,
602 const std::vector<IndexSet> &col_parallel_partitioning,
606 row_parallel_partitioning.size(), col_parallel_partitioning.size());
607 for (
size_type i = 0; i < row_parallel_partitioning.size(); ++i)
608 for (
size_type j = 0; j < col_parallel_partitioning.size(); ++j)
609 this->
block(i, j).
reinit(row_parallel_partitioning[i],
610 col_parallel_partitioning[j],
619 const std::vector<IndexSet> &row_parallel_partitioning,
620 const std::vector<IndexSet> &col_parallel_partitioning,
621 const std::vector<IndexSet> &writable_rows,
624 AssertDimension(writable_rows.size(), row_parallel_partitioning.size());
626 row_parallel_partitioning.size(), col_parallel_partitioning.size());
627 for (
size_type i = 0; i < row_parallel_partitioning.size(); ++i)
628 for (
size_type j = 0; j < col_parallel_partitioning.size(); ++j)
629 this->
block(i, j).
reinit(row_parallel_partitioning[i],
630 col_parallel_partitioning[j],
642 #ifdef DEAL_II_WITH_TRILINOS