]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Test the new operator*(SymmetricTensor,Tensor) introduced in r23580.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 22 Apr 2011 13:54:29 +0000 (13:54 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 22 Apr 2011 13:54:29 +0000 (13:54 +0000)
git-svn-id: https://svn.dealii.org/trunk@23622 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/symmetric_tensor_26.cc [new file with mode: 0644]
tests/base/symmetric_tensor_26/cmp/generic [new file with mode: 0644]

diff --git a/tests/base/symmetric_tensor_26.cc b/tests/base/symmetric_tensor_26.cc
new file mode 100644 (file)
index 0000000..03262fb
--- /dev/null
@@ -0,0 +1,54 @@
+//----------------------------  symmetric_tensor_26.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2006, 2008, 2009, 2011 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.
+//
+//----------------------------  symmetric_tensor_26.cc  ---------------------------
+
+// test multiplication with a Tensor<1,dim>
+
+#include "../tests.h"
+#include <base/symmetric_tensor.h>
+#include <base/logstream.h>
+#include <lac/vector.h>
+#include <fstream>
+#include <iomanip>
+
+
+template <int dim>
+void check ()
+{
+  SymmetricTensor<2,dim> S;
+  for (unsigned int i=0; i<S.n_independent_components; ++i)
+    S[S.unrolled_to_component_indices (i)] = std::rand () % 10;
+
+  Tensor<1,dim> x;
+  for (unsigned int i=0; i<dim; ++i)
+    x[i] = std::rand() % 10;
+  
+  deallog << "S = " << S << std::endl;
+  deallog << "x = " << x << std::endl;
+  deallog << "S*x = " << S*x << std::endl;
+}
+
+
+int main ()
+{
+  std::ofstream logfile("symmetric_tensor_26/output");
+  deallog << std::setprecision(3);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  check<1> ();
+  check<2> ();
+  check<3> ();
+  
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/base/symmetric_tensor_26/cmp/generic b/tests/base/symmetric_tensor_26/cmp/generic
new file mode 100644 (file)
index 0000000..e78a805
--- /dev/null
@@ -0,0 +1,11 @@
+
+DEAL::S = 3.00
+DEAL::x = 6.00
+DEAL::S*x = 18.0
+DEAL::S = 7.00 3.00 3.00 5.00
+DEAL::x = 5.00 6.00
+DEAL::S*x = 53.0 45.0
+DEAL::S = 2.00 2.00 7.00 2.00 9.00 0.00 7.00 0.00 1.00
+DEAL::x = 9.00 3.00 6.00
+DEAL::S*x = 66.0 45.0 69.0
+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.