Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:53:44

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/optical/WavelengthShiftData.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 namespace optical
0018 {
0019 //---------------------------------------------------------------------------//
0020 /*!
0021  * Material dependent scalar property of wavelength shift (WLS).
0022  */
0023 struct WlsMaterialRecord
0024 {
0025     real_type mean_num_photons{};  //!< Mean number of reemitted photons
0026     real_type time_constant{};  //!< Time delay of WLS [time]
0027 
0028     //! Whether all data are assigned and valid
0029     explicit CELER_FUNCTION operator bool() const
0030     {
0031         return mean_num_photons > 0 && time_constant > 0;
0032     }
0033 };
0034 
0035 //---------------------------------------------------------------------------//
0036 /*!
0037  * Wavelength shift data
0038  */
0039 template<Ownership W, MemSpace M>
0040 struct WavelengthShiftData
0041 {
0042     template<class T>
0043     using Items = Collection<T, W, M>;
0044     template<class T>
0045     using OpticalMaterialItems = Collection<T, W, M, OptMatId>;
0046 
0047     //// MEMBER DATA ////
0048 
0049     OpticalMaterialItems<WlsMaterialRecord> wls_record;
0050 
0051     // Cumulative probability of emission as a function of energy
0052     OpticalMaterialItems<NonuniformGridRecord> energy_cdf;
0053 
0054     // Backend data
0055     Items<real_type> reals;
0056 
0057     //// MEMBER FUNCTIONS ////
0058 
0059     //! Whether all data are assigned and valid
0060     explicit CELER_FUNCTION operator bool() const
0061     {
0062         return !wls_record.empty() && !energy_cdf.empty();
0063     }
0064 
0065     //! Assign from another set of data
0066     template<Ownership W2, MemSpace M2>
0067     WavelengthShiftData& operator=(WavelengthShiftData<W2, M2> const& other)
0068     {
0069         CELER_EXPECT(other);
0070         wls_record = other.wls_record;
0071         energy_cdf = other.energy_cdf;
0072         reals = other.reals;
0073         return *this;
0074     }
0075 };
0076 
0077 //---------------------------------------------------------------------------//
0078 }  // namespace optical
0079 }  // namespace celeritas