Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand committed Sep 11, 2024
1 parent 57dac41 commit f9fe135
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 67 deletions.
78 changes: 30 additions & 48 deletions Core/include/Acts/Propagator/ActorConcepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ namespace Acts {
template <typename actor_t>
concept ActorHasResult = requires { typename actor_t::result_type; };

template <typename actor_t, typename propagator_state_t, typename stepper_t,
typename navigator_t, typename... Args>
concept ActorHasActWithResult =
requires(const actor_t& a, propagator_state_t& state,
const stepper_t& stepper, const navigator_t& navigator,
typename actor_t::result_type& result, Args&&... args) {
{
a.act(state, stepper, navigator, result, std::forward<Args>(args)...)
} -> std::same_as<void>;
};

template <typename actor_t, typename propagator_state_t, typename stepper_t,
typename navigator_t, typename... Args>
concept ActorHasActWithoutResult = requires(
Expand All @@ -40,24 +29,23 @@ concept ActorHasActWithoutResult = requires(

template <typename actor_t, typename propagator_state_t, typename stepper_t,
typename navigator_t, typename... Args>
concept ActorHasAct =
(!ActorHasResult<actor_t> &&
ActorHasActWithoutResult<actor_t, propagator_state_t, stepper_t,
navigator_t, Args...>) ||
(ActorHasResult<actor_t> &&
ActorHasActWithResult<actor_t, propagator_state_t, stepper_t, navigator_t,
Args...>);
concept ActorHasActWithResult =
ActorHasResult<actor_t> &&
requires(const actor_t& a, propagator_state_t& state,
const stepper_t& stepper, const navigator_t& navigator,
typename actor_t::result_type& result, Args&&... args) {
{
a.act(state, stepper, navigator, result, std::forward<Args>(args)...)
} -> std::same_as<void>;
};

template <typename actor_t, typename propagator_state_t, typename stepper_t,
typename navigator_t, typename... Args>
concept ActorHasAbortWithResult = requires(
const actor_t& a, propagator_state_t& state, const stepper_t& stepper,
const navigator_t& navigator, typename actor_t::result_type& result,
Args&&... args) {
{
a.checkAbort(state, stepper, navigator, result, std::forward<Args>(args)...)
} -> std::same_as<bool>;
};
concept ActorHasAct =
ActorHasActWithoutResult<actor_t, propagator_state_t, stepper_t,
navigator_t, Args...> ||
ActorHasActWithResult<actor_t, propagator_state_t, stepper_t, navigator_t,
Args...>;

template <typename actor_t, typename propagator_state_t, typename stepper_t,
typename navigator_t, typename... Args>
Expand All @@ -71,35 +59,29 @@ concept ActorHasAbortWithoutResult = requires(

template <typename actor_t, typename propagator_state_t, typename stepper_t,
typename navigator_t, typename... Args>
concept ActorHasAbort =
(!ActorHasResult<actor_t> &&
ActorHasAbortWithoutResult<actor_t, propagator_state_t, stepper_t,
navigator_t, Args...>) ||
(ActorHasResult<actor_t> &&
ActorHasAbortWithResult<actor_t, propagator_state_t, stepper_t,
navigator_t, Args...>);
concept ActorHasAbortWithResult =
ActorHasResult<actor_t> &&
requires(const actor_t& a, propagator_state_t& state,
const stepper_t& stepper, const navigator_t& navigator,
typename actor_t::result_type& result, Args&&... args) {
{
a.checkAbort(state, stepper, navigator, result,
std::forward<Args>(args)...)
} -> std::same_as<bool>;
};

template <typename actor_t, typename propagator_state_t, typename stepper_t,
typename navigator_t, typename... Args>
concept ActorHasActAndAbort =
(!ActorHasResult<actor_t> &&
ActorHasActWithoutResult<actor_t, propagator_state_t, stepper_t,
navigator_t, Args...> &&
ActorHasAbortWithoutResult<actor_t, propagator_state_t, stepper_t,
navigator_t, Args...>) ||
(ActorHasResult<actor_t> &&
ActorHasActWithResult<actor_t, propagator_state_t, stepper_t, navigator_t,
Args...> &&
ActorHasAbortWithResult<actor_t, propagator_state_t, stepper_t,
navigator_t, Args...>);
concept ActorHasAbort =
ActorHasAbortWithoutResult<actor_t, propagator_state_t, stepper_t,
navigator_t, Args...> ||
ActorHasAbortWithResult<actor_t, propagator_state_t, stepper_t, navigator_t,
Args...>;

template <typename actor_t, typename propagator_state_t, typename stepper_t,
typename navigator_t, typename... Args>
concept Actor =
ActorHasAct<actor_t, propagator_state_t, stepper_t, navigator_t, Args...> ||
ActorHasAbort<actor_t, propagator_state_t, stepper_t, navigator_t,
Args...> ||
ActorHasActAndAbort<actor_t, propagator_state_t, stepper_t, navigator_t,
Args...>;
ActorHasAbort<actor_t, propagator_state_t, stepper_t, navigator_t, Args...>;

} // namespace Acts
20 changes: 5 additions & 15 deletions Core/include/Acts/Propagator/ActorList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,12 @@ namespace Acts {
/// to define a list of different actors_t that are each
/// executed during the stepping procedure
template <typename... actors_t>
requires(
detail::all_of_v<std::is_default_constructible<actors_t>::value...> &&
detail::all_of_v<std::is_copy_constructible<actors_t>::value...> &&
detail::all_of_v<std::is_move_constructible<actors_t>::value...> &&
!detail::has_duplicates_v<actors_t...>)
struct ActorList {
private:
static_assert(
detail::all_of_v<std::is_default_constructible<actors_t>::value...>,
"all actors must be default constructible");
static_assert(
detail::all_of_v<std::is_copy_constructible<actors_t>::value...>,
"all actors must be copy constructible");
static_assert(
detail::all_of_v<std::is_move_constructible<actors_t>::value...>,
"all actors must be move constructible");

static_assert(!detail::has_duplicates_v<actors_t...>,
"same action type specified several times");

public:
/// @cond
// This uses the type collector and unpacks using the `R` meta function
template <template <typename...> class R>
Expand Down
5 changes: 1 addition & 4 deletions Core/include/Acts/TrackFitting/KalmanFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,7 @@ class KalmanFitter {
bool checkAbort(propagator_state_t& /*state*/, const stepper_t& /*stepper*/,
const navigator_t& /*navigator*/, const result_type& result,
const Logger& /*logger*/) const {
if (!result.result.ok() || result.finished) {
return true;
}
return false;
return (!result.result.ok() || result.finished);
}

/// @brief Kalman actor operation: reverse direction
Expand Down

0 comments on commit f9fe135

Please sign in to comment.