File indexing completed on 2025-10-14 08:48:34
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/data/Collection.hh"
0010 #include "corecel/data/CollectionAlgorithms.hh"
0011 #include "corecel/data/CollectionBuilder.hh"
0012 #include "celeritas/Types.hh"
0013
0014 namespace celeritas
0015 {
0016
0017
0018
0019
0020 template<Ownership W, MemSpace M>
0021 struct StatusCheckParamsData
0022 {
0023
0024
0025 celeritas::Collection<StepActionOrder, W, M, ActionId> orders;
0026
0027 static constexpr StepActionOrder implicit_order = StepActionOrder::size_;
0028
0029
0030
0031
0032 explicit CELER_FUNCTION operator bool() const { return !orders.empty(); }
0033
0034
0035 template<Ownership W2, MemSpace M2>
0036 StatusCheckParamsData& operator=(StatusCheckParamsData<W2, M2> const& other)
0037 {
0038 CELER_EXPECT(other);
0039 orders = other.orders;
0040 return *this;
0041 }
0042 };
0043
0044
0045
0046
0047
0048 template<Ownership W, MemSpace M>
0049 struct StatusCheckStateData
0050 {
0051
0052
0053 template<class T>
0054 using Items = celeritas::StateCollection<T, W, M>;
0055
0056
0057
0058 ActionId action;
0059 StepActionOrder order{StepActionOrder::size_};
0060
0061 Items<TrackStatus> status;
0062 Items<ActionId> post_step_action;
0063 Items<ActionId> along_step_action;
0064
0065
0066
0067
0068 explicit CELER_FUNCTION operator bool() const
0069 {
0070 return !status.empty() && !post_step_action.empty()
0071 && !along_step_action.empty();
0072 }
0073
0074
0075 CELER_FUNCTION TrackSlotId::size_type size() const
0076 {
0077 return status.size();
0078 }
0079
0080
0081 template<Ownership W2, MemSpace M2>
0082 StatusCheckStateData& operator=(StatusCheckStateData<W2, M2>& other)
0083 {
0084 CELER_EXPECT(other);
0085 action = other.action;
0086 order = other.order;
0087 status = other.status;
0088 post_step_action = other.post_step_action;
0089 along_step_action = other.along_step_action;
0090 return *this;
0091 }
0092 };
0093
0094
0095
0096
0097
0098 template<MemSpace M>
0099 void resize(StatusCheckStateData<Ownership::value, M>* data,
0100 HostCRef<StatusCheckParamsData> const&,
0101 StreamId,
0102 size_type size)
0103 {
0104 CELER_EXPECT(size > 0);
0105
0106 resize(&data->status, size);
0107 fill(TrackStatus::inactive, &data->status);
0108 resize(&data->post_step_action, size);
0109 resize(&data->along_step_action, size);
0110
0111 CELER_ENSURE(*data);
0112 }
0113
0114
0115 }