Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-14 10:22:21

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/data/NeutronCaptureData.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Macros.hh"
0010 #include "corecel/Types.hh"
0011 #include "corecel/data/Collection.hh"
0012 #include "corecel/grid/NonuniformGridData.hh"
0013 #include "celeritas/Types.hh"
0014 
0015 namespace celeritas
0016 {
0017 //---------------------------------------------------------------------------//
0018 /*!
0019  * Data for calculating micro (element) cross sections.
0020  */
0021 template<Ownership W, MemSpace M>
0022 struct NeutronCaptureData
0023 {
0024     template<class T>
0025     using Items = Collection<T, W, M>;
0026     template<class T>
0027     using ElementItems = Collection<T, W, M, ElementId>;
0028 
0029     //// MEMBER DATA ////
0030 
0031     //! ID of a neutron
0032     ParticleId neutron_id;
0033 
0034     //! Microscopic (element) cross section data (G4PARTICLEXS/neutron/capZ)
0035     ElementItems<NonuniformGridRecord> micro_xs;
0036 
0037     // Backend data
0038     Items<real_type> reals;
0039 
0040     //// MEMBER FUNCTIONS ////
0041 
0042     //! Model's maximum energy limit [MeV]
0043     static CELER_CONSTEXPR_FUNCTION units::MevEnergy max_valid_energy()
0044     {
0045         return units::MevEnergy{20};
0046     }
0047 
0048     //! Whether the data are assigned
0049     explicit CELER_FUNCTION operator bool() const
0050     {
0051         return neutron_id && !micro_xs.empty() && !reals.empty();
0052     }
0053 
0054     //! Assign from another set of data
0055     template<Ownership W2, MemSpace M2>
0056     NeutronCaptureData& operator=(NeutronCaptureData<W2, M2> const& other)
0057     {
0058         CELER_EXPECT(other);
0059         neutron_id = other.neutron_id;
0060         micro_xs = other.micro_xs;
0061         reals = other.reals;
0062         return *this;
0063     }
0064 };
0065 
0066 //---------------------------------------------------------------------------//
0067 }  // namespace celeritas