24template <
class SparsityPatternBase>
32template <
class SparsityPatternBase>
44template <
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."));
61template <
class SparsityPatternBase>
75template <
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;
108template <
class SparsityPatternBase>
127template <
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);
166template <
class SparsityPatternBase>
172 sub_objects[i][j]->compress();
177template <
class SparsityPatternBase>
183 if (sub_objects[i][j]->empty() ==
false)
190template <
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;
209template <
class SparsityPatternBase>
217 count += sub_objects[r][0]->n_rows();
223template <
class SparsityPatternBase>
231 count += sub_objects[0][c]->n_cols();
237template <
class SparsityPatternBase>
244 count += sub_objects[i][j]->n_nonzero_elements();
250template <
class SparsityPatternBase>
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 for (
size_type j = 0; j < b.n_cols(); ++j)
269 out <<
']' << std::endl;
271 k += block(ib, 0).n_rows();
282 for (size_type ib = 0; ib < n_block_rows(); ++ib)
284 for (size_type i = 0; i < block(ib, 0).n_rows(); ++i)
288 for (size_type jb = 0; jb < n_block_cols(); ++jb)
291 if (b.row_index_set().size() == 0 ||
292 b.row_index_set().is_element(i))
293 for (
size_type j = 0; j < b.n_cols(); ++j)
298 out <<
']' << std::endl;
300 k += block(ib, 0).n_rows();
307template <
class SparsityPatternBase>
310 std::ostream &out)
const
313 for (
size_type ib = 0; ib < n_block_rows(); ++ib)
315 for (
size_type i = 0; i < block(ib, 0).n_rows(); ++i)
318 for (
size_type jb = 0; jb < n_block_cols(); ++jb)
321 for (
size_type j = 0; j < b.n_cols(); ++j)
323 out << l + j <<
" " << -
static_cast<signed int>(i + k)
328 k += block(ib, 0).n_rows();
334template <
class SparsityPatternBase>
337 std::ostream &out)
const
339 const unsigned int m = this->n_rows();
340 const unsigned int n = this->n_cols();
342 <<
"<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 "
343 << n + 2 <<
" " << m + 2
345 "<style type=\"text/css\" >\n"
353 << n + 2 <<
"\" height=\"" << m + 2
354 <<
"\" fill=\"rgb(128, 128, 128)\"/>\n"
355 " <rect x=\"1\" y=\"1\" width=\""
356 << n + 0.1 <<
"\" height=\"" << m + 0.1
357 <<
"\" fill=\"rgb(255, 255, 255)\"/>\n\n";
359 for (
unsigned int block_i = 0; block_i < n_block_rows(); ++block_i)
360 for (
unsigned int block_j = 0; block_j < n_block_rows(); ++block_j)
361 for (
const auto &entry : block(block_i, block_j))
363 out <<
" <rect class=\"pixel\" x=\""
364 << column_indices.local_to_global(block_j, entry.column()) + 1
366 << row_indices.local_to_global(block_i, entry.row()) + 1
367 <<
"\" width=\".9\" height=\".9\"/>\n";
370 out <<
"</svg>" << std::endl;
385 const std::vector<std::vector<unsigned int>> &row_lengths)
396 if (row_lengths[j].size() == 1)
402 Assert(row_lengths[j].begin() + start + length <=
403 row_lengths[j].end(),
476 const std::vector<size_type> &row_indices,
477 const std::vector<size_type> &col_indices)
482 for (
size_type j = 0; j < col_indices.size(); ++j)
490 const std::vector<IndexSet> &partitioning)
494 for (
size_type i = 0; i < partitioning.size(); ++i)
495 for (
size_type j = 0; j < partitioning.size(); ++j)
497 partitioning[j].size(),
515 const std::vector<size_type> &row_block_sizes,
516 const std::vector<size_type> &col_block_sizes)
519 row_block_sizes.size(), col_block_sizes.size());
520 for (
size_type i = 0; i < row_block_sizes.size(); ++i)
521 for (
size_type j = 0; j < col_block_sizes.size(); ++j)
522 this->
block(i, j).
reinit(row_block_sizes[i], col_block_sizes[j]);
532 partitioning.size());
533 for (
size_type i = 0; i < partitioning.size(); ++i)
534 for (
size_type j = 0; j < partitioning.size(); ++j)
536 partitioning[j].size(),
557#ifdef DEAL_II_WITH_TRILINOS
568 const std::vector<size_type> &row_indices,
569 const std::vector<size_type> &col_indices)
574 for (
size_type j = 0; j < col_indices.size(); ++j)
582 const std::vector<IndexSet> ¶llel_partitioning,
585 parallel_partitioning.size())
587 for (
size_type i = 0; i < parallel_partitioning.size(); ++i)
588 for (
size_type j = 0; j < parallel_partitioning.size(); ++j)
590 parallel_partitioning[j],
598 const std::vector<IndexSet> &row_parallel_partitioning,
599 const std::vector<IndexSet> &col_parallel_partitioning,
600 const std::vector<IndexSet> &writable_rows,
603 row_parallel_partitioning.size(),
604 col_parallel_partitioning.size())
606 for (
size_type i = 0; i < row_parallel_partitioning.size(); ++i)
607 for (
size_type j = 0; j < col_parallel_partitioning.size(); ++j)
608 this->
block(i, j).
reinit(row_parallel_partitioning[i],
609 col_parallel_partitioning[j],
619 const std::vector<size_type> &col_block_sizes)
622 row_block_sizes.size(), col_block_sizes.size());
623 for (
size_type i = 0; i < row_block_sizes.size(); ++i)
624 for (
size_type j = 0; j < col_block_sizes.size(); ++j)
625 this->
block(i, j).
reinit(row_block_sizes[i], col_block_sizes[j]);
633 const std::vector<IndexSet> ¶llel_partitioning,
637 parallel_partitioning.size(), parallel_partitioning.size());
638 for (
size_type i = 0; i < parallel_partitioning.size(); ++i)
639 for (
size_type j = 0; j < parallel_partitioning.size(); ++j)
641 parallel_partitioning[j],
650 const std::vector<IndexSet> &row_parallel_partitioning,
651 const std::vector<IndexSet> &col_parallel_partitioning,
655 row_parallel_partitioning.size(), col_parallel_partitioning.size());
656 for (
size_type i = 0; i < row_parallel_partitioning.size(); ++i)
657 for (
size_type j = 0; j < col_parallel_partitioning.size(); ++j)
658 this->
block(i, j).
reinit(row_parallel_partitioning[i],
659 col_parallel_partitioning[j],
668 const std::vector<IndexSet> &row_parallel_partitioning,
669 const std::vector<IndexSet> &col_parallel_partitioning,
670 const std::vector<IndexSet> &writable_rows,
673 AssertDimension(writable_rows.size(), row_parallel_partitioning.size());
675 row_parallel_partitioning.size(), col_parallel_partitioning.size());
676 for (
size_type i = 0; i < row_parallel_partitioning.size(); ++i)
677 for (
size_type j = 0; j < col_parallel_partitioning.size(); ++j)
678 this->
block(i, j).
reinit(row_parallel_partitioning[i],
679 col_parallel_partitioning[j],
691#ifdef DEAL_II_WITH_TRILINOS
size_type block_size(const unsigned int i) const
unsigned int size() const
void reinit(const size_type m, const size_type n, const unsigned int max_per_row)
void copy_from(const size_type n_rows, const size_type n_cols, const ForwardIterator begin, const ForwardIterator end)
virtual void reinit(const size_type m, const size_type n, const ArrayView< const unsigned int > &row_lengths) override
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
void reinit(const std::vector< size_type > &row_block_sizes, const std::vector< size_type > &col_block_sizes)
BlockDynamicSparsityPattern()=default
#define Assert(cond, exc)
void copy_from(const BlockDynamicSparsityPattern &dsp)
#define AssertDimension(dim1, dim2)
Table< 2, SmartPointer< SparsityPatternType, BlockSparsityPatternBase< SparsityPatternType > > > sub_objects
void reinit(const size_type n_block_rows, const size_type n_block_columns)
BlockIndices column_indices
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
BlockSparsityPattern()=default
bool is_compressed() const
static ::ExceptionBase & ExcMessage(std::string arg1)
std::size_t memory_consumption() const
BlockSparsityPatternBase()
size_type n_block_rows() const
void print_gnuplot(std::ostream &out) const
void print(std::ostream &out) const
SparsityPattern & block(const size_type row, const size_type column)
~BlockSparsityPatternBase() override
size_type n_nonzero_elements() const
void reinit(const size_type m, const size_type n, const IndexSet &rowset=IndexSet())
size_type max_entries_per_row() const
size_type n_block_cols() const
BlockSparsityPatternBase & operator=(const BlockSparsityPatternBase &)
void print_svg(std::ostream &out) const
void reinit(const size_type n_block_rows, const size_type n_block_columns)
BlockSparsityPattern()=default
void reinit(const std::vector< size_type > &row_block_sizes, const std::vector< size_type > &col_block_sizes)
types::global_dof_index size_type
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)