12#include "detray/definitions/containers.hpp"
13#include "detray/definitions/detail/qualifiers.hpp"
14#include "detray/propagator/base_actor.hpp"
15#include "detray/propagator/composite_actor.hpp"
16#include "detray/utils/logging.hpp"
17#include "detray/utils/tuple.hpp"
18#include "detray/utils/tuple_helpers.hpp"
42 detail::unique_t<detail::tuple_cat_t<detail::state_tuple_t<actors_t>...>>;
46 detail::tuple_cat_t<detail::state_ref_tuple_t<actors_t>...>>;
52 template <
typename actor_states_t,
typename propagator_state_t>
53 DETRAY_HOST_DEVICE
void operator()(actor_states_t &states,
54 propagator_state_t &p_state)
const {
55 DETRAY_VERBOSE_HOST_DEVICE(
"Run actors...");
56 run(states, p_state, std::make_index_sequence<
sizeof...(actors_t)>{});
69 if constexpr (detail::tuple_all_v<std::is_default_constructible,
83 t, std::make_index_sequence<detail::tuple_size_v<state_tuple>>{});
93 typename propagator_state_t>
94 DETRAY_HOST_DEVICE
inline void run(
const actor_t &actr,
95 actor_states_t &states,
96 propagator_state_t &p_state)
const {
97 if constexpr (!
typename actor_t::is_comp_actor()) {
99 if constexpr (std::same_as<
typename actor_t::state,
103 actr(detail::get<typename actor_t::state &>(states), p_state);
106 actr(states, p_state);
114 template <
typename actor_states_t,
typename propagator_state_t,
115 std::size_t... indices>
116 DETRAY_HOST_DEVICE
inline void run(
117 actor_states_t &states, propagator_state_t &p_state,
118 std::index_sequence<indices...> )
const {
119 (run(detail::get<indices>(m_actors), states, p_state), ...);
123 template <std::size_t... indices>
125 state_tuple &t, std::index_sequence<indices...> ) {
130 DETRAY_NO_UNIQUE_ADDRESS
actor_tuple m_actors = {};
150 template <
typename actor_states_t,
typename propagator_state_t>
152 actor_states_t & , propagator_state_t & )
const {
174 DETRAY_NO_UNIQUE_ADDRESS
actor_tuple m_actors = {};
state_tuple state
Empty states replaces a real actor states container.
Definition actor_chain.hpp:145
dtuple<> actor_tuple
Empty tuple representing the actor list.
Definition actor_chain.hpp:138
static consteval state_tuple make_default_actor_states()
Definition actor_chain.hpp:163
dtuple<> state_tuple
Empty tuple representing actor state storage.
Definition actor_chain.hpp:140
constexpr const actor_tuple & actors() const
Definition actor_chain.hpp:157
constexpr void operator()(actor_states_t &, propagator_state_t &) const
Call to actors does nothing.
Definition actor_chain.hpp:151
static constexpr state_ref_tuple setup_actor_states(const state_tuple &)
Definition actor_chain.hpp:168
dtuple<> state_ref_tuple
Empty tuple representing actor state references.
Definition actor_chain.hpp:142
The interface to the actors and aborters in the propagation.
Definition actor_chain.hpp:35
detail::unique_t< detail::tuple_cat_t< detail::state_tuple_t< actors_t >... > > state_tuple
Tuple of actor states (including states of observing actors, if present).
Definition actor_chain.hpp:41
static constexpr state_ref_tuple setup_actor_states(state_tuple &t)
Create references to each actor state in the tuple.
Definition actor_chain.hpp:80
constexpr const actor_tuple & actors() const
Definition actor_chain.hpp:60
static constexpr auto make_default_actor_states()
Definition actor_chain.hpp:66
void operator()(actor_states_t &states, propagator_state_t &p_state) const
Call all actors in the chain.
Definition actor_chain.hpp:53
dtuple< actors_t... > actor_tuple
Types of the actors that are registered in the chain.
Definition actor_chain.hpp:38
detail::unique_t< detail::tuple_cat_t< detail::state_ref_tuple_t< actors_t >... > > state_ref_tuple
Tuple of state references that is used in the propagator.
Definition actor_chain.hpp:45
Concept for a simple actor.
Definition concepts.hpp:25
Detray include(s).
Definition array_operators.hpp:18
constexpr detray::tuple< Ts &... > tie(Ts &...args)
Create a tuple of references to the supplied objects.
Definition tuple.hpp:211
detray::tuple< types... > dtuple
Tuple type used by detray storage and dispatch.
Definition containers.hpp:46
Defines the actors state. Hidden by actor implementations.
Definition base_actor.hpp:25