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 "../CherenkovOffload.hh"
0014 #include "../OffloadData.hh"
0015
0016 namespace celeritas
0017 {
0018 namespace detail
0019 {
0020
0021
0022
0023
0024
0025
0026 struct CherenkovOffloadExecutor
0027 {
0028 inline CELER_FUNCTION void
0029 operator()(celeritas::CoreTrackView const& track);
0030
0031 NativeCRef<celeritas::optical::MaterialParamsData> material;
0032 NativeCRef<CherenkovData> cherenkov;
0033 NativeRef<GeneratorStateData> offload;
0034 NativeRef<OffloadStepStateData> steps;
0035 size_type buffer_size;
0036 };
0037
0038
0039
0040
0041
0042
0043
0044 CELER_FUNCTION void
0045 CherenkovOffloadExecutor::operator()(CoreTrackView const& track)
0046 {
0047 CELER_EXPECT(material);
0048 CELER_EXPECT(cherenkov);
0049 CELER_EXPECT(offload);
0050 CELER_EXPECT(steps);
0051
0052 using DistId = ItemId<GeneratorDistributionData>;
0053
0054 auto tsid = track.track_slot_id();
0055 CELER_ASSERT(buffer_size + tsid.get() < offload.distributions.size());
0056 auto& dist = offload.distributions[DistId(buffer_size + tsid.get())];
0057
0058
0059 dist = {};
0060
0061 auto sim = track.sim();
0062 auto const& step = steps.step[tsid];
0063
0064 if (!step || sim.status() == TrackStatus::inactive)
0065 {
0066
0067
0068 return;
0069 }
0070
0071 auto particle = track.particle();
0072
0073
0074 if (particle.charge() != zero_quantity())
0075 {
0076 CherenkovOffload sample_dist(
0077
0078 step,
0079 optical::MaterialView{material, step.material},
0080
0081 particle,
0082 sim,
0083 track.geometry().pos(),
0084 cherenkov);
0085 auto rng = track.rng();
0086 dist = sample_dist(rng);
0087 }
0088 }
0089
0090
0091 }
0092 }