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