File indexing completed on 2025-09-17 08:53:41
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/mat/IsotopeView.hh"
0013 #include "celeritas/neutron/data/NeutronElasticData.hh"
0014 #include "celeritas/neutron/interactor/ChipsNeutronElasticInteractor.hh"
0015 #include "celeritas/neutron/xs/NeutronElasticMicroXsCalculator.hh"
0016 #include "celeritas/phys/Interaction.hh"
0017 #include "celeritas/random/ElementSelector.hh"
0018 #include "celeritas/random/IsotopeSelector.hh"
0019
0020 namespace celeritas
0021 {
0022
0023 struct ChipsNeutronElasticExecutor
0024 {
0025 inline CELER_FUNCTION Interaction
0026 operator()(celeritas::CoreTrackView const& track);
0027
0028 NeutronElasticRef params;
0029 };
0030
0031
0032
0033
0034
0035 CELER_FUNCTION Interaction
0036 ChipsNeutronElasticExecutor::operator()(CoreTrackView const& track)
0037 {
0038 auto particle = track.particle();
0039 auto const& dir = track.geometry().dir();
0040 auto rng = track.rng();
0041
0042
0043 auto material = track.material().material_record();
0044 auto elcomp_id = track.physics_step().element();
0045 if (!elcomp_id)
0046 {
0047
0048 ElementSelector select_el(
0049 material,
0050 NeutronElasticMicroXsCalculator{params, particle.energy()},
0051 track.material().element_scratch());
0052 elcomp_id = select_el(rng);
0053 CELER_ASSERT(elcomp_id);
0054 track.physics_step().element(elcomp_id);
0055 }
0056 ElementView element = material.element_record(elcomp_id);
0057
0058
0059 IsotopeSelector iso_select(element);
0060 IsotopeView target = element.isotope_record(iso_select(rng));
0061
0062
0063 ChipsNeutronElasticInteractor interact(params, particle, dir, target);
0064
0065
0066 return interact(rng);
0067 }
0068
0069
0070 }