File indexing completed on 2026-01-07 10:01:47
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include <vector>
0010
0011 #include "corecel/Assert.hh"
0012 #include "corecel/Macros.hh"
0013 #include "corecel/cont/EnumArray.hh"
0014 #include "corecel/data/PinnedAllocator.hh"
0015 #include "celeritas/Quantities.hh"
0016 #include "celeritas/Types.hh"
0017
0018 namespace celeritas
0019 {
0020
0021 template<Ownership W, MemSpace M>
0022 struct StepStateData;
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 struct DetectorStepPointOutput
0034 {
0035
0036
0037 using Energy = units::MevEnergy;
0038 template<class T>
0039 using PinnedVec = std::vector<T, PinnedAllocator<T>>;
0040
0041
0042
0043 PinnedVec<real_type> time;
0044 PinnedVec<Real3> pos;
0045 PinnedVec<Real3> dir;
0046 PinnedVec<Energy> energy;
0047
0048 PinnedVec<VolumeInstanceId> volume_instance_ids;
0049 };
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063 struct DetectorStepOutput
0064 {
0065
0066
0067 using Energy = units::MevEnergy;
0068 template<class T>
0069 using PinnedVec = std::vector<T, PinnedAllocator<T>>;
0070
0071
0072
0073
0074 EnumArray<StepPoint, DetectorStepPointOutput> points;
0075
0076
0077 PinnedVec<DetectorId> detector;
0078 PinnedVec<TrackId> track_id;
0079
0080
0081 PinnedVec<EventId> event_id;
0082 PinnedVec<TrackId> parent_id;
0083 PinnedVec<PrimaryId> primary_id;
0084 PinnedVec<size_type> track_step_count;
0085 PinnedVec<real_type> step_length;
0086 PinnedVec<real_type> weight;
0087 PinnedVec<ParticleId> particle;
0088 PinnedVec<Energy> energy_deposition;
0089
0090
0091 size_type volume_instance_depth{0};
0092
0093
0094
0095
0096 size_type size() const { return detector.size(); }
0097
0098 explicit operator bool() const { return !detector.empty(); }
0099 };
0100
0101
0102
0103 template<MemSpace M>
0104 void copy_steps(DetectorStepOutput* output,
0105 StepStateData<Ownership::reference, M> const& state);
0106
0107 template<>
0108 void copy_steps<MemSpace::host>(
0109 DetectorStepOutput*,
0110 StepStateData<Ownership::reference, MemSpace::host> const&);
0111 template<>
0112 void copy_steps<MemSpace::device>(
0113 DetectorStepOutput*,
0114 StepStateData<Ownership::reference, MemSpace::device> const&);
0115
0116
0117 #if !CELER_USE_DEVICE
0118 template<>
0119 inline void copy_steps<MemSpace::device>(
0120 DetectorStepOutput*,
0121 StepStateData<Ownership::reference, MemSpace::device> const&)
0122 {
0123 CELER_NOT_CONFIGURED("CUDA or HIP");
0124 }
0125
0126 #endif
0127
0128 }