]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
restored old functionality of print_formatted after std-merge caused trouble
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 24 Jan 2001 20:50:24 +0000 (20:50 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 24 Jan 2001 20:50:24 +0000 (20:50 +0000)
git-svn-id: https://svn.dealii.org/trunk@3789 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 0ab5ded09e389e8ef30a69ef4088a52dbb861eba..68e6a34693c168b7a2dc32e65ee3c5f650005547 100644 (file)
@@ -1335,7 +1335,7 @@ void
 FullMatrix<number>::print_formatted (std::ostream       &out,
                                     const unsigned int  precision,
                                     const bool          scientific,
-                                    const unsigned int  width,
+                                    unsigned int  width,
                                     const char         *zero_string,
                                     const double        denominator) const
 {
@@ -1344,32 +1344,33 @@ FullMatrix<number>::print_formatted (std::ostream       &out,
                                   // set output format, but store old
                                   // state
   std::ios::fmtflags old_flags = out.flags();
+  unsigned int old_precision = out.precision (precision);
 
-  unsigned int actual_width = width;
   if (scientific)
     {
       out.setf (std::ios::scientific, std::ios::floatfield);
       if (!width)
-       actual_width = precision+7;
+       width = precision+7;
     } else {
       out.setf (std::ios::fixed, std::ios::floatfield);
       if (!width)
-       actual_width = precision+2;
+       width = precision+2;
     }
   
   for (unsigned int i=0; i<m(); ++i) 
     {
       for (unsigned int j=0; j<n(); ++j)
        if (el(i,j) != 0)
-         out << std::setw(actual_width)
+         out << std::setw(width)
              << el(i,j) * denominator << ' ';
        else
-         out << std::setw(actual_width) << zero_string << ' ';
+         out << std::setw(width) << zero_string << ' ';
       out << std::endl;
     };
 
   AssertThrow (out, ExcIO());
                                   // reset output format
+  out.precision(old_precision);
   out.flags (old_flags);
 };
 
index fd2153f3e792d99863babf1ad5e43aa558f55ac3..4d116df7ad440633db65dc9db6b04ab7f9b26b7a 100644 (file)
@@ -1027,7 +1027,9 @@ void SparseMatrix<number>::print_formatted (std::ostream &out,
   Assert (cols != 0, ExcMatrixNotInitialized());
   Assert (val != 0, ExcMatrixNotInitialized());
 
-  out.precision (precision);
+  std::ios::fmtflags old_flags = out.flags();
+  unsigned int old_precision = out.precision (precision);
+
   if (scientific)
     {
       out.setf (std::ios::scientific, std::ios::floatfield);
@@ -1051,9 +1053,9 @@ void SparseMatrix<number>::print_formatted (std::ostream &out,
     };
   AssertThrow (out, ExcIO());
 
-// see above
-
-//  out.setf (0, std::ios::floatfield);                 // reset output format
+                                  // reset output format
+  out.precision(old_precision);
+  out.flags (old_flags);
 };
 
 

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.