Skip to content

Commit

Permalink
fixup.
Browse files Browse the repository at this point in the history
  • Loading branch information
knelli2 committed Oct 18, 2023
1 parent dfe9eab commit 25fe7b3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 deletions.
37 changes: 15 additions & 22 deletions src/ParallelAlgorithms/Interpolation/InterpolationTargetDetail.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,6 @@ double get_temporal_id_value(const T& id) {
}

CREATE_IS_CALLABLE(apply)
CREATE_IS_CALLABLE_V(apply)

template <typename Callbacks, typename Box, typename Cache, typename TemporalId>
struct AllSimpleCallbacks;

template <typename... Callbacks, typename Box, typename Cache,
typename TemporalId>
struct AllSimpleCallbacks<tmpl::list<Callbacks...>, Box, Cache, TemporalId>
: public std::integral_constant<
bool, tmpl2::flat_all_v<is_apply_callable_v<Callbacks, Box, Cache,
TemporalId>...>> {};

template <typename T, typename DbTags, typename Metavariables,
typename TemporalId>
Expand All @@ -115,8 +104,10 @@ bool apply_callbacks(
const TemporalId& temporal_id) {
using callbacks = typename T::post_interpolation_callbacks;
constexpr bool all_simple_callbacks =
AllSimpleCallbacks<callbacks, decltype(*box), decltype(*cache),
decltype(temporal_id)>::value;
tmpl::all<callbacks,
is_apply_callable<tmpl::_1, tmpl::pin<decltype(*box)>,
tmpl::pin<decltype(*cache)>,
tmpl::pin<decltype(temporal_id)>>>::value;
if constexpr (all_simple_callbacks) {
tmpl::for_each<callbacks>([&](const auto callback_v) {
using callback = tmpl::type_from<decltype(callback_v)>;
Expand All @@ -138,10 +129,10 @@ CREATE_HAS_STATIC_MEMBER_VARIABLE(fill_invalid_points_with)
CREATE_HAS_STATIC_MEMBER_VARIABLE_V(fill_invalid_points_with)

template <typename T, bool B>
struct with_value;
struct fill_value_or_no_such_type;

template <typename T>
struct with_value<T, false> {
struct fill_value_or_no_such_type<T, false> {
using type = NoSuchType;
};

Expand All @@ -151,22 +142,21 @@ struct DoubleWrapper {
};

template <typename T>
struct with_value<T, true> {
struct fill_value_or_no_such_type<T, true> {
using type = DoubleWrapper<T>;
};

template <typename Callback>
struct get_value {
using type =
typename with_value<Callback,
has_fill_invalid_points_with_v<Callback>>::type;
struct get_fill_value {
using type = typename fill_value_or_no_such_type<
Callback, has_fill_invalid_points_with_v<Callback>>::type;
};

template <typename Callbacks>
struct get_invalid_fill {
using type =
tmpl::find<tmpl::flatten<tmpl::transform<Callbacks, get_value<tmpl::_1>>>,
tt::is_a<DoubleWrapper, tmpl::_1>>;
tmpl::filter<tmpl::transform<Callbacks, get_fill_value<tmpl::_1>>,
tt::is_a<DoubleWrapper, tmpl::_1>>;
};

template <typename InterpolationTargetTag, typename TemporalId, typename DbTags>
Expand Down Expand Up @@ -206,6 +196,9 @@ void fill_invalid_points(const gsl::not_null<db::DataBox<DbTags>*> box,
},
box);
}
} else {
(void)box;
(void)temporal_id;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ constexpr bool if_alias_exists_assert_conforms_to_v =
* every element of that list conforms to the
* intrp::protocols::PostInterpolationCallback protocol. Only one callback
* with the signature with `gsl::not_null` for both the DataBox and
* GlobalCache (see `intrp::protocols::PostInterpolationCallback) is allowed
* GlobalCache (see `intrp::protocols::PostInterpolationCallback`) is allowed
* in this list. Furthermore, if a callback with this signature is in the
* list, it must also be the *only* callback in the list. After the
* interpolation is complete, call this struct's `apply` function.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ struct MockComputeTargetPoints
}
};

// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
size_t num_callback_calls = 0;

struct MockPostInterpolationCallback
Expand Down

0 comments on commit 25fe7b3

Please sign in to comment.