From: Peter Munch Date: Tue, 20 Sep 2022 17:39:05 +0000 (+0200) Subject: Extend VectorizedArrayTrait X-Git-Tag: v9.5.0-rc1~945^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51d619e37362a58e4e906fae9899a60f72319d68;p=dealii.git Extend VectorizedArrayTrait --- 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