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