File indexing completed on 2025-09-15 08:54:48
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include <vector>
0010
0011 #include "corecel/Macros.hh"
0012 #include "corecel/Types.hh"
0013 #include "corecel/data/Collection.hh"
0014 #include "corecel/data/CollectionAlgorithms.hh"
0015 #include "corecel/data/CollectionBuilder.hh"
0016 #include "celeritas/Quantities.hh"
0017 #include "celeritas/Types.hh"
0018
0019 namespace celeritas
0020 {
0021 namespace optical
0022 {
0023
0024
0025
0026
0027 template<Ownership W, MemSpace M>
0028 struct SimStateData
0029 {
0030
0031
0032 template<class T>
0033 using Items = celeritas::StateCollection<T, W, M>;
0034
0035
0036
0037 Items<real_type> time;
0038 Items<real_type> step_length;
0039 Items<TrackStatus> status;
0040 Items<ActionId> post_step_action;
0041
0042
0043
0044
0045 explicit CELER_FUNCTION operator bool() const
0046 {
0047 return !time.empty() && !step_length.empty() && !status.empty()
0048 && !post_step_action.empty();
0049 }
0050
0051
0052 CELER_FUNCTION size_type size() const { return status.size(); }
0053
0054
0055 template<Ownership W2, MemSpace M2>
0056 SimStateData& operator=(SimStateData<W2, M2>& other)
0057 {
0058 CELER_EXPECT(other);
0059 time = other.time;
0060 step_length = other.step_length;
0061 status = other.status;
0062 post_step_action = other.post_step_action;
0063 return *this;
0064 }
0065 };
0066
0067
0068
0069
0070
0071 template<MemSpace M>
0072 inline void resize(SimStateData<Ownership::value, M>* data, size_type size)
0073 {
0074 CELER_EXPECT(size > 0);
0075
0076 resize(&data->time, size);
0077 resize(&data->step_length, size);
0078
0079 resize(&data->status, size);
0080 fill(TrackStatus::inactive, &data->status);
0081
0082 resize(&data->post_step_action, size);
0083
0084 CELER_ENSURE(*data);
0085 }
0086
0087
0088 }
0089 }