File indexing completed on 2025-09-15 08:54:47
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include <memory>
0010
0011 #include "corecel/data/AuxInterface.hh"
0012 #include "celeritas/Types.hh"
0013
0014 #include "Model.hh"
0015 #include "OffloadData.hh"
0016
0017 namespace celeritas
0018 {
0019
0020 class ActionRegistry;
0021 class AuxStateVec;
0022 class CoreParams;
0023
0024 namespace optical
0025 {
0026 class CherenkovParams;
0027 class MaterialParams;
0028 class ScintillationParams;
0029 }
0030
0031 namespace detail
0032 {
0033 class CherenkovOffloadAction;
0034 class CherenkovGeneratorAction;
0035 class OffloadGatherAction;
0036 class OpticalLaunchAction;
0037 class OffloadParams;
0038 class ScintOffloadAction;
0039 class ScintGeneratorAction;
0040 }
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062 class OpticalCollector
0063 {
0064 public:
0065
0066
0067 using SPConstCherenkov = std::shared_ptr<optical::CherenkovParams const>;
0068 using SPConstMaterial = std::shared_ptr<optical::MaterialParams const>;
0069 using SPConstScintillation
0070 = std::shared_ptr<optical::ScintillationParams const>;
0071 using OpticalBufferSize = OpticalOffloadCounters<size_type>;
0072
0073
0074 struct Input
0075 {
0076
0077 std::vector<optical::Model::ModelBuilder> model_builders;
0078
0079
0080 SPConstMaterial material;
0081 SPConstCherenkov cherenkov;
0082 SPConstScintillation scintillation;
0083
0084
0085 size_type num_track_slots{};
0086
0087
0088 size_type buffer_capacity{};
0089
0090
0091 size_type initializer_capacity{};
0092
0093
0094 size_type auto_flush{};
0095
0096
0097 explicit operator bool() const
0098 {
0099 return material && (scintillation || cherenkov)
0100 && num_track_slots > 0 && buffer_capacity > 0
0101 && initializer_capacity > 0 && auto_flush > 0
0102 && !model_builders.empty();
0103 }
0104 };
0105
0106 public:
0107
0108 OpticalCollector(CoreParams const&, Input&&);
0109
0110
0111 AuxId offload_aux_id() const;
0112
0113
0114 AuxId optical_aux_id() const;
0115
0116
0117 OpticalAccumStats exchange_counters(AuxStateVec& aux) const;
0118
0119
0120 OpticalBufferSize const& buffer_counts(AuxStateVec const& aux) const;
0121
0122 private:
0123
0124
0125 using SPOffloadParams = std::shared_ptr<detail::OffloadParams>;
0126 using SPCherenkovAction = std::shared_ptr<detail::CherenkovOffloadAction>;
0127 using SPScintAction = std::shared_ptr<detail::ScintOffloadAction>;
0128 using SPGatherAction = std::shared_ptr<detail::OffloadGatherAction>;
0129 using SPCherenkovGenAction
0130 = std::shared_ptr<detail::CherenkovGeneratorAction>;
0131 using SPScintGenAction = std::shared_ptr<detail::ScintGeneratorAction>;
0132 using SPLaunchAction = std::shared_ptr<detail::OpticalLaunchAction>;
0133
0134
0135
0136 SPOffloadParams offload_params_;
0137
0138 SPGatherAction gather_action_;
0139 SPCherenkovAction cherenkov_action_;
0140 SPScintAction scint_action_;
0141 SPCherenkovGenAction cherenkov_gen_action_;
0142 SPScintGenAction scint_gen_action_;
0143 SPLaunchAction launch_action_;
0144 };
0145
0146
0147 }