File indexing completed on 2026-11-11 09:53:33
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include <functional>
0011 #include <memory>
0012 #include <G4ThreeVector.hh>
0013
0014 #include "celeritas/geo/GeoFwd.hh"
0015 #include "celeritas/global/ActionInterface.hh"
0016
0017 class G4LogicalVolume;
0018
0019 namespace celeritas
0020 {
0021 struct ImportData;
0022 struct RZMapFieldInput;
0023 class CutoffParams;
0024 class FluctuationParams;
0025 class GeoMaterialParams;
0026 class MaterialParams;
0027 class ParticleParams;
0028 class PhysicsParams;
0029
0030 namespace inp
0031 {
0032 struct UniformField;
0033 struct CartMapField;
0034 struct CylMapField;
0035 }
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047 struct AlongStepFactoryInput
0048 {
0049 ActionId action_id;
0050
0051 std::shared_ptr<CoreGeoParams const> geometry;
0052 std::shared_ptr<MaterialParams const> material;
0053 std::shared_ptr<GeoMaterialParams const> geomaterial;
0054 std::shared_ptr<ParticleParams const> particle;
0055 std::shared_ptr<CutoffParams const> cutoff;
0056 std::shared_ptr<PhysicsParams const> physics;
0057 std::shared_ptr<ImportData const> imported;
0058
0059
0060 explicit operator bool() const
0061 {
0062 return action_id && geometry && material && geomaterial && particle
0063 && cutoff && physics && imported;
0064 }
0065 };
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084 class AlongStepFactoryInterface
0085 {
0086 public:
0087
0088
0089 using argument_type = AlongStepFactoryInput const&;
0090 using result_type = std::shared_ptr<CoreStepActionInterface const>;
0091
0092
0093 public:
0094 virtual ~AlongStepFactoryInterface() = default;
0095
0096
0097 virtual result_type operator()(argument_type input) const = 0;
0098
0099 protected:
0100 AlongStepFactoryInterface() = default;
0101 CELER_DEFAULT_COPY_MOVE(AlongStepFactoryInterface);
0102 };
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114 class UniformAlongStepFactory final : public AlongStepFactoryInterface
0115 {
0116 public:
0117
0118
0119 using FieldInput = inp::UniformField;
0120 using FieldFunction = std::function<FieldInput()>;
0121 using VecVolume = std::vector<G4LogicalVolume const*>;
0122 using VecVolumeFunction = std::function<VecVolume()>;
0123
0124
0125 public:
0126
0127 UniformAlongStepFactory() = default;
0128
0129
0130 explicit UniformAlongStepFactory(FieldFunction f);
0131
0132
0133 UniformAlongStepFactory(FieldFunction f, VecVolumeFunction volumes);
0134
0135
0136 result_type operator()(argument_type input) const final;
0137
0138
0139 FieldInput get_field() const;
0140
0141
0142 VecVolume get_volumes() const;
0143
0144 private:
0145 FieldFunction get_field_;
0146 VecVolumeFunction get_volumes_;
0147 };
0148
0149
0150
0151
0152
0153
0154 class RZMapFieldAlongStepFactory final : public AlongStepFactoryInterface
0155 {
0156 public:
0157
0158
0159 using FieldInput = RZMapFieldInput;
0160 using RZMapFieldFunction = std::function<FieldInput()>;
0161
0162
0163 public:
0164
0165 explicit RZMapFieldAlongStepFactory(RZMapFieldFunction f);
0166
0167
0168 result_type operator()(argument_type input) const final;
0169
0170
0171 FieldInput get_field() const;
0172
0173 private:
0174 RZMapFieldFunction get_fieldmap_;
0175 };
0176
0177
0178
0179
0180
0181
0182 class CylMapFieldAlongStepFactory final : public AlongStepFactoryInterface
0183 {
0184 public:
0185
0186
0187 using FieldInput = inp::CylMapField;
0188 using CylMapFieldFunction = std::function<FieldInput()>;
0189
0190
0191 public:
0192
0193 explicit CylMapFieldAlongStepFactory(CylMapFieldFunction f);
0194
0195
0196 result_type operator()(argument_type input) const final;
0197
0198
0199 FieldInput get_field() const;
0200
0201 private:
0202 CylMapFieldFunction get_fieldmap_;
0203 };
0204
0205
0206
0207
0208
0209
0210 class CartMapFieldAlongStepFactory final : public AlongStepFactoryInterface
0211 {
0212 public:
0213
0214
0215 using FieldInput = inp::CartMapField;
0216 using CartMapFieldFunction = std::function<FieldInput()>;
0217
0218
0219 public:
0220
0221 explicit CartMapFieldAlongStepFactory(CartMapFieldFunction f);
0222
0223
0224 result_type operator()(argument_type input) const final;
0225
0226
0227 FieldInput get_field() const;
0228
0229 private:
0230 CartMapFieldFunction get_fieldmap_;
0231 };
0232
0233
0234 }