Warning, file /include/celeritas/optical/TrackInitData.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Types.hh"
0010 #include "corecel/cont/Range.hh"
0011 #include "corecel/data/Collection.hh"
0012 #include "corecel/data/CollectionAlgorithms.hh"
0013 #include "corecel/data/CollectionBuilder.hh"
0014 #include "corecel/sys/Device.hh"
0015 #include "corecel/sys/ThreadId.hh"
0016 #include "celeritas/Types.hh"
0017 #include "celeritas/track/CoreStateCounters.hh"
0018
0019 #include "TrackInitializer.hh"
0020
0021 namespace celeritas
0022 {
0023 namespace optical
0024 {
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 template<Ownership W, MemSpace M>
0038 struct TrackInitStateData
0039 {
0040
0041
0042 template<class T>
0043 using StateItems = StateCollection<T, W, M>;
0044 template<class T>
0045 using Items = Collection<T, W, M>;
0046
0047
0048
0049 StateItems<TrackSlotId> vacancies;
0050
0051
0052
0053
0054 Items<CoreStateCounters> counters;
0055
0056
0057
0058
0059 explicit CELER_FUNCTION operator bool() const
0060 {
0061 return !vacancies.empty() && !counters.empty();
0062 }
0063
0064
0065 template<Ownership W2, MemSpace M2>
0066 TrackInitStateData& operator=(TrackInitStateData<W2, M2>& other)
0067 {
0068 CELER_EXPECT(other);
0069 vacancies = other.vacancies;
0070 counters = other.counters;
0071 return *this;
0072 }
0073 };
0074
0075
0076
0077
0078
0079
0080
0081
0082 template<MemSpace M>
0083 void resize(TrackInitStateData<Ownership::value, M>* data,
0084 StreamId stream,
0085 size_type size)
0086 {
0087 CELER_EXPECT(size > 0);
0088
0089
0090 resize(&data->vacancies, size);
0091 fill_sequence(&data->vacancies, stream);
0092
0093
0094 resize(&data->counters, 1);
0095 fill(CoreStateCounters{}, &data->counters);
0096
0097 CELER_ENSURE(*data);
0098 }
0099
0100
0101
0102 }
0103 }