]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Restore the previous precision and width of the stream after printing a timer summary.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 30 Aug 2011 15:08:52 +0000 (15:08 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 30 Aug 2011 15:08:52 +0000 (15:08 +0000)
git-svn-id: https://svn.dealii.org/trunk@24215 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/source/base/timer.cc

index 13ff612dff84d05c00dd9b1b0d197af998d362c1..2e10cc328d8ed707c9f6f7e6920512af65a117e9 100644 (file)
@@ -281,6 +281,12 @@ and DoF handlers embedded in higher dimensional space have been added.
 <h3>Specific improvements</h3>
 
 <ol>
+<li> Fixed: The TimerOutput::print_summary() function changed the
+precision of output on the stream it prints to, but didn't restore
+the previous value. This is now fixed.
+<br>
+(Wolfgang Bangerth, 2011/08/30)
+
 <li> New: There are now two new functions Utilities::string_to_double.
 <br>
 (Wolfgang Bangerth, 2011/08/25)
index fbc22fa322e58a4d1407d373b83aef9846a93932..1800f5af22a2a8f46e3ddba42d701fe3669b4a71 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2009, 2010 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2009, 2010, 2011 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -410,7 +410,14 @@ TimerOutput::leave_subsection (const std::string &section_name)
 void
 TimerOutput::print_summary () const
 {
-                               // in case we want to write CPU times
+                                  // we are going to change the
+                                  // precision and width of output
+                                  // below. store the old values so we
+                                  // can restore it later on
+  std::streamsize old_precision = out_stream.get_stream().precision ();
+  std::streamsize old_width     = out_stream.get_stream().width ();
+
+                                  // in case we want to write CPU times
   if (output_type != wall_times)
     {
       double total_cpu_time;
@@ -563,6 +570,10 @@ TimerOutput::print_summary () const
                   << "(Timer function may have introduced too much overhead, or different\n"
                   << "section timers may have run at the same time.)" << std::endl;
     }
+
+                                  // restore previous precision and width
+  out_stream.get_stream().precision (old_precision);
+  out_stream.get_stream().width (old_width);
 }
 
 

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.