From: Wolfgang Bangerth Date: Fri, 25 Sep 2020 22:00:45 +0000 (-0600) Subject: Implement BlockSparsityPattern::print_svg(). X-Git-Tag: v9.3.0-rc1~1051^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3cf35baf5702c47ca2339168a31005a4eb30edee;p=dealii.git Implement BlockSparsityPattern::print_svg(). --- diff --git a/include/deal.II/lac/block_sparsity_pattern.h b/include/deal.II/lac/block_sparsity_pattern.h index 2654968448..c0460d904f 100644 --- a/include/deal.II/lac/block_sparsity_pattern.h +++ b/include/deal.II/lac/block_sparsity_pattern.h @@ -307,6 +307,14 @@ public: void print_gnuplot(std::ostream &out) const; + /** + * Print the sparsity of the matrix in svg format. This is the same + * functionality implemented for usual sparsity patterns, see + * @ref SparsityPattern. + */ + void + print_svg(std::ostream &out) const; + /** * @addtogroup Exceptions * @{ diff --git a/source/lac/block_sparsity_pattern.cc b/source/lac/block_sparsity_pattern.cc index 1cc0392e53..b4237527b4 100644 --- a/source/lac/block_sparsity_pattern.cc +++ b/source/lac/block_sparsity_pattern.cc @@ -303,6 +303,7 @@ BlockSparsityPatternBase::print(std::ostream &out) const #endif + template void BlockSparsityPatternBase::print_gnuplot( @@ -330,6 +331,47 @@ BlockSparsityPatternBase::print_gnuplot( +template +void +BlockSparsityPatternBase::print_svg( + std::ostream &out) const +{ + const unsigned int m = this->n_rows(); + const unsigned int n = this->n_cols(); + out + << "\n" + "\n\n" + " \n" + " \n\n"; + + for (unsigned int block_i = 0; block_i < n_block_rows(); ++block_i) + for (unsigned int block_j = 0; block_j < n_block_rows(); ++block_j) + for (const auto &entry : block(block_i, block_j)) + { + out << " \n"; + } + + out << "" << std::endl; +} + + + BlockSparsityPattern::BlockSparsityPattern(const size_type n_rows, const size_type n_columns) : BlockSparsityPatternBase(n_rows, n_columns) @@ -443,6 +485,7 @@ BlockDynamicSparsityPattern::BlockDynamicSparsityPattern( } + BlockDynamicSparsityPattern::BlockDynamicSparsityPattern( const std::vector &partitioning) : BlockSparsityPatternBase(partitioning.size(), @@ -457,6 +500,7 @@ BlockDynamicSparsityPattern::BlockDynamicSparsityPattern( } + BlockDynamicSparsityPattern::BlockDynamicSparsityPattern( const BlockIndices &row_indices, const BlockIndices &col_indices) @@ -465,6 +509,7 @@ BlockDynamicSparsityPattern::BlockDynamicSparsityPattern( } + void BlockDynamicSparsityPattern::reinit( const std::vector &row_block_sizes, @@ -478,6 +523,8 @@ BlockDynamicSparsityPattern::reinit( this->collect_sizes(); } + + void BlockDynamicSparsityPattern::reinit(const std::vector &partitioning) { @@ -491,6 +538,8 @@ BlockDynamicSparsityPattern::reinit(const std::vector &partitioning) this->collect_sizes(); } + + void BlockDynamicSparsityPattern::reinit(const BlockIndices &row_indices, const BlockIndices &col_indices)