]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New test.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 17 Sep 2012 16:05:55 +0000 (16:05 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 17 Sep 2012 16:05:55 +0000 (16:05 +0000)
git-svn-id: https://svn.dealii.org/trunk@26436 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
tests/base/table_handler_12.cc [new file with mode: 0644]
tests/base/table_handler_12/cmp/generic [new file with mode: 0644]

index ae1c0a599beaa81cc896fe225d910aa569854eb3..aeb69157cb86d28511dea0d9b828491b9d027f6e 100644 (file)
@@ -53,7 +53,15 @@ DoFHandler, in particular removal of specializations.
 <h3>Specific improvements</h3>
 
 <ol>
-<li> Fixed: output of super-columns in TableHandler::write_text()
+<li> Fixed: The use of TableHandler::set_precision affected not only the
+precision with which elements of a table were printed, but also the
+precision carried by the output stream after writing the table was
+finished. It thus affected the precision
+with which later output was produced. This is now fixed.
+<br>
+(Timo Heister, 2012/09/16)
+
+<li> Fixed: Output of super-columns in TableHandler::write_text()
 was inconsistent. This is now fixed.
 <br>
 (Timo Heister, 2012/09/16)
diff --git a/tests/base/table_handler_12.cc b/tests/base/table_handler_12.cc
new file mode 100644 (file)
index 0000000..db899a9
--- /dev/null
@@ -0,0 +1,53 @@
+//-----------------------------------------------------------------------------
+//    $Id: table_handler_07.cc -1   $
+//    Version: $Name$
+//
+//    Copyright (C) 2010, 2011, 2012 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//-----------------------------------------------------------------------------
+
+// verify that the flags we set for precision when printing stuff from
+// a table do not affect the precision flags set for the stream to
+// which we print
+
+
+#include "../tests.h"
+#include <deal.II/base/data_out_base.h>
+#include <deal.II/base/table_handler.h>
+#include <deal.II/base/logstream.h>
+
+#include <vector>
+#include <iomanip>
+#include <fstream>
+#include <string>
+
+
+int main ()
+{
+  std::ofstream logfile("table_handler_12/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+                                  // set precision on the output
+                                  // stream to 4 digits
+  logfile << std::setprecision(4);
+
+                                  // but then set precision on the
+                                  // table output to 2
+  TableHandler table;
+  table.add_value("key", 0.123456789);
+  table.set_precision ("key", 2);
+
+                                  // now output the table...
+  table.write_text(logfile);
+                                  // ...and then output some other
+                                  // number, hopefully with 4 digits
+                                  // of precision
+  logfile << 0.123456789 << std::endl;
+}
diff --git a/tests/base/table_handler_12/cmp/generic b/tests/base/table_handler_12/cmp/generic
new file mode 100644 (file)
index 0000000..c6970bb
--- /dev/null
@@ -0,0 +1,4 @@
+
+key  
+0.12 
+0.1235

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.