From 8687f621554d76ffb2ecf9c458ce3bce972057fb Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 28 Mar 2024 10:10:10 -0600 Subject: [PATCH] Fix compilation of a test. --- .../symengine/symengine_tensor_operations_04.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) 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"); -- 2.39.5