]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add test. 2414/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 25 Mar 2016 20:28:54 +0000 (15:28 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 26 Mar 2016 01:14:33 +0000 (20:14 -0500)
tests/base/symmetric_tensor_29.cc [new file with mode: 0644]
tests/base/symmetric_tensor_29.output [new file with mode: 0644]

diff --git a/tests/base/symmetric_tensor_29.cc b/tests/base/symmetric_tensor_29.cc
new file mode 100644 (file)
index 0000000..0367a06
--- /dev/null
@@ -0,0 +1,60 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2016 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 Tensor<1,dim> * SymmetricTensor<2,dim>
+
+#include "../tests.h"
+#include <deal.II/base/symmetric_tensor.h>
+#include <deal.II/base/logstream.h>
+#include <fstream>
+#include <iomanip>
+
+
+template <int dim>
+void test ()
+{
+  deallog << "dim=" << dim << std::endl;
+
+  SymmetricTensor<2,dim> s;
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=i; j<dim; ++j)
+      s[i][j] = (i+1) * (j+1);
+
+  Tensor<1,dim> t;
+  for (unsigned int i=0; i<dim; ++i)
+    t[i] = (i==0 ? 1 : 2);
+
+  deallog << s *t << std::endl
+          << t *s << std::endl;
+
+  Assert (s*t == t*s, ExcInternalError());
+}
+
+
+
+
+int main ()
+{
+  std::ofstream logfile("output");
+  deallog << std::setprecision(3);
+  deallog.attach(logfile);
+  deallog.threshold_double(1.e-10);
+
+  test<3> ();
+  test<5> ();
+
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/base/symmetric_tensor_29.output b/tests/base/symmetric_tensor_29.output
new file mode 100644 (file)
index 0000000..662f34a
--- /dev/null
@@ -0,0 +1,8 @@
+
+DEAL::dim=3
+DEAL::11.0 22.0 33.0
+DEAL::11.0 22.0 33.0
+DEAL::dim=5
+DEAL::29.0 58.0 87.0 116. 145.
+DEAL::29.0 58.0 87.0 116. 145.
+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.