File indexing completed on 2025-02-22 10:31:32
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include "corecel/Macros.hh"
0011 #include "corecel/data/Collection.hh"
0012
0013 namespace celeritas
0014 {
0015
0016
0017
0018
0019 template<Ownership W, MemSpace M>
0020 struct ParticleTallyParamsData
0021 {
0022
0023
0024
0025 size_type num_bins{0};
0026
0027 size_type num_particles{0};
0028
0029
0030
0031
0032 explicit CELER_FUNCTION operator bool() const
0033 {
0034 return num_bins > 0 && num_particles > 0;
0035 }
0036
0037
0038 template<Ownership W2, MemSpace M2>
0039 ParticleTallyParamsData&
0040 operator=(ParticleTallyParamsData<W2, M2> const& other)
0041 {
0042 CELER_EXPECT(other);
0043 num_bins = other.num_bins;
0044 num_particles = other.num_particles;
0045 return *this;
0046 }
0047 };
0048
0049
0050
0051
0052
0053
0054
0055 template<Ownership W, MemSpace M>
0056 struct ParticleTallyStateData
0057 {
0058
0059
0060 template<class T>
0061 using Items = Collection<T, W, M>;
0062
0063
0064
0065 Items<size_type> counts;
0066
0067
0068
0069
0070 CELER_FUNCTION size_type size() const { return counts.size(); }
0071
0072
0073 explicit CELER_FUNCTION operator bool() const { return !counts.empty(); }
0074
0075
0076 template<Ownership W2, MemSpace M2>
0077 ParticleTallyStateData& operator=(ParticleTallyStateData<W2, M2>& other)
0078 {
0079 CELER_EXPECT(other);
0080 counts = other.counts;
0081 return *this;
0082 }
0083 };
0084
0085
0086
0087
0088
0089 template<MemSpace M>
0090 void resize(ParticleTallyStateData<Ownership::value, M>* state,
0091 HostCRef<ParticleTallyParamsData> const& params,
0092 StreamId,
0093 size_type);
0094
0095
0096 }