File indexing completed on 2025-09-17 08:21:12
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 struct CartMapFieldInput;
0024 struct CylMapFieldInput;
0025 class CutoffParams;
0026 class FluctuationParams;
0027 class GeoMaterialParams;
0028 class MaterialParams;
0029 class ParticleParams;
0030 class PhysicsParams;
0031
0032 namespace inp
0033 {
0034 struct UniformField;
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<GeoParams 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 RZMapFieldFunction = std::function<RZMapFieldInput()>;
0160
0161
0162 public:
0163
0164 explicit RZMapFieldAlongStepFactory(RZMapFieldFunction f);
0165
0166
0167 result_type operator()(argument_type input) const final;
0168
0169
0170 RZMapFieldInput get_field() const;
0171
0172 private:
0173 RZMapFieldFunction get_fieldmap_;
0174 };
0175
0176
0177
0178
0179
0180
0181 class CylMapFieldAlongStepFactory final : public AlongStepFactoryInterface
0182 {
0183 public:
0184
0185
0186 using CylMapFieldFunction = std::function<CylMapFieldInput()>;
0187
0188
0189 public:
0190
0191 explicit CylMapFieldAlongStepFactory(CylMapFieldFunction f);
0192
0193
0194 result_type operator()(argument_type input) const final;
0195
0196
0197 CylMapFieldInput get_field() const;
0198
0199 private:
0200 CylMapFieldFunction get_fieldmap_;
0201 };
0202
0203
0204
0205
0206
0207
0208 class CartMapFieldAlongStepFactory final : public AlongStepFactoryInterface
0209 {
0210 public:
0211
0212
0213 using CartMapFieldFunction = std::function<CartMapFieldInput()>;
0214
0215
0216 public:
0217
0218 explicit CartMapFieldAlongStepFactory(CartMapFieldFunction f);
0219
0220
0221 result_type operator()(argument_type input) const final;
0222
0223
0224 CartMapFieldInput get_field() const;
0225
0226 private:
0227 CartMapFieldFunction get_fieldmap_;
0228 };
0229
0230
0231 }