]> https://gitweb.dealii.org/ - dealii.git/commitdiff
allow printing to deallog
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 19 Aug 2009 17:02:26 +0000 (17:02 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 19 Aug 2009 17:02:26 +0000 (17:02 +0000)
git-svn-id: https://svn.dealii.org/trunk@19313 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 277a2137088aa935f244aec3c4c94fa2c1d16ac3..94a1ab8dcc21da85a418e763011424f63ca881b2 100644 (file)
@@ -1889,7 +1889,8 @@ class SparseMatrix : public virtual Subscriptor
                                      * i.e. one nonzero entry of the
                                      * matrix per line.
                                      */
-    void print (std::ostream &out) const;
+    template <class STREAM>
+    void print (STREAM &out) const;
 
                                     /**
                                      * Print the matrix in the usual
@@ -2935,6 +2936,20 @@ SparseMatrix<number>::end (const unsigned int r)
 
 
 
+template <typename number>
+template <class STREAM>
+inline
+void SparseMatrix<number>::print (STREAM &out) const
+{
+  Assert (cols != 0, ExcNotInitialized());
+  Assert (val != 0, ExcNotInitialized());
+
+  for (unsigned int i=0; i<cols->rows; ++i)
+    for (unsigned int j=cols->rowstart[i]; j<cols->rowstart[i+1]; ++j)
+      out << "(" << i << "," << cols->colnums[j] << ") " << val[j] << std::endl;
+}
+
+
 template <typename number>
 inline
 void
index 523d802d2a3bd9028f7536cf6541938104c0ea0f..439aee252fb2097f8b2c1966bf9f75a2d061a66e 100644 (file)
@@ -1724,20 +1724,6 @@ SparseMatrix<number>::get_sparsity_pattern () const
 
 
 
-template <typename number>
-void SparseMatrix<number>::print (std::ostream &out) const
-{
-  Assert (cols != 0, ExcNotInitialized());
-  Assert (val != 0, ExcNotInitialized());
-
-  for (unsigned int i=0; i<cols->rows; ++i)
-    for (unsigned int j=cols->rowstart[i]; j<cols->rowstart[i+1]; ++j)
-      out << "(" << i << "," << cols->colnums[j] << ") " << val[j] << std::endl;
-
-  AssertThrow (out, ExcIO());
-}
-
-
 template <typename number>
 void SparseMatrix<number>::print_formatted (std::ostream &out,
                                            const unsigned int precision,

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.