From 8aba92ecd8a6dd07faf20f4c9df48db2d4912fb5 Mon Sep 17 00:00:00 2001 From: peterrum Date: Sat, 27 Jul 2019 07:37:49 +0200 Subject: [PATCH] Add docu and constexpr to VectorizedArrayWidthSpecifier --- include/deal.II/base/numbers.h | 49 +++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/include/deal.II/base/numbers.h b/include/deal.II/base/numbers.h index a2e1b1de74..648a4c8405 100644 --- a/include/deal.II/base/numbers.h +++ b/include/deal.II/base/numbers.h @@ -39,16 +39,48 @@ DEAL_II_NAMESPACE_OPEN namespace internal { + /** + * A helper class specifying the maximal vector length of VectorizedArray + * for a specified data type Number for the given processor architecture and + * optimization level. + * + * The value of the maximal vector length is used as default template + * argument in VectorizedArray, such that VectorizedArray is + * equivalent to VectorizedArray::max_width>. + * + * @note This class is the default implementation for data types for which + * no vectorization is supported. + * + * @tparam Number The underlying data type for which one wants to find out + * the maximal length of hardware supported vectors. + * + * @author Peter Munch, 2019 + */ template struct VectorizedArrayWidthSpecifier { - static const unsigned int max_width = 1; + /** + * Maximal vector length of VectorizedArray for an arbitrary type. + */ + constexpr static unsigned int max_width = 1; }; + /** + * A helper class specifying the maximal vector length of VectorizedArray + * for the data type `double` for the given processor architecture and + * optimization level. For a detailed description of supported maximal vector + * lengths, see the the documentation of VectorizedArray. + * + * @author Peter Munch, 2019 + */ template <> struct VectorizedArrayWidthSpecifier { - static const unsigned int max_width = + /** + * Maximal vector length of VectorizedArray for double. + */ + constexpr static unsigned int max_width = #if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__ALTIVEC__) 2; #elif DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) @@ -62,10 +94,21 @@ namespace internal #endif }; + /** + * A helper class specifying the maximal vector length of VectorizedArray + * for the data type `float` for the given processor architecture and + * optimization level. For a detailed description of supported maximal vector + * lengths, see the the documentation of VectorizedArray. + * + * @author Peter Munch, 2019 + */ template <> struct VectorizedArrayWidthSpecifier { - static const unsigned int max_width = + /** + * Maximal vector length of VectorizedArray for float. + */ + constexpr static unsigned int max_width = #if DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 1 && defined(__ALTIVEC__) 4; #elif DEAL_II_COMPILER_VECTORIZATION_LEVEL >= 3 && defined(__AVX512F__) -- 2.39.5