Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-10 10:05:47

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/gen/detail/GeneratorTraits.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Types.hh"
0010 
0011 namespace celeritas
0012 {
0013 template<Ownership W, MemSpace M>
0014 struct CherenkovData;
0015 class CherenkovGenerator;
0016 class CherenkovParams;
0017 template<Ownership W, MemSpace M>
0018 struct ScintillationData;
0019 class ScintillationGenerator;
0020 class ScintillationParams;
0021 
0022 namespace detail
0023 {
0024 struct CherenkovOffloadExecutor;
0025 struct ScintOffloadExecutor;
0026 
0027 //---------------------------------------------------------------------------//
0028 //! Process used to generate optical photons
0029 enum class GeneratorType
0030 {
0031     cherenkov,
0032     scintillation,
0033 };
0034 
0035 //---------------------------------------------------------------------------//
0036 //! Traits for generating optical photons from a process
0037 template<GeneratorType G>
0038 struct GeneratorTraits;
0039 
0040 template<>
0041 struct GeneratorTraits<GeneratorType::cherenkov>
0042 {
0043     //! Shared process data
0044     template<Ownership W, MemSpace M>
0045     using Data = CherenkovData<W, M>;
0046 
0047     //! Params class
0048     using Params = CherenkovParams;
0049 
0050     //! Optical photon generator
0051     using Generator = CherenkovGenerator;
0052 
0053     //! Label of the generator action
0054     static constexpr char const label[] = "cherenkov-generate";
0055 
0056     //! Description of the generator action
0057     static constexpr char const description[]
0058         = "generate Cherenkov photons from optical distribution data";
0059 };
0060 
0061 template<>
0062 struct GeneratorTraits<GeneratorType::scintillation>
0063 {
0064     //! Shared process data
0065     template<Ownership W, MemSpace M>
0066     using Data = ScintillationData<W, M>;
0067 
0068     //! Params class
0069     using Params = ScintillationParams;
0070 
0071     //! Optical photon generator
0072     using Generator = ScintillationGenerator;
0073 
0074     //! Label of the generator action
0075     static constexpr char const label[] = "scintillation-generate";
0076 
0077     //! Description of the generator action
0078     static constexpr char const description[]
0079         = "generate scintillation photons from optical distribution data";
0080 };
0081 
0082 //---------------------------------------------------------------------------//
0083 //! Traits for offloading optical distribution data from a process
0084 template<GeneratorType G>
0085 struct OffloadTraits;
0086 
0087 template<>
0088 struct OffloadTraits<GeneratorType::cherenkov>
0089 {
0090     //! Params class
0091     using Params = CherenkovParams;
0092 
0093     //! Optical offload executor
0094     using Executor = CherenkovOffloadExecutor;
0095 
0096     //! Label of the offload action
0097     static constexpr char const label[] = "cherenkov-offload";
0098 
0099     //! Description of the offload action
0100     static constexpr char const description[]
0101         = "generate Cherenkov optical distribution data";
0102 };
0103 
0104 template<>
0105 struct OffloadTraits<GeneratorType::scintillation>
0106 {
0107     //! Params class
0108     using Params = ScintillationParams;
0109 
0110     //! Optical offload executor
0111     using Executor = ScintOffloadExecutor;
0112 
0113     //! Label of the offload action
0114     static constexpr char const label[] = "scintillation-offload";
0115 
0116     //! Description of the offload action
0117     static constexpr char const description[]
0118         = "generate scintillation optical distribution data";
0119 };
0120 
0121 //---------------------------------------------------------------------------//
0122 }  // namespace detail
0123 }  // namespace celeritas