]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Implement CompressedSetSparsityPattern::print.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 31 Jul 2008 17:46:43 +0000 (17:46 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 31 Jul 2008 17:46:43 +0000 (17:46 +0000)
git-svn-id: https://svn.dealii.org/trunk@16470 0785d39b-7218-0410-832d-ea1e28bc413d

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

index a66dfc5a5b184b44ea93f313b965f592050515b0..e0839a3138f9ee98eb3eed66f7da0c9b64db7c30 100644 (file)
@@ -201,8 +201,9 @@ inconvenience this causes.
 <ol>
   <li>
   <p>
-  Fixed: There is now a function CompressedSparsityPattern::print, in analogy
-  to SparsityPattern::print
+  Fixed: There are now functions CompressedSparsityPattern::print and
+  CompressedSetSparsityPattern::print, in analogy
+  to SparsityPattern::print .
   <br>
   (WB 2008/07/31)
   <li>
index 1d6f79e251f98b138f34ca6501669050381b91cf..82e9491ac377b4a09cdbb59eae9220b6eaf7816b 100644 (file)
@@ -234,6 +234,17 @@ class CompressedSetSparsityPattern : public Subscriptor
                                      */
     void symmetrize ();
     
+                                    /**
+                                     * Print the sparsity of the
+                                     * matrix. The output consists of
+                                     * one line per row of the format
+                                     * <tt>[i,j1,j2,j3,...]</tt>. <i>i</i>
+                                     * is the row number and
+                                     * <i>jn</i> are the allocated
+                                     * columns in this row.
+                                     */
+    void print (std::ostream &out) const;
+
                                     /**
                                      * Print the sparsity of the matrix in a
                                      * format that @p gnuplot understands and
index fd50f31fcae6801bbf21caf0af7412eca0f5cfd1..1a17d19548038add51504896da1b80d8c92bfd8c 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id: compressed_sparsity_pattern.cc 14038 2006-10-23 02:46:34Z bangerth $
 //    Version: $Name$
 //
-//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -165,9 +165,33 @@ CompressedSetSparsityPattern::symmetrize ()
 
 
 
+void
+CompressedSetSparsityPattern::print (std::ostream &out) const
+{ 
+  AssertThrow (out, ExcIO());
+
+  for (unsigned int row=0; row<rows; ++row)
+    {
+      out << '[' << row << ' ';
+      
+      for (std::set<unsigned int>::const_iterator
+             j=lines[row].entries.begin();
+           j != lines[row].entries.end(); ++j)
+        out << *j << ' ';
+
+      out << ']' << std::endl;
+    }
+
+  AssertThrow (out, ExcIO());
+}
+
+
+
 void
 CompressedSetSparsityPattern::print_gnuplot (std::ostream &out) const
 { 
+  AssertThrow (out, ExcIO());
+
   for (unsigned int row=0; row<rows; ++row)
     {
       for (std::set<unsigned int>::const_iterator

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.