]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Test dimension-independence.
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 14 Apr 2015 11:40:12 +0000 (13:40 +0200)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 14 Apr 2015 13:31:49 +0000 (15:31 +0200)
tests/base/symmetric_tensor_27.cc
tests/base/symmetric_tensor_27.output
tests/base/symmetric_tensor_28.cc [new file with mode: 0644]
tests/base/symmetric_tensor_28.output [new file with mode: 0644]

index 728d117b2ecfb6940026a89d3992d7cd2e0d9e10..3166ec233e3f1e30c50a70d5e99079149f2fabc4 100644 (file)
@@ -66,6 +66,7 @@ int main ()
   test<1> ();
   test<2> ();
   test<3> ();
+  test<4> ();
 
   deallog << "OK" << std::endl;
 }
index 48633ff75e3e13b17ea4ec0fea73a7ad186fa20b..b4952173a8fc9ee8f7f03b1af299d6bf89c177bb 100644 (file)
@@ -11,4 +11,8 @@ DEAL::dim=3
 DEAL::425.
 DEAL::381.
 DEAL::381.
+DEAL::dim=4
+DEAL::2.21e+03
+DEAL::2.03e+03
+DEAL::2.03e+03
 DEAL::OK
diff --git a/tests/base/symmetric_tensor_28.cc b/tests/base/symmetric_tensor_28.cc
new file mode 100644 (file)
index 0000000..ef5874f
--- /dev/null
@@ -0,0 +1,61 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2005 - 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 construction, indexing, and conversion of SymmetricTensor<2,dim>
+// from/to Tensor<2,dim> with dim > 3
+
+#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<2,dim> t = s;
+  SymmetricTensor<2,dim> u = t;
+
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=0; j<dim; ++j)
+      deallog << (i+1)*(j+1) << " " << (int)s[i][j] << " "
+              << (int)t[i][j] << " " << (int)u[i][j] << std::endl;
+}
+
+
+
+
+int main ()
+{
+  std::ofstream logfile("output");
+  deallog << std::setprecision(3);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test<3> ();
+  test<5> ();
+
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/base/symmetric_tensor_28.output b/tests/base/symmetric_tensor_28.output
new file mode 100644 (file)
index 0000000..1684eeb
--- /dev/null
@@ -0,0 +1,38 @@
+
+DEAL::dim=3
+DEAL::1 1 1 1
+DEAL::2 2 2 2
+DEAL::3 3 3 3
+DEAL::2 2 2 2
+DEAL::4 4 4 4
+DEAL::6 6 6 6
+DEAL::3 3 3 3
+DEAL::6 6 6 6
+DEAL::9 9 9 9
+DEAL::dim=5
+DEAL::1 1 1 1
+DEAL::2 2 2 2
+DEAL::3 3 3 3
+DEAL::4 4 4 4
+DEAL::5 5 5 5
+DEAL::2 2 2 2
+DEAL::4 4 4 4
+DEAL::6 6 6 6
+DEAL::8 8 8 8
+DEAL::10 10 10 10
+DEAL::3 3 3 3
+DEAL::6 6 6 6
+DEAL::9 9 9 9
+DEAL::12 12 12 12
+DEAL::15 15 15 15
+DEAL::4 4 4 4
+DEAL::8 8 8 8
+DEAL::12 12 12 12
+DEAL::16 16 16 16
+DEAL::20 20 20 20
+DEAL::5 5 5 5
+DEAL::10 10 10 10
+DEAL::15 15 15 15
+DEAL::20 20 20 20
+DEAL::25 25 25 25
+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.