File indexing completed on 2025-02-22 10:31:25
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include "corecel/Assert.hh"
0011 #include "celeritas/global/CoreTrackView.hh"
0012 #include "celeritas/mat/ElementSelector.hh"
0013 #include "celeritas/mat/ElementView.hh"
0014 #include "celeritas/neutron/data/NeutronInelasticData.hh"
0015 #include "celeritas/neutron/interactor/NeutronInelasticInteractor.hh"
0016 #include "celeritas/neutron/xs/NeutronInelasticMicroXsCalculator.hh"
0017 #include "celeritas/phys/Interaction.hh"
0018
0019 namespace celeritas
0020 {
0021
0022 struct NeutronInelasticExecutor
0023 {
0024 inline CELER_FUNCTION Interaction
0025 operator()(celeritas::CoreTrackView const& track);
0026
0027 NeutronInelasticRef params;
0028 };
0029
0030
0031
0032
0033
0034 CELER_FUNCTION Interaction
0035 NeutronInelasticExecutor::operator()(CoreTrackView const& track)
0036 {
0037 auto particle = track.make_particle_view();
0038 auto rng = track.make_rng_engine();
0039
0040
0041 auto material = track.make_material_view().make_material_view();
0042 auto elcomp_id = track.make_physics_step_view().element();
0043 if (!elcomp_id)
0044 {
0045
0046 ElementSelector select_el(
0047 material,
0048 NeutronInelasticMicroXsCalculator{params, particle.energy()},
0049 track.make_material_view().element_scratch());
0050 elcomp_id = select_el(rng);
0051 CELER_ASSERT(elcomp_id);
0052 track.make_physics_step_view().element(elcomp_id);
0053 }
0054
0055
0056 NeutronInelasticInteractor interact(params, particle);
0057
0058
0059 return interact(rng);
0060 }
0061
0062
0063 }