File indexing completed on 2026-11-07 09:43:35
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Types.hh"
0010 #include "celeritas/Types.hh"
0011 #include "celeritas/optical/TrackInitializer.hh"
0012 #include "celeritas/optical/gen/DirectGeneratorAction.hh"
0013
0014 #include "TrackOffloadInterface.hh"
0015
0016 class G4EventManager;
0017 namespace celeritas
0018 {
0019 namespace optical
0020 {
0021 class CoreStateBase;
0022 class Transporter;
0023 }
0024
0025 struct SetupOptions;
0026 class SharedParams;
0027
0028
0029
0030
0031
0032 class LocalOpticalTrackOffload final : public TrackOffloadInterface
0033 {
0034 public:
0035
0036
0037 using TrackData = optical::TrackInitializer;
0038
0039
0040 public:
0041
0042 LocalOpticalTrackOffload() = default;
0043
0044
0045 LocalOpticalTrackOffload(SetupOptions const& options, SharedParams& params);
0046
0047
0048
0049
0050
0051 void Initialize(SetupOptions const&, SharedParams&) final;
0052
0053
0054 void InitializeEvent(int) final;
0055
0056
0057 void Flush() final;
0058
0059
0060 void Finalize() final;
0061
0062
0063 bool Initialized() const final { return static_cast<bool>(transport_); }
0064
0065
0066 size_type GetBufferSize() const final { return buffer_.size(); }
0067
0068
0069 MapStrDbl GetActionTime() const final;
0070
0071
0072
0073 void Push(G4Track&) final;
0074
0075
0076 size_type num_pushed() const { return num_pushed_; }
0077
0078 private:
0079
0080 std::shared_ptr<optical::Transporter> transport_;
0081
0082
0083 std::shared_ptr<optical::CoreStateBase> state_;
0084
0085
0086 std::shared_ptr<optical::DirectGeneratorAction const> direct_gen_;
0087
0088
0089 std::vector<TrackData> buffer_;
0090
0091
0092 size_type auto_flush_{};
0093
0094
0095 size_type num_pushed_{};
0096
0097
0098 size_type num_flushed_{};
0099
0100
0101 UniqueEventId event_id_;
0102 G4EventManager* event_manager_{nullptr};
0103 };
0104
0105
0106 }