]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
also print diagonal element at end of line
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 24 Jun 2013 07:03:16 +0000 (07:03 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 24 Jun 2013 07:03:16 +0000 (07:03 +0000)
git-svn-id: https://svn.dealii.org/trunk@29857 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/sparse_matrix.h

index 9c234289feccca1d6825c50079516433dfa80da6..6ff14dd2498b3876568247a2981927af41824f7f 100644 (file)
@@ -2478,29 +2478,39 @@ void SparseMatrix<number>::print (STREAM &out, bool across, bool diagonal_first)
   number diagonal;
   
   for (size_type i=0; i<cols->rows; ++i)
-    for (size_type j=cols->rowstart[i]; j<cols->rowstart[i+1]; ++j)
-      {
-       if (!diagonal_first && i == cols->colnums[j])
-         {
-           diagonal = val[j];
-           hanging_diagonal = true;
-         }
-       else
-         {
-           if (hanging_diagonal && cols->colnums[j]>i)
-             {
-               if (across)
-                 out << ' ' << i << ',' << i << ':' << diagonal;
-               else
-                 out << '(' << i << ',' << i << ") " << diagonal << std::endl;
-               hanging_diagonal = false;
-             }
-           if (across)
-             out << ' ' << i << ',' << cols->colnums[j] << ':' << val[j];
-           else
-             out << "(" << i << "," << cols->colnums[j] << ") " << val[j] << std::endl;
-         }
-      }
+    {
+      for (size_type j=cols->rowstart[i]; j<cols->rowstart[i+1]; ++j)
+       {
+         if (!diagonal_first && i == cols->colnums[j])
+           {
+             diagonal = val[j];
+             hanging_diagonal = true;
+           }
+         else
+           {
+             if (hanging_diagonal && cols->colnums[j]>i)
+               {
+                 if (across)
+                   out << ' ' << i << ',' << i << ':' << diagonal;
+                 else
+                   out << '(' << i << ',' << i << ") " << diagonal << std::endl;
+                 hanging_diagonal = false;
+               }
+             if (across)
+               out << ' ' << i << ',' << cols->colnums[j] << ':' << val[j];
+             else
+               out << "(" << i << "," << cols->colnums[j] << ") " << val[j] << std::endl;
+           }
+       }
+      if (hanging_diagonal)
+       {
+         if (across)
+           out << ' ' << i << ',' << i << ':' << diagonal;
+         else
+           out << '(' << i << ',' << i << ") " << diagonal << std::endl;
+         hanging_diagonal = false;
+       }
+    }
   if (across)
     out << std::endl;
 }

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.