From: Wolfgang Bangerth Date: Sat, 14 Feb 2015 12:28:56 +0000 (-0600) Subject: Add another test only for symmetric tensors. X-Git-Tag: v8.3.0-rc1~461^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d2c5492b552a2fb7961f9638543accdbf2d2111;p=dealii.git Add another test only for symmetric tensors. --- diff --git a/tests/base/product_type_04_symmetric.cc b/tests/base/product_type_04_symmetric.cc new file mode 100644 index 0000000000..dca8609d4b --- /dev/null +++ b/tests/base/product_type_04_symmetric.cc @@ -0,0 +1,52 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2015 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 the product between a symmetric tensor and an integer behaves just +// like that of the tensor and the integer-converted-to-double + +#include "../tests.h" +#include +#include +#include +#include +#include +#include + +#include +#include + + + +int main() +{ + std::ofstream logfile("output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + { + SymmetricTensor<2,2> t; + t[0][0] = 1.23456; + t[0][1] = 7.87965; + t[1][1] = 3.35792; + Assert (7*t == 7.0 * t, ExcInternalError()); + Assert (t*7 == t * 7.0, ExcInternalError()); + Assert (t*7 == 7*t , ExcInternalError()); + Assert ((t*7 - (t+t+t+t+t+t+t)).norm() < 1e-12, ExcInternalError()); + } + + deallog << "OK" << std::endl; +} diff --git a/tests/base/product_type_04_symmetric.debug.output b/tests/base/product_type_04_symmetric.debug.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/base/product_type_04_symmetric.debug.output @@ -0,0 +1,2 @@ + +DEAL::OK