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=refs%2Fpull%2F14293%2Fhead;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