File indexing completed on 2026-11-03 10:18:43
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Assert.hh"
0010 #include "corecel/data/Collection.hh"
0011 #include "corecel/data/ObserverPtr.hh"
0012 #include "corecel/random/data/RngData.hh"
0013 #include "geocel/DetectorData.hh"
0014 #include "geocel/SurfaceData.hh"
0015 #include "geocel/VolumeData.hh"
0016 #include "celeritas/Types.hh"
0017 #include "celeritas/em/data/WentzelOKVIData.hh"
0018 #include "celeritas/geo/GeoData.hh"
0019 #include "celeritas/geo/GeoMaterialData.hh"
0020 #include "celeritas/mat/MaterialData.hh"
0021 #include "celeritas/phys/CutoffData.hh"
0022 #include "celeritas/phys/ParticleData.hh"
0023 #include "celeritas/phys/PhysicsData.hh"
0024 #include "celeritas/track/SimData.hh"
0025 #include "celeritas/track/TrackInitData.hh"
0026
0027 #include "CoreTrackDataFwd.hh"
0028
0029 namespace celeritas
0030 {
0031
0032 class CoreParams;
0033
0034
0035
0036
0037
0038 struct CoreScalars
0039 {
0040 ActionId boundary_action;
0041 ActionId propagation_limit_action;
0042 ActionId tracking_cut_action;
0043
0044
0045 ActionId along_step_user_action;
0046 ActionId along_step_neutral_action;
0047
0048 StreamId::size_type max_streams{0};
0049
0050
0051
0052 ObserverPtr<CoreParams const, MemSpace::host> host_core_params{nullptr};
0053
0054
0055 explicit CELER_FUNCTION operator bool() const
0056 {
0057 return boundary_action && propagation_limit_action
0058 && tracking_cut_action && along_step_user_action
0059 && along_step_neutral_action && max_streams > 0;
0060 }
0061 };
0062
0063
0064
0065
0066
0067 template<Ownership W, MemSpace M>
0068 struct CoreParamsData
0069 {
0070 GeoParamsData<W, M> geometry;
0071 MaterialParamsData<W, M> materials;
0072 GeoMaterialParamsData<W, M> geo_mats;
0073 ParticleParamsData<W, M> particles;
0074 CutoffParamsData<W, M> cutoffs;
0075 PhysicsParamsData<W, M> physics;
0076 RngParamsData<W, M> rng;
0077 SimParamsData<W, M> sim;
0078 SurfaceParamsData<W, M> surface;
0079 DetectorParamsData<W, M> detectors;
0080 VolumeParamsData<W, M> volumes;
0081 TrackInitParamsData<W, M> init;
0082 WentzelOKVIData<W, M> wentzel;
0083
0084 CoreScalars scalars;
0085
0086
0087 explicit CELER_FUNCTION operator bool() const
0088 {
0089
0090 return geometry && materials && geo_mats && particles && cutoffs
0091 && physics && rng && sim && surface && volumes && init
0092 && scalars;
0093 }
0094
0095
0096 template<Ownership W2, MemSpace M2>
0097 CoreParamsData& operator=(CoreParamsData<W2, M2> const& other)
0098 {
0099 CELER_EXPECT(other);
0100 geometry = other.geometry;
0101 materials = other.materials;
0102 geo_mats = other.geo_mats;
0103 particles = other.particles;
0104 cutoffs = other.cutoffs;
0105 physics = other.physics;
0106 rng = other.rng;
0107 sim = other.sim;
0108 surface = other.surface;
0109 detectors = other.detectors;
0110 volumes = other.volumes;
0111 init = other.init;
0112 wentzel = other.wentzel;
0113 scalars = other.scalars;
0114 return *this;
0115 }
0116 };
0117
0118
0119
0120
0121
0122
0123
0124 template<Ownership W, MemSpace M>
0125 struct CoreStateData
0126 {
0127 template<class T>
0128 using ThreadItems = Collection<T, W, M, ThreadId>;
0129
0130 GeoStateData<W, M> geometry;
0131 MaterialStateData<W, M> materials;
0132 ParticleStateData<W, M> particles;
0133 PhysicsStateData<W, M> physics;
0134 RngStateData<W, M> rng;
0135 SimStateData<W, M> sim;
0136 TrackInitStateData<W, M> init;
0137
0138
0139 ThreadItems<TrackSlotId::size_type> track_slots;
0140
0141
0142 StreamId stream_id;
0143
0144
0145 CELER_FUNCTION size_type size() const { return particles.size(); }
0146
0147
0148 explicit CELER_FUNCTION operator bool() const
0149 {
0150 return geometry && materials && particles && physics && rng && sim
0151 && init && stream_id;
0152 }
0153
0154
0155 template<Ownership W2, MemSpace M2>
0156 CoreStateData& operator=(CoreStateData<W2, M2>& other)
0157 {
0158 CELER_EXPECT(other);
0159 geometry = other.geometry;
0160 materials = other.materials;
0161 particles = other.particles;
0162 physics = other.physics;
0163 rng = other.rng;
0164 sim = other.sim;
0165 init = other.init;
0166 track_slots = other.track_slots;
0167 stream_id = other.stream_id;
0168 return *this;
0169 }
0170 };
0171
0172
0173
0174
0175
0176
0177
0178
0179 template<MemSpace M>
0180 void resize(CoreStateData<Ownership::value, M>* state,
0181 HostCRef<CoreParamsData> const& params,
0182 StreamId stream_id,
0183 size_type size);
0184
0185
0186 }