From 51d619e37362a58e4e906fae9899a60f72319d68 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Tue, 20 Sep 2022 19:39:05 +0200 Subject: [PATCH] Extend VectorizedArrayTrait --- include/deal.II/base/vectorization.h | 44 +++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/include/deal.II/base/vectorization.h b/include/deal.II/base/vectorization.h index 9f58637911..6c9c43575f 100644 --- a/include/deal.II/base/vectorization.h +++ b/include/deal.II/base/vectorization.h @@ -5359,13 +5359,49 @@ namespace internal template struct VectorizedArrayTrait { - using value_type = T; + using value_type = T; + static constexpr std::size_t width = 1; + + static T & + get(T &value, unsigned int c) + { + AssertDimension(c, 0); + (void)c; + + return value; + } + + static const T & + get(const T &value, unsigned int c) + { + AssertDimension(c, 0); + (void)c; + + return value; + } }; - template - struct VectorizedArrayTrait> + template + struct VectorizedArrayTrait> { - using value_type = T; + using value_type = T; + static constexpr std::size_t width = width_; + + static T & + get(VectorizedArray &values, unsigned int c) + { + AssertIndexRange(c, width_); + + return values[c]; + } + + static const T & + get(const VectorizedArray &values, unsigned int c) + { + AssertIndexRange(c, width_); + + return values[c]; + } }; } // namespace internal -- 2.39.5