File indexing completed on 2025-02-22 10:31:28
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include "corecel/Assert.hh"
0011 #include "corecel/Macros.hh"
0012 #include "celeritas/Types.hh"
0013 #include "celeritas/global/CoreTrackView.hh"
0014 #include "celeritas/mat/MaterialTrackView.hh"
0015 #include "celeritas/random/RngEngine.hh"
0016 #include "celeritas/track/SimTrackView.hh"
0017
0018 #include "../PhysicsData.hh"
0019 #include "../PhysicsStepUtils.hh"
0020 #include "../PhysicsTrackView.hh"
0021
0022 namespace celeritas
0023 {
0024 namespace detail
0025 {
0026
0027 struct DiscreteSelectExecutor
0028 {
0029 inline CELER_FUNCTION void
0030 operator()(celeritas::CoreTrackView const& track);
0031 };
0032
0033
0034
0035
0036
0037 CELER_FUNCTION void
0038 DiscreteSelectExecutor::operator()(celeritas::CoreTrackView const& track)
0039 {
0040 CELER_EXPECT(track.make_sim_view().status() == TrackStatus::alive);
0041 CELER_EXPECT(track.make_sim_view().post_step_action()
0042 == track.make_physics_view().scalars().discrete_action());
0043
0044
0045 auto phys = track.make_physics_view();
0046 phys.reset_interaction_mfp();
0047
0048 auto particle = track.make_particle_view();
0049 {
0050
0051 auto mat = track.make_material_view().make_material_view();
0052 auto rng = track.make_rng_engine();
0053 auto step = track.make_physics_step_view();
0054 auto action
0055 = select_discrete_interaction(mat, particle, phys, step, rng);
0056 CELER_ASSERT(action);
0057
0058 auto sim = track.make_sim_view();
0059 sim.post_step_action(action);
0060 }
0061
0062 CELER_ENSURE(!phys.has_interaction_mfp());
0063 }
0064
0065
0066 }
0067 }