]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a file with common definitions to be used by all testcases.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 4 Feb 2004 16:30:49 +0000 (16:30 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 4 Feb 2004 16:30:49 +0000 (16:30 +0000)
git-svn-id: https://svn.dealii.org/trunk@8395 0785d39b-7218-0410-832d-ea1e28bc413d

tests/tests.h [new file with mode: 0644]

diff --git a/tests/tests.h b/tests/tests.h
new file mode 100644 (file)
index 0000000..cb00080
--- /dev/null
@@ -0,0 +1,44 @@
+//----------------------------  tests.h  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2004 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.
+//
+//----------------------------  tests.h  ---------------------------
+
+
+// common definitions used in all the tests
+
+
+#include <base/logstream.h>
+#include <cmath>
+
+// overload floating point output operators for LogStream so that small
+// numbers below a certain threshold are simply printed as zeros. this removes
+// a number of possible places where output may differ depending on platform,
+// compiler options, etc, simply because round-off is different.
+LogStream & operator << (LogStream &logstream,
+                         const double d)
+{
+  if (std::fabs (d) < 1e-10)
+    logstream << 0.;
+  else
+    logstream << d;
+  return logstream;
+}
+
+
+LogStream & operator << (LogStream &logstream,
+                         const float d)
+{
+  if (std::fabs (d) < 1e-8)
+    logstream << 0.;
+  else
+    logstream << d;
+  return logstream;
+}

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.