From 9f8de1ae777bc4e72330959533dec579dbc6e7ae Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 29 Mar 2005 22:16:59 +0000 Subject: [PATCH] More tests. git-svn-id: https://svn.dealii.org/trunk@10306 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/symmetric_tensor_07.cc | 182 ++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100644 tests/base/symmetric_tensor_07.cc diff --git a/tests/base/symmetric_tensor_07.cc b/tests/base/symmetric_tensor_07.cc new file mode 100644 index 0000000000..80d555a63d --- /dev/null +++ b/tests/base/symmetric_tensor_07.cc @@ -0,0 +1,182 @@ +//---------------------------- symmetric_tensor_07.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_07.cc --------------------------- + +// in symmetric_tensor_06 we have established that contracting with a +// symmetric tensor by hand works as with a full tensor that is stored +// in non-symmetric form. here make sure that we can abbreviate the contraction + +#include "../tests.h" +#include +#include +#include +#include +#include + + +SymmetricTensor<2,1> +operator * (const SymmetricTensor<4,1> &t, + const SymmetricTensor<2,1> &s) +{ + const unsigned int dim = 1; + SymmetricTensor<2,dim> tmp; + tmp[0][0] = t[0][0][0][0] * s[0][0]; + return tmp; +} + + + +SymmetricTensor<2,1> +operator * (const SymmetricTensor<2,1> &s, + const SymmetricTensor<4,1> &t) +{ + const unsigned int dim = 1; + SymmetricTensor<2,dim> tmp; + tmp[0][0] = t[0][0][0][0] * s[0][0]; + return tmp; +} + + + +SymmetricTensor<2,2> +operator * (const SymmetricTensor<4,2> &t, + const SymmetricTensor<2,2> &s) +{ + const unsigned int dim = 2; + SymmetricTensor<2,dim> tmp; + + for (unsigned int i=0; i +operator * (const SymmetricTensor<2,2> &s, + const SymmetricTensor<4,2> &t) +{ + const unsigned int dim = 2; + SymmetricTensor<2,dim> tmp; + + for (unsigned int i=0; i +operator * (const SymmetricTensor<4,3> &t, + const SymmetricTensor<2,3> &s) +{ + const unsigned int dim = 3; + SymmetricTensor<2,dim> tmp; + + for (unsigned int i=0; i +operator * (const SymmetricTensor<2,3> &s, + const SymmetricTensor<4,3> &t) +{ + const unsigned int dim = 3; + SymmetricTensor<2,dim> tmp; + + for (unsigned int i=0; i +void test () +{ + const double lambda = 5, + mu = 7; + SymmetricTensor<4,dim> ts; + Tensor<4,dim> ta; + for (unsigned int i=0; i as, bs; + Tensor<2,dim> aa, ba; + + for (unsigned int i=0; i 0, ExcInternalError()); +} + + + + +int main () +{ + std::ofstream logfile("symmetric_tensor_07.output"); + logfile.precision(3); + deallog.attach(logfile); + deallog.depth_console(0); + + test<2> (); + test<3> (); + + deallog << "OK" << std::endl; +} -- 2.39.5