Skip to content

Commit

Permalink
Fix concept requirements (#2513)
Browse files Browse the repository at this point in the history
* Fix warnings from gcc-12

* Use auto
  • Loading branch information
chrisrichardson committed Jan 23, 2023
1 parent 8d55f95 commit 8177090
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
21 changes: 11 additions & 10 deletions cpp/dolfinx/fem/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -601,12 +601,13 @@ void pack(std::span<T> coeffs, std::int32_t cell, int bs, std::span<const T> v,
/// @private
/// @brief Concepts for function that returns cell index
template <typename F>
concept FetchCells = requires(F&& f, std::span<const std::int32_t> v) {
std::invocable<F, std::span<const std::int32_t>>;
{
f(v)
} -> std::convertible_to<std::int32_t>;
};
concept FetchCells
= requires(F&& f, std::span<const std::int32_t> v) {
requires std::invocable<F, std::span<const std::int32_t>>;
{
f(v)
} -> std::convertible_to<std::int32_t>;
};

/// @brief Pack a single coefficient for a set of active entities.
///
Expand Down Expand Up @@ -769,7 +770,7 @@ void pack_coefficients(const Form<T>& form, IntegralType integral_type, int id,
{
case IntegralType::cell:
{
auto fetch_cell = [](auto& entity) { return entity.front(); };
auto fetch_cell = [](auto entity) { return entity.front(); };
const std::vector<std::int32_t>& cells = form.cell_domains(id);

// Iterate over coefficients
Expand All @@ -786,7 +787,7 @@ void pack_coefficients(const Form<T>& form, IntegralType integral_type, int id,
const std::vector<std::int32_t>& facets = form.exterior_facet_domains(id);

// Function to fetch cell index from exterior facet entity
auto fetch_cell = [](auto& entity) { return entity.front(); };
auto fetch_cell = [](auto entity) { return entity.front(); };

// Iterate over coefficients
for (std::size_t coeff = 0; coeff < coefficients.size(); ++coeff)
Expand All @@ -802,8 +803,8 @@ void pack_coefficients(const Form<T>& form, IntegralType integral_type, int id,
const std::vector<std::int32_t>& facets = form.interior_facet_domains(id);

// Functions to fetch cell indices from interior facet entity
auto fetch_cell0 = [](auto& entity) { return entity[0]; };
auto fetch_cell1 = [](auto& entity) { return entity[2]; };
auto fetch_cell0 = [](auto entity) { return entity[0]; };
auto fetch_cell1 = [](auto entity) { return entity[2]; };

// Iterate over coefficients
for (std::size_t coeff = 0; coeff < coefficients.size(); ++coeff)
Expand Down
2 changes: 1 addition & 1 deletion cpp/dolfinx/graph/AdjacencyList.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class AdjacencyList
template <typename U>
requires requires {
typename std::decay_t<U>::value_type;
std::convertible_to<
requires std::convertible_to<
U, std::vector<typename std::decay_t<U>::value_type>>;
}
AdjacencyList<typename std::decay_t<U>::value_type>
Expand Down

0 comments on commit 8177090

Please sign in to comment.