--- /dev/null
+//---------------------------- 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;
+}
--- /dev/null
+//---------------------------- 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;
+}
--- /dev/null
+//---------------------------- 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;
+}
--- /dev/null
+//---------------------------- 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;
+}
--- /dev/null
+
+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
--- /dev/null
+
+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
--- /dev/null
+
+DEAL::dim=1
+DEAL::dim=2
+DEAL::dim=3
+DEAL::OK
--- /dev/null
+
+DEAL::dim=1
+DEAL::dim=2
+DEAL::dim=3
+DEAL::OK