File indexing completed on 2025-01-18 09:54:49
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include <algorithm>
0011
0012 #include "corecel/cont/Range.hh"
0013
0014 #include "ActionRegistry.hh"
0015
0016 namespace celeritas
0017 {
0018
0019
0020
0021
0022 template<class P, template<MemSpace M> class S>
0023 ActionGroups<P, S>::ActionGroups(ActionRegistry const& reg)
0024 {
0025
0026 for (auto aidx : range(reg.num_actions()))
0027 {
0028
0029 auto const& base = reg.action(ActionId{aidx});
0030 if (auto step_act = std::dynamic_pointer_cast<StepActionT const>(base))
0031 {
0032
0033 step_actions_.push_back(std::move(step_act));
0034 }
0035 }
0036
0037
0038 for (auto const& base : reg.mutable_actions())
0039 {
0040 if (auto brun = std::dynamic_pointer_cast<BeginRunActionT>(base))
0041 {
0042
0043 begin_run_.emplace_back(std::move(brun));
0044 }
0045 }
0046
0047
0048 std::sort(step_actions_.begin(),
0049 step_actions_.end(),
0050 [](SPConstStepAction const& a, SPConstStepAction const& b) {
0051 return OrderedAction{a->order(), a->action_id()}
0052 < OrderedAction{b->order(), b->action_id()};
0053 });
0054 }
0055
0056
0057 }