File indexing completed on 2025-12-16 10:11:41
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Macros.hh"
0010 #include "corecel/Types.hh"
0011 #include "corecel/math/Algorithms.hh"
0012 #include "corecel/math/Quantity.hh"
0013 #include "celeritas/Quantities.hh"
0014 #include "celeritas/Types.hh"
0015 #include "celeritas/grid/NonuniformGridCalculator.hh"
0016 #include "celeritas/neutron/data/NeutronElasticData.hh"
0017
0018 namespace celeritas
0019 {
0020
0021
0022
0023
0024 class NeutronElasticMicroXsCalculator
0025 {
0026 public:
0027
0028
0029 using ParamsRef = NeutronElasticRef;
0030 using Energy = units::MevEnergy;
0031 using BarnXs = units::BarnXs;
0032
0033
0034 public:
0035
0036 inline CELER_FUNCTION
0037 NeutronElasticMicroXsCalculator(ParamsRef const& shared, Energy energy);
0038
0039
0040 inline CELER_FUNCTION BarnXs operator()(ElementId el_id) const;
0041
0042 private:
0043
0044 NeutronElasticRef const& shared_;
0045
0046 real_type const inc_energy_;
0047 };
0048
0049
0050
0051
0052
0053
0054
0055 CELER_FUNCTION NeutronElasticMicroXsCalculator::NeutronElasticMicroXsCalculator(
0056 ParamsRef const& shared, Energy energy)
0057 : shared_(shared), inc_energy_(energy.value())
0058 {
0059 }
0060
0061
0062
0063
0064
0065 CELER_FUNCTION
0066 auto NeutronElasticMicroXsCalculator::operator()(ElementId el_id) const -> BarnXs
0067 {
0068 CELER_EXPECT(el_id < shared_.micro_xs.size());
0069
0070
0071 NonuniformGridCalculator calc_xs(shared_.micro_xs[el_id], shared_.reals);
0072 real_type result = calc_xs(inc_energy_);
0073
0074 return BarnXs{result};
0075 }
0076
0077
0078 }