From: Wolfgang Bangerth Date: Tue, 30 Aug 2011 15:08:52 +0000 (+0000) Subject: Restore the previous precision and width of the stream after printing a timer summary. X-Git-Tag: v8.0.0~3553 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7bdf2a2e31e99e882c5ed0026afc377ee9b5c734;p=dealii.git Restore the previous precision and width of the stream after printing a timer summary. git-svn-id: https://svn.dealii.org/trunk@24215 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 13ff612dff..2e10cc328d 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -281,6 +281,12 @@ and DoF handlers embedded in higher dimensional space have been added.

Specific improvements

    +
  1. 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. +
    +(Wolfgang Bangerth, 2011/08/30) +
  2. New: There are now two new functions Utilities::string_to_double.
    (Wolfgang Bangerth, 2011/08/25) diff --git a/deal.II/source/base/timer.cc b/deal.II/source/base/timer.cc index fbc22fa322..1800f5af22 100644 --- a/deal.II/source/base/timer.cc +++ b/deal.II/source/base/timer.cc @@ -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 §ion_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); }