From: Wolfgang Bangerth Date: Thu, 28 Mar 2024 16:10:10 +0000 (-0600) Subject: Fix compilation of a test. X-Git-Tag: v9.6.0-rc1~440^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8687f621554d76ffb2ecf9c458ce3bce972057fb;p=dealii.git Fix compilation of a test. --- diff --git a/tests/symengine/symengine_tensor_operations_04.cc b/tests/symengine/symengine_tensor_operations_04.cc index 747f168592..f0bc1703d9 100644 --- a/tests/symengine/symengine_tensor_operations_04.cc +++ b/tests/symengine/symengine_tensor_operations_04.cc @@ -102,11 +102,20 @@ test_tensor() using Tensor_SD_number_t = Tensor; using Tensor_t = Tensor; + // Fill two tensors with ones and twos, respectively. Tensor_t t_a, t_b; - for (auto it = t_a.begin_raw(); it != t_a.end_raw(); ++it) - *it = 1.0; - for (auto it = t_b.begin_raw(); it != t_b.end_raw(); ++it) - *it = 2.0; + if constexpr (rank > 0) + { + for (unsigned int i = 0; i < Tensor_t::n_independent_components; ++i) + t_a[Tensor_t::unrolled_to_component_indices(i)] = 1.0; + for (unsigned int i = 0; i < Tensor_t::n_independent_components; ++i) + t_b[Tensor_t::unrolled_to_component_indices(i)] = 2.0; + } + else + { + t_a = 1.0; + t_b = 2.0; + } const Tensor_SD_number_t symb_t_a = SD::make_tensor_of_symbols("a");