]> https://gitweb.dealii.org/ - dealii.git/commitdiff
test contract3
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 23 Aug 2012 17:06:17 +0000 (17:06 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 23 Aug 2012 17:06:17 +0000 (17:06 +0000)
git-svn-id: https://svn.dealii.org/trunk@26101 0785d39b-7218-0410-832d-ea1e28bc413d

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

diff --git a/tests/base/tensor_08.cc b/tests/base/tensor_08.cc
new file mode 100644 (file)
index 0000000..32ec919
--- /dev/null
@@ -0,0 +1,58 @@
+//----------------------------------------------------------------------
+//    $Id$
+//
+//    Copyright (C) 2006, 2012 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.
+//
+//----------------------------------------------------------------------
+
+// check contract(Tensor<1,dim>,Tensor<2,dim>,Tensor<1,dim>)
+
+#include "../tests.h"
+#include <deal.II/base/tensor.h>
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/vector.h>
+#include <fstream>
+#include <iomanip>
+
+template <int dim>
+void test_select(double f1, double f2)
+{
+  Tensor<2,dim> t;
+  unsigned int k = 0;
+  for (unsigned int i=0;i<dim;++i)
+    for (unsigned int j=0;j<dim;++j)
+      t[i][j] = ++k;
+  
+  for (unsigned int i=0;i<dim;++i)
+    for (unsigned int j=0;j<dim;++j)
+      {
+       Tensor<1,dim> u, v;
+       u[i] = f1;
+       v[j] = f2;
+       deallog << '\t' << contract3(u,t,v);
+      }
+  deallog << std::endl;
+}
+
+
+int main ()
+{
+  std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output");
+  std::ofstream logfile(logname.c_str());
+  deallog.attach(logfile);  
+  deallog.depth_console(0);
+  deallog << std::setprecision(3);
+
+  test_select<2>(1.,1.);
+  test_select<3>(1.,1.);
+  test_select<4>(1.,1.);
+  
+  test_select<2>(2.,3.);
+  test_select<3>(2.,3.);
+  test_select<4>(2.,3.);
+}
diff --git a/tests/base/tensor_08/cmp/generic b/tests/base/tensor_08/cmp/generic
new file mode 100644 (file)
index 0000000..4b541e0
--- /dev/null
@@ -0,0 +1,7 @@
+
+DEAL:: 1.00    2.00    3.00    4.00
+DEAL:: 1.00    2.00    3.00    4.00    5.00    6.00    7.00    8.00    9.00
+DEAL:: 1.00    2.00    3.00    4.00    5.00    6.00    7.00    8.00    9.00    10.0    11.0    12.0    13.0    14.0    15.0    16.0
+DEAL:: 6.00    12.0    18.0    24.0
+DEAL:: 6.00    12.0    18.0    24.0    30.0    36.0    42.0    48.0    54.0
+DEAL:: 6.00    12.0    18.0    24.0    30.0    36.0    42.0    48.0    54.0    60.0    66.0    72.0    78.0    84.0    90.0    96.0

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.