File indexing completed on 2025-02-22 10:31:32
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include <memory>
0011 #include <vector>
0012
0013 #include "corecel/data/StreamStore.hh"
0014 #include "corecel/io/OutputInterface.hh"
0015 #include "celeritas/global/ActionInterface.hh"
0016 #include "celeritas/global/CoreTrackData.hh"
0017
0018 #include "ParticleTallyData.hh"
0019
0020 namespace celeritas
0021 {
0022
0023 class ParticleParams;
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 class StepDiagnostic final : public CoreStepActionInterface,
0034 public OutputInterface
0035 {
0036 public:
0037
0038
0039 using SPConstParticle = std::shared_ptr<ParticleParams const>;
0040 using VecVecCount = std::vector<std::vector<size_type>>;
0041
0042
0043 public:
0044
0045 static std::shared_ptr<StepDiagnostic>
0046 make_and_insert(CoreParams const& core, size_type max_bins);
0047
0048
0049 StepDiagnostic(ActionId id,
0050 SPConstParticle particle,
0051 size_type max_bins,
0052 size_type num_streams);
0053
0054
0055 ~StepDiagnostic();
0056
0057
0058
0059
0060 void step(CoreParams const&, CoreStateHost&) const final;
0061
0062 void step(CoreParams const&, CoreStateDevice&) const final;
0063
0064 ActionId action_id() const final { return id_; }
0065
0066 std::string_view label() const final { return "step-diagnostic"; }
0067
0068 std::string_view description() const final;
0069
0070 StepActionOrder order() const final { return StepActionOrder::user_post; }
0071
0072
0073
0074
0075
0076 Category category() const final { return Category::result; }
0077
0078 void output(JsonPimpl*) const final;
0079
0080
0081
0082 VecVecCount calc_steps() const;
0083
0084
0085 size_type state_size() const;
0086
0087
0088 void clear();
0089
0090 private:
0091 using StoreT = StreamStore<ParticleTallyParamsData, ParticleTallyStateData>;
0092
0093 ActionId id_;
0094 size_type num_streams_;
0095 mutable StoreT store_;
0096 };
0097
0098
0099 }