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