|
|
|||
File indexing completed on 2026-01-10 10:05:49
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/phys/GeneratorInterface.hh 0006 //---------------------------------------------------------------------------// 0007 #pragma once 0008 0009 #include <string_view> 0010 0011 #include "corecel/OpaqueId.hh" 0012 #include "corecel/Types.hh" 0013 #include "corecel/data/AuxInterface.hh" 0014 #include "corecel/data/AuxStateVec.hh" 0015 0016 #include "GeneratorCounters.hh" 0017 0018 namespace celeritas 0019 { 0020 //---------------------------------------------------------------------------// 0021 // TYPES 0022 //---------------------------------------------------------------------------// 0023 0024 //! Index of generator 0025 using GeneratorId = OpaqueId<struct Generator_>; 0026 0027 struct GeneratorStateBase; 0028 0029 //---------------------------------------------------------------------------// 0030 // INTERFACES 0031 //---------------------------------------------------------------------------// 0032 /*! 0033 * Interface class for generating new tracks. 0034 * 0035 * Generators store information about pending primary or secondary particles as 0036 * auxiliary data and initialize the new tracks directly in the vacant slots. 0037 */ 0038 class GeneratorInterface 0039 { 0040 public: 0041 // Anchored virtual destructor for polymorphism 0042 virtual ~GeneratorInterface(); 0043 0044 //! Index of this class instance in its registry 0045 virtual GeneratorId generator_id() const = 0; 0046 0047 //! Short unique label of the generator 0048 virtual std::string_view label() const = 0; 0049 0050 //! Get generator counters (mutable) 0051 virtual GeneratorStateBase& counters(AuxStateVec&) const = 0; 0052 0053 //! Get generator counters 0054 virtual GeneratorStateBase const& counters(AuxStateVec const&) const = 0; 0055 0056 protected: 0057 //!@{ 0058 //! Allow construction and assignment only through daughter classes 0059 GeneratorInterface() = default; 0060 CELER_DEFAULT_COPY_MOVE(GeneratorInterface); 0061 //!@} 0062 }; 0063 0064 //---------------------------------------------------------------------------// 0065 /*! 0066 * Manage counters for generation states. 0067 */ 0068 struct GeneratorStateBase : public AuxStateInterface 0069 { 0070 //! Counts since the start of the optical loop 0071 GeneratorCounters<size_type> counters; 0072 //! Counts accumulated over the event for diagnostics 0073 GeneratorCounters<std::size_t> accum; 0074 }; 0075 0076 //---------------------------------------------------------------------------// 0077 } // namespace celeritas
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|