<ol>
+<li> New: The functionality print_gnuplot is now also available for sparsity
+patterns derived from the class BlockSparsityPatternBase, e.g. for
+BlockSparsityPattern in the same way as for general sparsity patterns.
+<br>
+(Martin Kronbichler 2008/2/26)
+</li>
+
<li> Fixed: The PETScWrappers::MatrixBase::clear_row and
PETScWrappers::MatrixBase::clear_rows functions had a memory leak that made
PETSc become progressively slower over time. This is now fixed.
*/
void print (std::ostream &out) const;
+ /**
+ * Print the sparsity of the matrix
+ * in a format that <tt>gnuplot</tt> understands
+ * and which can be used to plot the
+ * sparsity pattern in a graphical
+ * way. This is the same functionality
+ * implemented for usual Sparsity
+ * patterns, see @ref SparsityPattern.
+ */
+ void print_gnuplot (std::ostream &out) const;
+
/** @addtogroup Exceptions
* @{ */
}
+template <class SparsityPatternBase>
+void
+BlockSparsityPatternBase<SparsityPatternBase>::print_gnuplot(std::ostream &out) const
+{
+ unsigned int k=0;
+ for (unsigned int ib=0;ib<n_block_rows();++ib)
+ {
+ for (unsigned int i=0;i<block(ib,0).n_rows();++i)
+ {
+ unsigned int l=0;
+ for (unsigned int jb=0;jb<n_block_cols();++jb)
+ {
+ const SparsityPatternBase& b = block(ib,jb);
+ for (unsigned int j=0;j<b.n_cols();++j)
+ if (b.exists(i,j))
+ out << l+j << " " << -static_cast<signed int>(i+k) << std::endl;;
+ l += b.n_cols();
+ }
+ }
+ k += block(ib,0).n_rows();
+ }
+}
+
+
+
// Remark: The following explicit instantiations needed to be moved to
// this place here to work around a problem with gcc3.3 on Apple MacOSX.