From 48f42b37411e3729c122286bfae11ff562a0686f Mon Sep 17 00:00:00 2001 From: kronbichler Date: Fri, 4 May 2012 18:01:21 +0000 Subject: [PATCH] Fix bug pointed out by Alexander Grayver. git-svn-id: https://svn.dealii.org/trunk@25489 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/base/tensor_base.h | 2 +- tests/base/tensor_06.cc | 49 ++++++++++++++++++++++ tests/base/tensor_06/cmp/generic | 7 ++++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 tests/base/tensor_06.cc create mode 100644 tests/base/tensor_06/cmp/generic diff --git a/deal.II/include/deal.II/base/tensor_base.h b/deal.II/include/deal.II/base/tensor_base.h index 08bc4dbe3f..252fe3546a 100644 --- a/deal.II/include/deal.II/base/tensor_base.h +++ b/deal.II/include/deal.II/base/tensor_base.h @@ -1125,7 +1125,7 @@ Tensor<1,dim,Number>::operator * (const Tensor<1,dim,Number> &p) const values[2] * p.values[2]); break; default: - Number q = values[0] * values[0]; + Number q = values[0] * p.values[0]; for (unsigned int i=1; i::operator*(Tensor<1,dim>) + +#include "../tests.h" +#include +#include +#include +#include + +template +void test_tensor () +{ + Tensor<1,dim> t1, t2; + for (unsigned int i=0; i(); + test_tensor<2>(); + test_tensor<3>(); + test_tensor<4>(); + test_tensor<7>(); + deallog << "OK" << std::endl; +} diff --git a/tests/base/tensor_06/cmp/generic b/tests/base/tensor_06/cmp/generic new file mode 100644 index 0000000000..097a0806b9 --- /dev/null +++ b/tests/base/tensor_06/cmp/generic @@ -0,0 +1,7 @@ + +DEAL::dim = 1: -10.0 +DEAL::dim = 2: -22.0 +DEAL::dim = 3: -28.0 +DEAL::dim = 4: -20.0 +DEAL::dim = 7: 168. +DEAL::OK -- 2.39.5