]> https://gitweb.dealii.org/ - dealii.git/commitdiff
new print function
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Tue, 10 Feb 2004 12:34:20 +0000 (12:34 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Tue, 10 Feb 2004 12:34:20 +0000 (12:34 +0000)
git-svn-id: https://svn.dealii.org/trunk@8452 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/sparsity_pattern.h
deal.II/lac/source/sparsity_pattern.cc

index a70c8bc0f0e4b197ed5406fa9c2db739116cd32a..4f41ba1d91db6aa95d5c902444c5ce0cb4e50926 100644 (file)
@@ -780,9 +780,11 @@ class SparsityPattern : public Subscriptor
                                     /**
                                      * Print the sparsity of the
                                      * matrix. The output consists of
-                                     * terms <tt>[i,j]</tt> for each
-                                     * allocated entry. No linefeeds
-                                     * are added.
+                                     * one line per row of the format
+                                     * <tt>[i,j1,j2,j3,...]</tt>. <i>i</i>
+                                     * is the row number and
+                                     * <i>jn</n> are the allocated
+                                     * columns in this row.
                                      */
     void print (std::ostream &out) const;
 
index aa3aa9007f11dc092a1dc4a03271fd51dbbcbdcd..f99b09d698cc23b4faf942905d034a55416e9294 100644 (file)
@@ -758,7 +758,14 @@ void
 SparsityPattern::print (std::ostream &out) const
 {
   Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject());  
-  const_iterator e = begin();
+  for (unsigned int i=0; i<rows; ++i)
+    {
+      out << '[' << i;
+      for (unsigned int j=rowstart[i]; j<rowstart[i+1]; ++j)
+       if (colnums[j] != invalid_entry)
+         out << ',' << colnums[j];
+      out << ']' << std::endl;
+    }
   
   AssertThrow (out, ExcIO());
 }

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.