Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/celeritas/neutron/xs/NeutronCaptureMicroXsCalculator.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file celeritas/neutron/xs/NeutronCaptureMicroXsCalculator.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Macros.hh"
0010 #include "corecel/Types.hh"
0011 #include "celeritas/Quantities.hh"
0012 #include "celeritas/Types.hh"
0013 #include "celeritas/grid/NonuniformGridCalculator.hh"
0014 #include "celeritas/neutron/data/NeutronCaptureData.hh"
0015 
0016 namespace celeritas
0017 {
0018 //---------------------------------------------------------------------------//
0019 /*!
0020  * Calculate neutron capture cross sections using per-element grid data from
0021  * NeutronCaptureData.
0022  */
0023 class NeutronCaptureMicroXsCalculator
0024 {
0025   public:
0026     //!@{
0027     //! \name Type aliases
0028     using ParamsRef = NativeCRef<NeutronCaptureData>;
0029     using Energy = units::MevEnergy;
0030     using BarnXs = units::BarnXs;
0031     //!@}
0032 
0033   public:
0034     // Construct with shared and state data
0035     inline CELER_FUNCTION NeutronCaptureMicroXsCalculator(
0036         ParamsRef const& shared, Energy energy);
0037 
0038     // Compute cross section
0039     inline CELER_FUNCTION BarnXs operator()(ElementId el_id) const;
0040 
0041   private:
0042     // Shared cross section data
0043     ParamsRef const& shared_;
0044     // Incident neutron energy
0045     real_type const inc_energy_;
0046 };
0047 
0048 //---------------------------------------------------------------------------//
0049 // INLINE DEFINITIONS
0050 //---------------------------------------------------------------------------//
0051 /*!
0052  * Construct with shared and state data.
0053  */
0054 CELER_FUNCTION NeutronCaptureMicroXsCalculator::NeutronCaptureMicroXsCalculator(
0055     ParamsRef const& shared, Energy energy)
0056     : shared_(shared), inc_energy_(energy.value())
0057 {
0058 }
0059 
0060 //---------------------------------------------------------------------------//
0061 /*!
0062  * Compute microscopic (element) cross section
0063  */
0064 CELER_FUNCTION auto NeutronCaptureMicroXsCalculator::operator()(
0065     ElementId el_id) const -> BarnXs
0066 {
0067     CELER_EXPECT(el_id < shared_.micro_xs.size());
0068 
0069     // Calculate micro cross section at the given energy
0070     NonuniformGridCalculator calc_xs(shared_.micro_xs[el_id], shared_.reals);
0071     real_type result = calc_xs(inc_energy_);
0072 
0073     return BarnXs{result};
0074 }
0075 
0076 //---------------------------------------------------------------------------//
0077 }  // namespace celeritas