]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Added functionality print_gnuplot to BlockSparsityPatternBase
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 26 Feb 2008 17:56:25 +0000 (17:56 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 26 Feb 2008 17:56:25 +0000 (17:56 +0000)
git-svn-id: https://svn.dealii.org/trunk@15794 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/lac/include/lac/block_sparsity_pattern.h
deal.II/lac/source/block_sparsity_pattern.cc

index 59fa1e3806d499c449fe0f781a2928e27db1edd7..e91eb26e0527e56e1e1b68b395dabab5f1af804d 100644 (file)
@@ -215,6 +215,13 @@ an integer id of the current thread.
 
 <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.
index d5ae50f4d95a963fe73c4f719ee0f84870ee723e..2b75d2deb1822e621a1e8bd148352f3df041d03b 100644 (file)
@@ -338,6 +338,17 @@ class BlockSparsityPatternBase : public Subscriptor
                                      */
     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
                                      * @{ */
 
index 17e03f2e6b06100ca8a3008ea6ca07752770eaed..1789835f05cc0f1a8671a4671ad5e16a2633eb36 100644 (file)
@@ -265,6 +265,31 @@ BlockSparsityPatternBase<SparsityPatternBase>::print(std::ostream& out) const
 }
 
 
+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.

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.