Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix concept requirements #2513

Merged
merged 4 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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