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