]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid missing symbols by constexpr functions 15181/head
authorMartin Kronbichler <martin.kronbichler@uni-a.de>
Fri, 5 May 2023 08:14:08 +0000 (10:14 +0200)
committerMartin Kronbichler <martin.kronbichler@uni-a.de>
Fri, 5 May 2023 08:14:08 +0000 (10:14 +0200)
include/deal.II/base/floating_point_comparator.h
include/deal.II/base/vectorization.h
include/deal.II/lac/tensor_product_matrix.h
include/deal.II/matrix_free/fe_evaluation_data.h
include/deal.II/matrix_free/fe_point_evaluation.h
include/deal.II/non_matching/mapping_info.h

index b4bb6967eaacded3746f48b426b38b3c503656fd..239f0fa4cd95e5282caeb2066d7dece97a2fbd0e 100644 (file)
@@ -46,7 +46,7 @@ struct FloatingPointComparator
   using ScalarNumber =
     typename dealii::internal::VectorizedArrayTrait<Number>::value_type;
   static constexpr std::size_t width =
-    dealii::internal::VectorizedArrayTrait<Number>::width;
+    dealii::internal::VectorizedArrayTrait<Number>::width();
 
   /**
    * An enum to decode whether a particular comparison returns less, larger,
index 7bac5b49cfb03a22123981f62a89bc51d44185bb..7bb1e81ef7bd9db575e682ac5e279abde27bed84 100644 (file)
@@ -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<T>;
 
     /**
-     * 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<T, width_>;
 
     /**
-     * Define a stride which defines how often the template type
+     * Return a stride which defines how often the template type
      * VectorizedArray<T, width_> 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;
     }
index 05bb5f6dd88c8d3dfd747ded0b16c3563547a1e1..47e6a1aa776a0ebe070a4519ec1549b96ead91b2 100644 (file)
@@ -285,7 +285,7 @@ namespace internal
       using VectorizedArrayTrait =
         dealii::internal::VectorizedArrayTrait<Number>;
       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<ScalarNumber>::epsilon()))
index 330be4164cdebefc49613a3cbc3d78f6e70df26f..aad1d02521a9b63a4db5daf99e1826f6525f8d84 100644 (file)
@@ -127,7 +127,7 @@ public:
     typename internal::VectorizedArrayTrait<Number>::value_type;
 
   static constexpr unsigned int n_lanes =
-    internal::VectorizedArrayTrait<Number>::width;
+    internal::VectorizedArrayTrait<Number>::width();
 
   /**
    * Constructor, taking a single ShapeInfo object to inject the capability
index eb7a779d5aa6ac77bfab8c2c58d77f0767082518..d75b8e279d06e6266a88269f10c5dfd310d5b04f 100644 (file)
@@ -984,11 +984,11 @@ public:
 
 private:
   static constexpr std::size_t n_lanes_user_interface =
-    internal::VectorizedArrayTrait<Number>::width;
+    internal::VectorizedArrayTrait<Number>::width();
   static constexpr std::size_t n_lanes_internal =
-    internal::VectorizedArrayTrait<VectorizedArrayType>::width;
+    internal::VectorizedArrayTrait<VectorizedArrayType>::width();
   static constexpr std::size_t stride =
-    internal::VectorizedArrayTrait<Number>::stride;
+    internal::VectorizedArrayTrait<Number>::stride();
 
   /**
    * Common setup function for both constructors. Does the setup for both fast
index e034d4b9b5038d07a91c3fdf9c23729612a0f68d..a66aa710c4957ec3add0dbaa1474ceb9b2ece9a1 100644 (file)
@@ -1056,7 +1056,7 @@ namespace NonMatching
     const unsigned int n_q_points_unvectorized)
   {
     const unsigned int n_lanes =
-      dealii::internal::VectorizedArrayTrait<NumberType>::width;
+      dealii::internal::VectorizedArrayTrait<NumberType>::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<Point<dim>> &points)
   {
     const unsigned int n_lanes =
-      dealii::internal::VectorizedArrayTrait<VectorizedArrayType>::width;
+      dealii::internal::VectorizedArrayTrait<VectorizedArrayType>::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<Number>::width;
+      dealii::internal::VectorizedArrayTrait<Number>::width();
 
     for (unsigned int q = 0; q < n_q_points; ++q)
       {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.