]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add another test only for symmetric tensors.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 14 Feb 2015 12:28:56 +0000 (06:28 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 14 Feb 2015 12:53:24 +0000 (06:53 -0600)
tests/base/product_type_04_symmetric.cc [new file with mode: 0644]
tests/base/product_type_04_symmetric.debug.output [new file with mode: 0644]

diff --git a/tests/base/product_type_04_symmetric.cc b/tests/base/product_type_04_symmetric.cc
new file mode 100644 (file)
index 0000000..dca8609
--- /dev/null
@@ -0,0 +1,52 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2015 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+// test that the product between a symmetric tensor and an integer behaves just
+// like that of the tensor and the integer-converted-to-double
+
+#include "../tests.h"
+#include <iomanip>
+#include <iomanip>
+#include <fstream>
+#include <cmath>
+#include <typeinfo>
+#include <complex>
+
+#include <deal.II/base/template_constraints.h>
+#include <deal.II/base/symmetric_tensor.h>
+
+
+
+int main()
+{
+  std::ofstream logfile("output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  {
+    SymmetricTensor<2,2> t;
+    t[0][0] = 1.23456;
+    t[0][1] = 7.87965;
+    t[1][1] = 3.35792;
+    Assert (7*t == 7.0 * t, ExcInternalError());
+    Assert (t*7 == t * 7.0, ExcInternalError());
+    Assert (t*7 == 7*t    , ExcInternalError());
+    Assert ((t*7 - (t+t+t+t+t+t+t)).norm() < 1e-12, ExcInternalError());
+  }
+  
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/base/product_type_04_symmetric.debug.output b/tests/base/product_type_04_symmetric.debug.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK

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.