From: wolf Date: Tue, 29 Mar 2005 21:24:59 +0000 (+0000) Subject: New testcase. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=768fcba12e7bf7d2f52c911822f7dd50d03687ae;p=dealii-svn.git New testcase. git-svn-id: https://svn.dealii.org/trunk@10300 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/base/symmetric_tensor_03.cc b/tests/base/symmetric_tensor_03.cc new file mode 100644 index 0000000000..72d35a9b45 --- /dev/null +++ b/tests/base/symmetric_tensor_03.cc @@ -0,0 +1,55 @@ +//---------------------------- symmetric_tensor_03.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_03.cc --------------------------- + +// test symmetric 2x2x2x2 tensors + +#include "../tests.h" +#include +#include +#include +#include + +int main () +{ + std::ofstream logfile("symmetric_tensor_03.output"); + logfile.precision(3); + deallog.attach(logfile); + deallog.depth_console(0); + + SymmetricTensor<4,2> t; + t[0][0][0][0] = 1; + t[1][1][1][1] = 2; + t[0][1][0][1] = 3; + + Assert (t[0][1][0][1] == t[1][0][1][0], ExcInternalError()); + + // check that if a single element is + // accessed, its transpose element gets the + // same value + t[1][0][0][1] = 4; + Assert (t[0][1][1][0] == 4, ExcInternalError()); + + // make sure transposition doesn't change + // anything + Assert (t == transpose(t), ExcInternalError()); + + // check norm of tensor + deallog << t.norm() << std::endl; + + // make sure norm is induced by scalar + // product + Assert (std::fabs (t.norm()*t.norm() - t*t) < 1e-14, + ExcInternalError()); + + deallog << "OK" << std::endl; +} diff --git a/tests/base/symmetric_tensor_04.cc b/tests/base/symmetric_tensor_04.cc new file mode 100644 index 0000000000..9a6af12cd7 --- /dev/null +++ b/tests/base/symmetric_tensor_04.cc @@ -0,0 +1,55 @@ +//---------------------------- symmetric_tensor_04.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_04.cc --------------------------- + +// test symmetric 3x3x3x3 tensors + +#include "../tests.h" +#include +#include +#include +#include + +int main () +{ + std::ofstream logfile("symmetric_tensor_04.output"); + logfile.precision(3); + deallog.attach(logfile); + deallog.depth_console(0); + + SymmetricTensor<4,3> t; + t[0][0][0][0] = 1; + t[1][1][1][1] = 2; + t[0][1][0][1] = 3; + + Assert (t[0][1][0][1] == t[1][0][1][0], ExcInternalError()); + + // check that if a single element is + // accessed, its transpose element gets the + // same value + t[1][0][0][1] = 4; + Assert (t[0][1][1][0] == 4, ExcInternalError()); + + // make sure transposition doesn't change + // anything + Assert (t == transpose(t), ExcInternalError()); + + // check norm of tensor + deallog << t.norm() << std::endl; + + // make sure norm is induced by scalar + // product + Assert (std::fabs (t.norm()*t.norm() - t*t) < 1e-14, + ExcInternalError()); + + deallog << "OK" << std::endl; +} diff --git a/tests/base/symmetric_tensor_05.cc b/tests/base/symmetric_tensor_05.cc new file mode 100644 index 0000000000..833a07756a --- /dev/null +++ b/tests/base/symmetric_tensor_05.cc @@ -0,0 +1,88 @@ +//---------------------------- symmetric_tensor_05.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_05.cc --------------------------- + +// make sure the tensor t_ijkl=delta_ik delta_jl + delta_il delta_jk +// actually maps a rank-2 tensor onto twice itself + +#include "../tests.h" +#include +#include +#include +#include + + +template +void test () +{ + SymmetricTensor<4,dim> t; + for (unsigned int i=0; i a, b; + a[0][0] = 1; + a[1][1] = 2; + a[0][1] = 3; + + for (unsigned int i=0; i (); + test<3> (); + + deallog << "OK" << std::endl; +} diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_03.output b/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_03.output new file mode 100644 index 0000000000..31688b7481 --- /dev/null +++ b/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_03.output @@ -0,0 +1,3 @@ + +DEAL::8.31 +DEAL::OK diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_04.output b/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_04.output new file mode 100644 index 0000000000..31688b7481 --- /dev/null +++ b/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_04.output @@ -0,0 +1,3 @@ + +DEAL::8.31 +DEAL::OK diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_05.output b/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_05.output new file mode 100644 index 0000000000..1fe5697a07 --- /dev/null +++ b/tests/results/i686-pc-linux-gnu+gcc3.2/base/symmetric_tensor_05.output @@ -0,0 +1,99 @@ + +DEAL::0 0 0 0: 2.00 1.00 +DEAL::0 0 0 1: 0.00 3.00 +DEAL::0 0 1 0: 0.00 3.00 +DEAL::0 0 1 1: 0.00 2.00 +DEAL::0 1 0 0: 0.00 1.00 +DEAL::0 1 0 1: 1.00 3.00 +DEAL::0 1 1 0: 1.00 3.00 +DEAL::0 1 1 1: 0.00 2.00 +DEAL::1 0 0 0: 0.00 1.00 +DEAL::1 0 0 1: 1.00 3.00 +DEAL::1 0 1 0: 1.00 3.00 +DEAL::1 0 1 1: 0.00 2.00 +DEAL::1 1 0 0: 0.00 1.00 +DEAL::1 1 0 1: 0.00 3.00 +DEAL::1 1 1 0: 0.00 3.00 +DEAL::1 1 1 1: 2.00 2.00 +DEAL::0 0 0 0: 2.00 1.00 +DEAL::0 0 0 1: 0.00 3.00 +DEAL::0 0 0 2: 0.00 0.00 +DEAL::0 0 1 0: 0.00 3.00 +DEAL::0 0 1 1: 0.00 2.00 +DEAL::0 0 1 2: 0.00 0.00 +DEAL::0 0 2 0: 0.00 0.00 +DEAL::0 0 2 1: 0.00 0.00 +DEAL::0 0 2 2: 0.00 0.00 +DEAL::0 1 0 0: 0.00 1.00 +DEAL::0 1 0 1: 1.00 3.00 +DEAL::0 1 0 2: 0.00 0.00 +DEAL::0 1 1 0: 1.00 3.00 +DEAL::0 1 1 1: 0.00 2.00 +DEAL::0 1 1 2: 0.00 0.00 +DEAL::0 1 2 0: 0.00 0.00 +DEAL::0 1 2 1: 0.00 0.00 +DEAL::0 1 2 2: 0.00 0.00 +DEAL::0 2 0 0: 0.00 1.00 +DEAL::0 2 0 1: 0.00 3.00 +DEAL::0 2 0 2: 1.00 0.00 +DEAL::0 2 1 0: 0.00 3.00 +DEAL::0 2 1 1: 0.00 2.00 +DEAL::0 2 1 2: 0.00 0.00 +DEAL::0 2 2 0: 1.00 0.00 +DEAL::0 2 2 1: 0.00 0.00 +DEAL::0 2 2 2: 0.00 0.00 +DEAL::1 0 0 0: 0.00 1.00 +DEAL::1 0 0 1: 1.00 3.00 +DEAL::1 0 0 2: 0.00 0.00 +DEAL::1 0 1 0: 1.00 3.00 +DEAL::1 0 1 1: 0.00 2.00 +DEAL::1 0 1 2: 0.00 0.00 +DEAL::1 0 2 0: 0.00 0.00 +DEAL::1 0 2 1: 0.00 0.00 +DEAL::1 0 2 2: 0.00 0.00 +DEAL::1 1 0 0: 0.00 1.00 +DEAL::1 1 0 1: 0.00 3.00 +DEAL::1 1 0 2: 0.00 0.00 +DEAL::1 1 1 0: 0.00 3.00 +DEAL::1 1 1 1: 2.00 2.00 +DEAL::1 1 1 2: 0.00 0.00 +DEAL::1 1 2 0: 0.00 0.00 +DEAL::1 1 2 1: 0.00 0.00 +DEAL::1 1 2 2: 0.00 0.00 +DEAL::1 2 0 0: 0.00 1.00 +DEAL::1 2 0 1: 0.00 3.00 +DEAL::1 2 0 2: 0.00 0.00 +DEAL::1 2 1 0: 0.00 3.00 +DEAL::1 2 1 1: 0.00 2.00 +DEAL::1 2 1 2: 1.00 0.00 +DEAL::1 2 2 0: 0.00 0.00 +DEAL::1 2 2 1: 1.00 0.00 +DEAL::1 2 2 2: 0.00 0.00 +DEAL::2 0 0 0: 0.00 1.00 +DEAL::2 0 0 1: 0.00 3.00 +DEAL::2 0 0 2: 1.00 0.00 +DEAL::2 0 1 0: 0.00 3.00 +DEAL::2 0 1 1: 0.00 2.00 +DEAL::2 0 1 2: 0.00 0.00 +DEAL::2 0 2 0: 1.00 0.00 +DEAL::2 0 2 1: 0.00 0.00 +DEAL::2 0 2 2: 0.00 0.00 +DEAL::2 1 0 0: 0.00 1.00 +DEAL::2 1 0 1: 0.00 3.00 +DEAL::2 1 0 2: 0.00 0.00 +DEAL::2 1 1 0: 0.00 3.00 +DEAL::2 1 1 1: 0.00 2.00 +DEAL::2 1 1 2: 1.00 0.00 +DEAL::2 1 2 0: 0.00 0.00 +DEAL::2 1 2 1: 1.00 0.00 +DEAL::2 1 2 2: 0.00 0.00 +DEAL::2 2 0 0: 0.00 1.00 +DEAL::2 2 0 1: 0.00 3.00 +DEAL::2 2 0 2: 0.00 0.00 +DEAL::2 2 1 0: 0.00 3.00 +DEAL::2 2 1 1: 0.00 2.00 +DEAL::2 2 1 2: 0.00 0.00 +DEAL::2 2 2 0: 0.00 0.00 +DEAL::2 2 2 1: 0.00 0.00 +DEAL::2 2 2 2: 2.00 0.00 +DEAL::OK