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