From: 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-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4042f726abb5ce28bf50053c8997d591f28b8d0f;p=dealii-svn.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); }