]> https://gitweb.dealii.org/ - dealii.git/commitdiff
make output work with deallog
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 3 Mar 2005 21:49:29 +0000 (21:49 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 3 Mar 2005 21:49:29 +0000 (21:49 +0000)
git-svn-id: https://svn.dealii.org/trunk@9987 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/block_matrix_array.h

index cc82d90c41ffb3bf844b187065d8a052061c1e73..e2abdd0b6b4d61c78d53c4aec47d9667bf560207 100644 (file)
@@ -160,7 +160,8 @@ class BlockMatrixArray : public Subscriptor
                                      * times, it will be listed with
                                      * the same number everytime.
                                      */
-    void print_latex (std::ostream& out) const;
+    template <class STREAM>
+    void print_latex (STREAM& out) const;
     
   protected:
                                     /**
@@ -518,9 +519,10 @@ BlockMatrixArray<MATRIX>::n_block_cols () const
 
 
 template <class MATRIX>
+template <class STREAM>
 inline
 void
-BlockMatrixArray<MATRIX>::print_latex (std::ostream& out) const
+BlockMatrixArray<MATRIX>::print_latex (STREAM& out) const
 {
   out << "\\begin{array}{"
       << std::string(n_block_cols(), 'c')
@@ -547,23 +549,24 @@ BlockMatrixArray<MATRIX>::print_latex (std::ostream& out) const
 #else
           std::ostrstream stream;
 #endif
-
+         
          stream << matrix_number++;
-
+         
 #ifndef HAVE_STD_STRINGSTREAM
           stream << std::ends;
 #endif
          x.first->second += stream.str();
        }
-
+      
 #ifdef HAVE_STD_STRINGSTREAM
-          std::ostringstream stream;
+      std::ostringstream stream;
 #else
-          std::ostrstream stream;
+      std::ostrstream stream;
 #endif
-
+      if (array(m->row, m->col) != "" && m->prefix >= 0)
+       stream << "+";
       if (m->prefix != 1.)
-       stream << " " << m->prefix << 'x';
+       stream << m->prefix << 'x';
       stream << matrix_names.find(m->matrix)->second;
 //      stream << '(' << m->matrix << ')';
       if (m->transpose)
@@ -572,15 +575,17 @@ BlockMatrixArray<MATRIX>::print_latex (std::ostream& out) const
 #ifndef HAVE_STD_STRINGSTREAM
       stream << std::ends;
 #endif
-      
       array(m->row, m->col) += stream.str();
     }
   for (unsigned int i=0;i<n_block_rows();++i)
     for (unsigned int j=0;j<n_block_cols();++j)
-      out << array(i,j) << '\t'
-          << ((j==n_block_cols()-1)
-              ? "\\\\\n"
-              : "&\t");
+      {
+       out << '\t' << array(i,j);
+       if (j==n_block_cols()-1)
+         out << "\\\\" << std::endl;
+       else
+         out << " &";
+      }
   out << "\\end{array}" << 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.