File indexing completed on 2026-01-10 10:05:47
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Macros.hh"
0010 #include "corecel/Types.hh"
0011 #include "celeritas/global/CoreTrackView.hh"
0012
0013 #include "../OffloadData.hh"
0014 #include "../ScintillationOffload.hh"
0015
0016 namespace celeritas
0017 {
0018 namespace detail
0019 {
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 struct ScintOffloadExecutor
0031 {
0032 inline CELER_FUNCTION void
0033 operator()(celeritas::CoreTrackView const& track);
0034
0035 NativeCRef<celeritas::optical::MaterialParamsData> const material;
0036 NativeCRef<ScintillationData> const scint;
0037 NativeRef<GeneratorStateData> const offload;
0038 NativeRef<OffloadStepStateData> const steps;
0039 size_type buffer_size;
0040 };
0041
0042
0043
0044
0045
0046
0047
0048 CELER_FUNCTION void ScintOffloadExecutor::operator()(CoreTrackView const& track)
0049 {
0050 CELER_EXPECT(scint);
0051 CELER_EXPECT(offload);
0052 CELER_EXPECT(steps);
0053
0054 using DistId = ItemId<GeneratorDistributionData>;
0055
0056 auto tsid = track.track_slot_id();
0057 CELER_ASSERT(buffer_size + tsid.get() < offload.distributions.size());
0058 auto& dist = offload.distributions[DistId(buffer_size + tsid.get())];
0059
0060
0061 dist = {};
0062
0063 auto sim = track.sim();
0064 auto const& step = steps.step[tsid];
0065
0066 if (!step || sim.status() == TrackStatus::inactive)
0067 {
0068
0069
0070 return;
0071 }
0072
0073 Real3 const& pos = track.geometry().pos();
0074 auto edep = track.physics_step().energy_deposition();
0075 auto particle = track.particle();
0076 auto rng = track.rng();
0077
0078
0079 dist = ScintillationOffload(particle, sim, pos, edep, scint, step)(rng);
0080 }
0081
0082
0083 }
0084 }