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
0018 #include "TrackInitializer.hh"
0019
0020 namespace celeritas
0021 {
0022 namespace optical
0023 {
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 template<Ownership W, MemSpace M>
0035 struct TrackInitStateData
0036 {
0037
0038
0039 template<class T>
0040 using StateItems = StateCollection<T, W, M>;
0041
0042
0043
0044 StateItems<TrackSlotId> vacancies;
0045
0046
0047
0048
0049 explicit CELER_FUNCTION operator bool() const
0050 {
0051 return !vacancies.empty();
0052 }
0053
0054
0055 template<Ownership W2, MemSpace M2>
0056 TrackInitStateData& operator=(TrackInitStateData<W2, M2>& other)
0057 {
0058 CELER_EXPECT(other);
0059 vacancies = other.vacancies;
0060 return *this;
0061 }
0062 };
0063
0064
0065
0066
0067
0068
0069
0070
0071 template<MemSpace M>
0072 void resize(TrackInitStateData<Ownership::value, M>* data,
0073 StreamId stream,
0074 size_type size)
0075 {
0076 CELER_EXPECT(size > 0);
0077
0078
0079 resize(&data->vacancies, size);
0080 fill_sequence(&data->vacancies, stream);
0081
0082 CELER_ENSURE(*data);
0083 }
0084
0085
0086
0087 }
0088 }