File indexing completed on 2025-02-22 10:31:22
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include "corecel/sys/ActionInterface.hh"
0011 #include "celeritas/Types.hh"
0012
0013 namespace celeritas
0014 {
0015
0016 class CoreParams;
0017 template<MemSpace M>
0018 class CoreState;
0019
0020
0021
0022
0023
0024 using CoreBeginRunActionInterface
0025 = BeginRunActionInterface<CoreParams, CoreState>;
0026
0027
0028 using CoreStepActionInterface = StepActionInterface<CoreParams, CoreState>;
0029
0030
0031 using ActionOrder [[deprecated]] = StepActionOrder;
0032
0033
0034 class [[deprecated]] ExplicitCoreActionInterface
0035 : public CoreStepActionInterface
0036 {
0037
0038 void step(CoreParams const& params, CoreStateHost& state) const final
0039 {
0040 return this->execute(params, state);
0041 }
0042
0043
0044 void step(CoreParams const& params, CoreStateDevice& state) const final
0045 {
0046 return this->execute(params, state);
0047 }
0048
0049
0050 virtual void execute(CoreParams const&, CoreStateHost&) const = 0;
0051
0052
0053 virtual void execute(CoreParams const&, CoreStateDevice&) const = 0;
0054 };
0055
0056
0057
0058
0059
0060
0061
0062 inline constexpr bool
0063 is_action_sorted(StepActionOrder aorder, TrackOrder torder)
0064 {
0065
0066 return (aorder == StepActionOrder::post
0067 && torder == TrackOrder::reindex_step_limit_action)
0068 || (aorder == StepActionOrder::along
0069 && torder == TrackOrder::reindex_along_step_action)
0070 || (torder == TrackOrder::reindex_both_action
0071 && (aorder == StepActionOrder::post
0072 || aorder == StepActionOrder::along));
0073 }
0074
0075
0076
0077
0078
0079 inline constexpr bool is_action_sorted(TrackOrder torder)
0080 {
0081 auto to_int = [](TrackOrder v) {
0082 return static_cast<std::underlying_type_t<TrackOrder>>(v);
0083 };
0084 return to_int(torder) >= to_int(TrackOrder::begin_reindex_)
0085 && to_int(torder) < to_int(TrackOrder::end_reindex_);
0086 }
0087
0088
0089 }