From 9992397fd744410fb2942576caa10b6ecdfb7217 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Fri, 5 May 2023 10:14:08 +0200 Subject: [PATCH] Avoid missing symbols by constexpr functions --- .../deal.II/base/floating_point_comparator.h | 2 +- include/deal.II/base/vectorization.h | 46 +++++++++++++------ include/deal.II/lac/tensor_product_matrix.h | 2 +- .../deal.II/matrix_free/fe_evaluation_data.h | 2 +- .../deal.II/matrix_free/fe_point_evaluation.h | 6 +-- include/deal.II/non_matching/mapping_info.h | 6 +-- 6 files changed, 40 insertions(+), 24 deletions(-) diff --git a/include/deal.II/base/floating_point_comparator.h b/include/deal.II/base/floating_point_comparator.h index b4bb6967ea..239f0fa4cd 100644 --- a/include/deal.II/base/floating_point_comparator.h +++ b/include/deal.II/base/floating_point_comparator.h @@ -46,7 +46,7 @@ struct FloatingPointComparator using ScalarNumber = typename dealii::internal::VectorizedArrayTrait::value_type; static constexpr std::size_t width = - dealii::internal::VectorizedArrayTrait::width; + dealii::internal::VectorizedArrayTrait::width(); /** * An enum to decode whether a particular comparison returns less, larger, diff --git a/include/deal.II/base/vectorization.h b/include/deal.II/base/vectorization.h index 7bac5b49cf..7bb1e81ef7 100644 --- a/include/deal.II/base/vectorization.h +++ b/include/deal.II/base/vectorization.h @@ -5484,9 +5484,13 @@ namespace internal using value_type = T; /** - * Define width of template type. + * Return the width of template type. */ - static constexpr std::size_t width = 1; + static constexpr std::size_t + width() + { + return 1; + } /** * Define vectorized value type for internal vectorization. @@ -5494,12 +5498,16 @@ namespace internal using vectorized_value_type = VectorizedArray; /** - * Define a stride which defines how often the template type T fits into the - * vectorized_value_type. This is useful to write vectorized templated code - * where the internal computation is vectorized and the user interface is - * optionally scalar or also vectorized. + * Return a stride which defines how often the template type T fits into + * the vectorized_value_type. This is useful to write vectorized templated + * code where the internal computation is vectorized and the user + * interface is optionally scalar or also vectorized. */ - static constexpr std::size_t stride = vectorized_value_type::size(); + static constexpr std::size_t + stride() + { + return vectorized_value_type::size(); + } /** * Get a reference to scalar value (on lane 0). @@ -5531,7 +5539,7 @@ namespace internal static value_type & get_from_vectorized(vectorized_value_type &values, unsigned int c) { - AssertIndexRange(c, stride); + AssertIndexRange(c, stride()); return values[c]; } @@ -5543,7 +5551,7 @@ namespace internal static const value_type & get_from_vectorized(const vectorized_value_type &values, unsigned int c) { - AssertIndexRange(c, stride); + AssertIndexRange(c, stride()); return values[c]; } @@ -5558,9 +5566,13 @@ namespace internal using value_type = T; /** - * Define width of template type. + * Return the width of template type. */ - static constexpr std::size_t width = width_; + static constexpr std::size_t + width() + { + return width_; + } /** * Define vectorized value type for internal vectorization. @@ -5568,13 +5580,17 @@ namespace internal using vectorized_value_type = VectorizedArray; /** - * Define a stride which defines how often the template type + * Return a stride which defines how often the template type * VectorizedArray fits into the vectorized value type. This is * useful to write vectorized templated code where the internal computation * is vectorized and the user interface is optionally scalar or also * vectorized. */ - static constexpr std::size_t stride = 1; + static constexpr std::size_t + stride() + { + return 1; + } /** * Get a reference to scalar value on lane c. @@ -5605,7 +5621,7 @@ namespace internal get_from_vectorized(vectorized_value_type &values, unsigned int c) { (void)c; - AssertIndexRange(c, stride); + AssertIndexRange(c, stride()); return values; } @@ -5618,7 +5634,7 @@ namespace internal get_from_vectorized(const vectorized_value_type &values, unsigned int c) { (void)c; - AssertIndexRange(c, stride); + AssertIndexRange(c, stride()); return values; } diff --git a/include/deal.II/lac/tensor_product_matrix.h b/include/deal.II/lac/tensor_product_matrix.h index 05bb5f6dd8..47e6a1aa77 100644 --- a/include/deal.II/lac/tensor_product_matrix.h +++ b/include/deal.II/lac/tensor_product_matrix.h @@ -285,7 +285,7 @@ namespace internal using VectorizedArrayTrait = dealii::internal::VectorizedArrayTrait; using ScalarNumber = typename VectorizedArrayTrait::value_type; - static constexpr std::size_t width = VectorizedArrayTrait::width; + static constexpr std::size_t width = VectorizedArrayTrait::width(); MatrixPairComparator() : eps(std::sqrt(std::numeric_limits::epsilon())) diff --git a/include/deal.II/matrix_free/fe_evaluation_data.h b/include/deal.II/matrix_free/fe_evaluation_data.h index 330be4164c..aad1d02521 100644 --- a/include/deal.II/matrix_free/fe_evaluation_data.h +++ b/include/deal.II/matrix_free/fe_evaluation_data.h @@ -127,7 +127,7 @@ public: typename internal::VectorizedArrayTrait::value_type; static constexpr unsigned int n_lanes = - internal::VectorizedArrayTrait::width; + internal::VectorizedArrayTrait::width(); /** * Constructor, taking a single ShapeInfo object to inject the capability diff --git a/include/deal.II/matrix_free/fe_point_evaluation.h b/include/deal.II/matrix_free/fe_point_evaluation.h index eb7a779d5a..d75b8e279d 100644 --- a/include/deal.II/matrix_free/fe_point_evaluation.h +++ b/include/deal.II/matrix_free/fe_point_evaluation.h @@ -984,11 +984,11 @@ public: private: static constexpr std::size_t n_lanes_user_interface = - internal::VectorizedArrayTrait::width; + internal::VectorizedArrayTrait::width(); static constexpr std::size_t n_lanes_internal = - internal::VectorizedArrayTrait::width; + internal::VectorizedArrayTrait::width(); static constexpr std::size_t stride = - internal::VectorizedArrayTrait::stride; + internal::VectorizedArrayTrait::stride(); /** * Common setup function for both constructors. Does the setup for both fast diff --git a/include/deal.II/non_matching/mapping_info.h b/include/deal.II/non_matching/mapping_info.h index e034d4b9b5..a66aa710c4 100644 --- a/include/deal.II/non_matching/mapping_info.h +++ b/include/deal.II/non_matching/mapping_info.h @@ -1056,7 +1056,7 @@ namespace NonMatching const unsigned int n_q_points_unvectorized) { const unsigned int n_lanes = - dealii::internal::VectorizedArrayTrait::width; + dealii::internal::VectorizedArrayTrait::width(); const unsigned int n_filled_lanes_last_batch = n_q_points_unvectorized % n_lanes; unsigned int n_q_points = n_q_points_unvectorized / n_lanes; @@ -1123,7 +1123,7 @@ namespace NonMatching const std::vector> &points) { const unsigned int n_lanes = - dealii::internal::VectorizedArrayTrait::width; + dealii::internal::VectorizedArrayTrait::width(); for (unsigned int q = 0; q < n_q_points; ++q) { @@ -1148,7 +1148,7 @@ namespace NonMatching const MappingInfo::MappingData &mapping_data) { const unsigned int n_lanes = - dealii::internal::VectorizedArrayTrait::width; + dealii::internal::VectorizedArrayTrait::width(); for (unsigned int q = 0; q < n_q_points; ++q) { -- 2.39.5