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