From: Wolfgang Bangerth Date: Thu, 11 Aug 2016 17:07:21 +0000 (-0500) Subject: Add test. X-Git-Tag: v8.5.0-rc1~768^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39e1d8c597c6ba7081f593f69014d5bcd67388a1;p=dealii.git Add test. --- diff --git a/tests/base/symmetric_tensor_34.cc b/tests/base/symmetric_tensor_34.cc new file mode 100644 index 0000000000..68cce6e72c --- /dev/null +++ b/tests/base/symmetric_tensor_34.cc @@ -0,0 +1,78 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2016 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +// Test that we can convert a SymmetricTensor<4,dim> to a Tensor<4,dim> + +#include "../tests.h" +#include +#include + + +template +void initialize (SymmetricTensor<2,dim> &st) +{ + for (unsigned int i=0; i +void initialize (SymmetricTensor<4,dim> &st) +{ + for (unsigned int i=0; i +void check () +{ + // build a regular tensor + SymmetricTensor st; + initialize (st); + deallog << "st=" << st << std::endl; + + Tensor t (st); // check conversion constructor + deallog << "t =" << t << std::endl; + + t = st; // check assignment operator + deallog << "t =" << t << std::endl; +} + + +int main () +{ + std::ofstream logfile("output"); + deallog << std::setprecision(3); + deallog.attach(logfile); + deallog.threshold_double(1.e-10); + + deallog << "checking rank 2 tensors" << std::endl; + check<2,1>(); + check<2,2>(); + check<2,3>(); + + deallog << "checking rank 4 tensors" << std::endl; + check<4,1>(); + check<4,2>(); + check<4,3>(); + + deallog << "OK" << std::endl; +} diff --git a/tests/base/symmetric_tensor_34.output b/tests/base/symmetric_tensor_34.output new file mode 100644 index 0000000000..f84ec18923 --- /dev/null +++ b/tests/base/symmetric_tensor_34.output @@ -0,0 +1,22 @@ + +DEAL::checking rank 2 tensors +DEAL::st=1.00 +DEAL::t =1.00 +DEAL::t =1.00 +DEAL::st=2.00 3.00 3.00 4.00 +DEAL::t =2.00 3.00 3.00 4.00 +DEAL::t =2.00 3.00 3.00 4.00 +DEAL::st=3.00 4.00 5.00 4.00 6.00 7.00 5.00 7.00 9.00 +DEAL::t =3.00 4.00 5.00 4.00 6.00 7.00 5.00 7.00 9.00 +DEAL::t =3.00 4.00 5.00 4.00 6.00 7.00 5.00 7.00 9.00 +DEAL::checking rank 4 tensors +DEAL::st=2.00 +DEAL::t =2.00 +DEAL::t =2.00 +DEAL::st=4.00 5.00 5.00 6.00 5.00 6.00 6.00 7.00 5.00 6.00 6.00 7.00 6.00 7.00 7.00 8.00 +DEAL::t =4.00 5.00 5.00 6.00 5.00 6.00 6.00 7.00 5.00 6.00 6.00 7.00 6.00 7.00 7.00 8.00 +DEAL::t =4.00 5.00 5.00 6.00 5.00 6.00 6.00 7.00 5.00 6.00 6.00 7.00 6.00 7.00 7.00 8.00 +DEAL::st=6.00 7.00 8.00 7.00 9.00 10.0 8.00 10.0 12.0 7.00 8.00 9.00 8.00 10.0 11.0 9.00 11.0 13.0 8.00 9.00 10.0 9.00 11.0 12.0 10.0 12.0 14.0 7.00 8.00 9.00 8.00 10.0 11.0 9.00 11.0 13.0 9.00 10.0 11.0 10.0 12.0 13.0 11.0 13.0 15.0 10.0 11.0 12.0 11.0 13.0 14.0 12.0 14.0 16.0 8.00 9.00 10.0 9.00 11.0 12.0 10.0 12.0 14.0 10.0 11.0 12.0 11.0 13.0 14.0 12.0 14.0 16.0 12.0 13.0 14.0 13.0 15.0 16.0 14.0 16.0 18.0 +DEAL::t =6.00 7.00 8.00 7.00 9.00 10.0 8.00 10.0 12.0 7.00 8.00 9.00 8.00 10.0 11.0 9.00 11.0 13.0 8.00 9.00 10.0 9.00 11.0 12.0 10.0 12.0 14.0 7.00 8.00 9.00 8.00 10.0 11.0 9.00 11.0 13.0 9.00 10.0 11.0 10.0 12.0 13.0 11.0 13.0 15.0 10.0 11.0 12.0 11.0 13.0 14.0 12.0 14.0 16.0 8.00 9.00 10.0 9.00 11.0 12.0 10.0 12.0 14.0 10.0 11.0 12.0 11.0 13.0 14.0 12.0 14.0 16.0 12.0 13.0 14.0 13.0 15.0 16.0 14.0 16.0 18.0 +DEAL::t =6.00 7.00 8.00 7.00 9.00 10.0 8.00 10.0 12.0 7.00 8.00 9.00 8.00 10.0 11.0 9.00 11.0 13.0 8.00 9.00 10.0 9.00 11.0 12.0 10.0 12.0 14.0 7.00 8.00 9.00 8.00 10.0 11.0 9.00 11.0 13.0 9.00 10.0 11.0 10.0 12.0 13.0 11.0 13.0 15.0 10.0 11.0 12.0 11.0 13.0 14.0 12.0 14.0 16.0 8.00 9.00 10.0 9.00 11.0 12.0 10.0 12.0 14.0 10.0 11.0 12.0 11.0 13.0 14.0 12.0 14.0 16.0 12.0 13.0 14.0 13.0 15.0 16.0 14.0 16.0 18.0 +DEAL::OK