//
// ---------------------------------------------------------------------
+// test that multiplying a rank-4 (identity) symmetric tensor and
+// a rank-2 symmetric tensor works correctly for VectorizedArray<double>
+
#include "../tests.h"
#include <deal.II/base/symmetric_tensor.h>
#include <deal.II/base/vectorization.h>
+
+// 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 <int dim, typename Number>
+void fill_tensor(dealii::SymmetricTensor<2,dim,dealii::VectorizedArray<Number> > &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<Number>::n_array_elements; v++)
+ {
+ A[i][j][v] = counter;
+ counter += 1.0;
+ }
+}
+
int main()
{
initlog();
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<double>::n_array_elements; v++)
- {
- A[i][j][v] = counter;
- counter += 1.0;
- }
+ fill_tensor(A);
B = I*A;
B -= A;