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