From 309cfdd48bb9f009b8656e071ced468580933046 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sat, 28 May 2005 19:04:57 +0000 Subject: [PATCH] New tests. git-svn-id: https://svn.dealii.org/trunk@10770 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/symmetric_tensor_10.cc | 66 ++++++++++++++++++++++++++++++ tests/base/symmetric_tensor_11.cc | 68 +++++++++++++++++++++++++++++++ tests/base/symmetric_tensor_12.cc | 53 ++++++++++++++++++++++++ tests/base/symmetric_tensor_13.cc | 53 ++++++++++++++++++++++++ 4 files changed, 240 insertions(+) create mode 100644 tests/base/symmetric_tensor_10.cc create mode 100644 tests/base/symmetric_tensor_11.cc create mode 100644 tests/base/symmetric_tensor_12.cc create mode 100644 tests/base/symmetric_tensor_13.cc diff --git a/tests/base/symmetric_tensor_10.cc b/tests/base/symmetric_tensor_10.cc new file mode 100644 index 0000000000..b78187fb82 --- /dev/null +++ b/tests/base/symmetric_tensor_10.cc @@ -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 +#include +#include +#include + + +template +void test () +{ + deallog << "dim=" << dim << std::endl; + + SymmetricTensor<2,dim> t; + for (unsigned int i=0; i x = deviator(t); + + deallog << "x=" << std::endl; + for (unsigned int i=0; i (); + 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 index 0000000000..c04f9432f0 --- /dev/null +++ b/tests/base/symmetric_tensor_11.cc @@ -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 +#include +#include +#include + + +template +void test () +{ + deallog << "dim=" << dim << std::endl; + + SymmetricTensor<2,dim> t; + for (unsigned int i=0; i x = deviator_tensor() * t; + Assert ((x-deviator(t)).norm() < 1e-15*t.norm(), ExcInternalError()); + + deallog << "x=" << std::endl; + for (unsigned int i=0; i (); + 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 index 0000000000..6b97539b4f --- /dev/null +++ b/tests/base/symmetric_tensor_12.cc @@ -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 +#include +#include +#include + + +template +void test () +{ + deallog << "dim=" << dim << std::endl; + + SymmetricTensor<2,dim> t; + for (unsigned int i=0; i (); + 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 index 0000000000..b5c0b8ffc3 --- /dev/null +++ b/tests/base/symmetric_tensor_13.cc @@ -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 +#include +#include +#include + + +template +void test () +{ + deallog << "dim=" << dim << std::endl; + + SymmetricTensor<2,dim> t; + for (unsigned int i=0; i()*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; +} -- 2.39.5