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