File indexing completed on 2025-09-17 08:53:42
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Assert.hh"
0010 #include "corecel/Macros.hh"
0011 #include "corecel/random/engine/RngEngine.hh"
0012 #include "celeritas/optical/CoreTrackView.hh"
0013 #include "celeritas/optical/PhysicsData.hh"
0014 #include "celeritas/optical/PhysicsStepUtils.hh"
0015 #include "celeritas/optical/PhysicsTrackView.hh"
0016 #include "celeritas/optical/SimTrackView.hh"
0017
0018 namespace celeritas
0019 {
0020 namespace optical
0021 {
0022
0023 struct DiscreteSelectExecutor
0024 {
0025 inline CELER_FUNCTION void operator()(CoreTrackView const& track);
0026 };
0027
0028
0029
0030
0031
0032 CELER_FUNCTION void
0033 DiscreteSelectExecutor::operator()(CoreTrackView const& track)
0034 {
0035 CELER_EXPECT(track.sim().status() == TrackStatus::alive);
0036 CELER_EXPECT(track.sim().post_step_action()
0037 == track.physics().discrete_action());
0038
0039
0040
0041 auto phys = track.physics();
0042 phys.reset_interaction_mfp();
0043
0044
0045 auto particle = track.particle();
0046 auto rng = track.rng();
0047 auto action = select_discrete_interaction(particle, phys, rng);
0048 CELER_ASSERT(action);
0049
0050
0051 auto sim = track.sim();
0052 sim.post_step_action(action);
0053
0054 CELER_ENSURE(!phys.has_interaction_mfp());
0055 }
0056
0057
0058 }
0059 }