From: Daniel Arndt Date: Thu, 16 Mar 2017 22:31:06 +0000 (+0100) Subject: Fix symmetric_tensor_39 X-Git-Tag: v8.5.0-rc1~33^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4058%2Fhead;p=dealii.git Fix symmetric_tensor_39 --- diff --git a/tests/base/symmetric_tensor_39.cc b/tests/base/symmetric_tensor_39.cc index 039d8320c5..11aac44ad5 100644 --- a/tests/base/symmetric_tensor_39.cc +++ b/tests/base/symmetric_tensor_39.cc @@ -13,11 +13,30 @@ // // --------------------------------------------------------------------- +// test that multiplying a rank-4 (identity) symmetric tensor and +// a rank-2 symmetric tensor works correctly for VectorizedArray + #include "../tests.h" #include #include + +// Trying to fill the rank-2 ensor in the main function triggers a compiler bug +// in clang-3.7.0 and clang-3.9.1 in release mode. Hence, use a separate function. +template +void fill_tensor(dealii::SymmetricTensor<2,dim,dealii::VectorizedArray > &A) +{ + Number counter = 0.0; + for (unsigned int i = 0; i < dim; ++i) + for (unsigned int j = 0; j < dim; ++j) + for (unsigned int v = 0; v < dealii::VectorizedArray::n_array_elements; v++) + { + A[i][j][v] = counter; + counter += 1.0; + } +} + int main() { initlog(); @@ -35,14 +54,7 @@ int main() for (unsigned int l = 0; l < dim; l++) I[i][j][k][l] = ( (i == k && j== l && i == l && j == k) ? make_vectorized_array(1.0) : ( (i == k && j== l) || (i == l && j == k) ? make_vectorized_array(0.5) : make_vectorized_array(0.0))); - double counter = 0.0; - for (unsigned int i = 0; i < dim; ++i) - for (unsigned int j = 0; j < dim; ++j) - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; v++) - { - A[i][j][v] = counter; - counter += 1.0; - } + fill_tensor(A); B = I*A; B -= A;