Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:31:24

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2020-2024 UT-Battelle, LLC, and other Celeritas developers.
0003 // See the top-level COPYRIGHT file for details.
0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0005 //---------------------------------------------------------------------------//
0006 //! \file celeritas/grid/XsGridData.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/Types.hh"
0011 #include "corecel/data/Collection.hh"
0012 #include "corecel/grid/UniformGridData.hh"
0013 #include "celeritas/Types.hh"
0014 #include "celeritas/UnitTypes.hh"
0015 
0016 namespace celeritas
0017 {
0018 //---------------------------------------------------------------------------//
0019 /*!
0020  * Parameterization of a discrete scalar field on a given 1D grid.
0021  *
0022  * For all  \code i >= prime_index \endcode, the \code value[i] \endcode is
0023  * expected to be pre-scaled by a factor of \code energy[i] \endcode.
0024  *
0025  * Interpolation is linear-linear after transforming to log-E space and before
0026  * scaling the value by E (if the grid point is above prime_index).
0027  */
0028 struct XsGridData
0029 {
0030     using EnergyUnits = units::Mev;
0031     using XsUnits = units::Native;
0032 
0033     //! "Special" value indicating none of the values are scaled by 1/E
0034     static CELER_CONSTEXPR_FUNCTION size_type no_scaling()
0035     {
0036         return size_type(-1);
0037     }
0038 
0039     UniformGridData log_energy;
0040     size_type prime_index{no_scaling()};
0041     ItemRange<real_type> value;
0042 
0043     //! Whether the interface is initialized and valid
0044     explicit CELER_FUNCTION operator bool() const
0045     {
0046         return log_energy && (value.size() >= 2)
0047                && (prime_index < log_energy.size || prime_index == no_scaling())
0048                && log_energy.size == value.size();
0049     }
0050 };
0051 
0052 //---------------------------------------------------------------------------//
0053 }  // namespace celeritas