]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New test.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 2 Jun 2005 15:26:07 +0000 (15:26 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 2 Jun 2005 15:26:07 +0000 (15:26 +0000)
git-svn-id: https://svn.dealii.org/trunk@10818 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/symmetric_tensor_18.cc [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_18.output [new file with mode: 0644]

diff --git a/tests/base/symmetric_tensor_18.cc b/tests/base/symmetric_tensor_18.cc
new file mode 100644 (file)
index 0000000..6f405e5
--- /dev/null
@@ -0,0 +1,80 @@
+//----------------------------  symmetric_tensor_18.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2005 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_18.cc  ---------------------------
+
+// compute double contraction between two rank-4 tensors
+
+#include "../tests.h"
+#include <base/symmetric_tensor.h>
+#include <base/logstream.h>
+#include <fstream>
+#include <iostream>
+
+
+template <int dim>
+void test ()
+{
+  deallog << "dim=" << dim << std::endl;
+
+  SymmetricTensor<4,dim> T, A, B;
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=0; j<dim; ++j)
+      for (unsigned int k=0; k<dim; ++k)
+       for (unsigned int l=0; l<dim; ++l)
+         {
+                                            // write some entries
+                                            // into the tensors. may
+                                            // be overwritten by
+                                            // subsequent writes, but
+                                            // who cares?
+           A[i][j][k][l] = (i+1)*(j+1)*(l+1)*(k+1);
+           B[i][j][k][l] = (i+2)*(j+3)*(l+4)*(k+5);
+         }
+  
+  T = A*B;
+
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=0; j<dim; ++j)
+      for (unsigned int k=0; k<dim; ++k)
+       for (unsigned int l=0; l<dim; ++l)
+         {
+           deallog << (int)T[i][j][k][l] << std::endl;
+
+                                            // calculate result by
+                                            // hand
+           double tmp = 0;
+           for (unsigned int a=0; a<dim; ++a)
+             for (unsigned int b=0; b<dim; ++b)
+               tmp += A[i][j][a][b] * B[a][b][k][l];
+
+           Assert (std::fabs(T[i][j][k][l] - tmp) < 1e-14*tmp,
+                   ExcInternalError());
+         }
+}
+
+  
+
+
+int main ()
+{
+  std::ofstream logfile("symmetric_tensor_18.output");
+  logfile.precision(3);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test<1> ();
+  test<2> ();
+  test<3> ();
+  
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_18.output b/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_18.output
new file mode 100644 (file)
index 0000000..77a8b02
--- /dev/null
@@ -0,0 +1,103 @@
+
+DEAL::dim=1
+DEAL::120
+DEAL::dim=2
+DEAL::1800
+DEAL::2160
+DEAL::2160
+DEAL::2700
+DEAL::3600
+DEAL::4320
+DEAL::4320
+DEAL::5400
+DEAL::3600
+DEAL::4320
+DEAL::4320
+DEAL::5400
+DEAL::7200
+DEAL::8640
+DEAL::8640
+DEAL::10800
+DEAL::dim=3
+DEAL::10680
+DEAL::12816
+DEAL::14952
+DEAL::12816
+DEAL::16020
+DEAL::18690
+DEAL::14952
+DEAL::18690
+DEAL::22428
+DEAL::21360
+DEAL::25632
+DEAL::29904
+DEAL::25632
+DEAL::32040
+DEAL::37380
+DEAL::29904
+DEAL::37380
+DEAL::44856
+DEAL::32040
+DEAL::38448
+DEAL::44856
+DEAL::38448
+DEAL::48060
+DEAL::56070
+DEAL::44856
+DEAL::56070
+DEAL::67284
+DEAL::21360
+DEAL::25632
+DEAL::29904
+DEAL::25632
+DEAL::32040
+DEAL::37380
+DEAL::29904
+DEAL::37380
+DEAL::44856
+DEAL::42720
+DEAL::51264
+DEAL::59808
+DEAL::51264
+DEAL::64080
+DEAL::74760
+DEAL::59808
+DEAL::74760
+DEAL::89712
+DEAL::64080
+DEAL::76896
+DEAL::89712
+DEAL::76896
+DEAL::96120
+DEAL::112140
+DEAL::89712
+DEAL::112140
+DEAL::134568
+DEAL::32040
+DEAL::38448
+DEAL::44856
+DEAL::38448
+DEAL::48060
+DEAL::56070
+DEAL::44856
+DEAL::56070
+DEAL::67284
+DEAL::64080
+DEAL::76896
+DEAL::89712
+DEAL::76896
+DEAL::96120
+DEAL::112140
+DEAL::89712
+DEAL::112140
+DEAL::134568
+DEAL::96120
+DEAL::115344
+DEAL::134568
+DEAL::115344
+DEAL::144180
+DEAL::168210
+DEAL::134568
+DEAL::168210
+DEAL::201852
+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.