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