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