Skip to content

Commit

Permalink
Merge pull request #15181 from kronbichler/fix_missing_symbol
Browse files Browse the repository at this point in the history
Avoid missing symbols and use constexpr functions instead
  • Loading branch information
bangerth committed May 5, 2023
2 parents 50de7c1 + 9992397 commit a091f25
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 24 deletions.
2 changes: 1 addition & 1 deletion include/deal.II/base/floating_point_comparator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
46 changes: 31 additions & 15 deletions include/deal.II/base/vectorization.h
Original file line number Diff line number Diff line change
Expand Up @@ -5484,22 +5484,30 @@ 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.
*/
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).
Expand Down Expand Up @@ -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];
}
Expand All @@ -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];
}
Expand All @@ -5558,23 +5566,31 @@ 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.
*/
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.
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion include/deal.II/lac/tensor_product_matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down
2 changes: 1 addition & 1 deletion include/deal.II/matrix_free/fe_evaluation_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class FEEvaluationData
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
Expand Down
6 changes: 3 additions & 3 deletions include/deal.II/matrix_free/fe_point_evaluation.h
Original file line number Diff line number Diff line change
Expand Up @@ -984,11 +984,11 @@ class FEPointEvaluation

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
Expand Down
6 changes: 3 additions & 3 deletions include/deal.II/non_matching/mapping_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down

0 comments on commit a091f25

Please sign in to comment.