]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New tests.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 28 May 2005 19:04:57 +0000 (19:04 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 28 May 2005 19:04:57 +0000 (19:04 +0000)
git-svn-id: https://svn.dealii.org/trunk@10770 0785d39b-7218-0410-832d-ea1e28bc413d

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

diff --git a/tests/base/symmetric_tensor_10.cc b/tests/base/symmetric_tensor_10.cc
new file mode 100644 (file)
index 0000000..b78187f
--- /dev/null
@@ -0,0 +1,66 @@
+//----------------------------  symmetric_tensor_10.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_10.cc  ---------------------------
+
+// test deviator
+
+#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<2,dim> t;
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=i; j<dim; ++j)
+      t[i][j] = (1.+(i+1)*(j*2));
+
+  SymmetricTensor<2,dim> x = deviator(t);
+
+  deallog << "x=" << std::endl;
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=0; j<dim; ++j)
+      deallog << i << ' ' << j << ' ' << x[i][j] << std::endl;
+
+                                   // the difference between t and x is a
+                                   // diagonal tensor with constant elements
+                                   // proportional to the trace of t
+  t -= x;
+  deallog << "t-x=" << std::endl;
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=0; j<dim; ++j)
+      deallog << i << ' ' << j << ' ' << t[i][j] << std::endl;  
+}
+
+  
+
+
+int main ()
+{
+  std::ofstream logfile("symmetric_tensor_10.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/base/symmetric_tensor_11.cc b/tests/base/symmetric_tensor_11.cc
new file mode 100644 (file)
index 0000000..c04f943
--- /dev/null
@@ -0,0 +1,68 @@
+//----------------------------  symmetric_tensor_11.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_11.cc  ---------------------------
+
+// test deviator_tensor and make sure it yields the same result as calling
+// deviator()
+
+#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<2,dim> t;
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=i; j<dim; ++j)
+      t[i][j] = (1.+(i+1)*(j*2));
+
+  SymmetricTensor<2,dim> x = deviator_tensor<dim>() * t;
+  Assert ((x-deviator(t)).norm() < 1e-15*t.norm(), ExcInternalError());
+
+  deallog << "x=" << std::endl;
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=0; j<dim; ++j)
+      deallog << i << ' ' << j << ' ' << x[i][j] << std::endl;
+
+                                   // the difference between t and x is a
+                                   // diagonal tensor with constant elements
+                                   // proportional to the trace of t
+  t -= x;
+  deallog << "t-x=" << std::endl;
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=0; j<dim; ++j)
+      deallog << i << ' ' << j << ' ' << t[i][j] << std::endl;  
+}
+
+  
+
+
+int main ()
+{
+  std::ofstream logfile("symmetric_tensor_11.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/base/symmetric_tensor_12.cc b/tests/base/symmetric_tensor_12.cc
new file mode 100644 (file)
index 0000000..6b97539
--- /dev/null
@@ -0,0 +1,53 @@
+//----------------------------  symmetric_tensor_12.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_12.cc  ---------------------------
+
+// deviators are trace free by definition
+
+#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<2,dim> t;
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=i; j<dim; ++j)
+      t[i][j] = (1.+(i+1)*(j*2));
+
+  Assert (trace(deviator(t)) < 1e-15*t.norm(),
+          ExcInternalError());
+}
+
+  
+
+
+int main ()
+{
+  std::ofstream logfile("symmetric_tensor_12.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/base/symmetric_tensor_13.cc b/tests/base/symmetric_tensor_13.cc
new file mode 100644 (file)
index 0000000..b5c0b8f
--- /dev/null
@@ -0,0 +1,53 @@
+//----------------------------  symmetric_tensor_13.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_13.cc  ---------------------------
+
+// deviators are trace free by definition
+
+#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<2,dim> t;
+  for (unsigned int i=0; i<dim; ++i)
+    for (unsigned int j=i; j<dim; ++j)
+      t[i][j] = (1.+(i+1)*(j*2));
+
+  Assert (trace(deviator_tensor<dim>()*t) < 1e-15*t.norm(),
+          ExcInternalError());
+}
+
+  
+
+
+int main ()
+{
+  std::ofstream logfile("symmetric_tensor_13.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_10.output b/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_10.output
new file mode 100644 (file)
index 0000000..8ef487a
--- /dev/null
@@ -0,0 +1,39 @@
+
+DEAL::dim=1
+DEAL::x=
+DEAL::0 0 0
+DEAL::t-x=
+DEAL::0 0 1.00
+DEAL::dim=2
+DEAL::x=
+DEAL::0 0 -2.00
+DEAL::0 1 3.00
+DEAL::1 0 3.00
+DEAL::1 1 2.00
+DEAL::t-x=
+DEAL::0 0 3.00
+DEAL::0 1 0
+DEAL::1 0 0
+DEAL::1 1 3.00
+DEAL::dim=3
+DEAL::x=
+DEAL::0 0 -5.33
+DEAL::0 1 3.00
+DEAL::0 2 5.00
+DEAL::1 0 3.00
+DEAL::1 1 -1.33
+DEAL::1 2 9.00
+DEAL::2 0 5.00
+DEAL::2 1 9.00
+DEAL::2 2 6.67
+DEAL::t-x=
+DEAL::0 0 6.33
+DEAL::0 1 0
+DEAL::0 2 0
+DEAL::1 0 0
+DEAL::1 1 6.33
+DEAL::1 2 0
+DEAL::2 0 0
+DEAL::2 1 0
+DEAL::2 2 6.33
+DEAL::OK
diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_11.output b/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_11.output
new file mode 100644 (file)
index 0000000..8ef487a
--- /dev/null
@@ -0,0 +1,39 @@
+
+DEAL::dim=1
+DEAL::x=
+DEAL::0 0 0
+DEAL::t-x=
+DEAL::0 0 1.00
+DEAL::dim=2
+DEAL::x=
+DEAL::0 0 -2.00
+DEAL::0 1 3.00
+DEAL::1 0 3.00
+DEAL::1 1 2.00
+DEAL::t-x=
+DEAL::0 0 3.00
+DEAL::0 1 0
+DEAL::1 0 0
+DEAL::1 1 3.00
+DEAL::dim=3
+DEAL::x=
+DEAL::0 0 -5.33
+DEAL::0 1 3.00
+DEAL::0 2 5.00
+DEAL::1 0 3.00
+DEAL::1 1 -1.33
+DEAL::1 2 9.00
+DEAL::2 0 5.00
+DEAL::2 1 9.00
+DEAL::2 2 6.67
+DEAL::t-x=
+DEAL::0 0 6.33
+DEAL::0 1 0
+DEAL::0 2 0
+DEAL::1 0 0
+DEAL::1 1 6.33
+DEAL::1 2 0
+DEAL::2 0 0
+DEAL::2 1 0
+DEAL::2 2 6.33
+DEAL::OK
diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_12.output b/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_12.output
new file mode 100644 (file)
index 0000000..fe42c7c
--- /dev/null
@@ -0,0 +1,5 @@
+
+DEAL::dim=1
+DEAL::dim=2
+DEAL::dim=3
+DEAL::OK
diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_13.output b/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_13.output
new file mode 100644 (file)
index 0000000..fe42c7c
--- /dev/null
@@ -0,0 +1,5 @@
+
+DEAL::dim=1
+DEAL::dim=2
+DEAL::dim=3
+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.