File indexing completed on 2025-02-22 10:31:27
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include "corecel/Assert.hh"
0011 #include "corecel/data/Collection.hh"
0012 #include "celeritas/Types.hh"
0013 #include "celeritas/geo/GeoData.hh"
0014 #include "celeritas/random/RngData.hh"
0015
0016 #include "CoreTrackDataFwd.hh"
0017 #include "MaterialData.hh"
0018 #include "ParticleData.hh"
0019 #include "SimData.hh"
0020 #include "TrackInitData.hh"
0021 #include "Types.hh"
0022
0023 namespace celeritas
0024 {
0025 namespace optical
0026 {
0027
0028
0029
0030
0031 template<Ownership W, MemSpace M>
0032 struct PhysicsParamsData
0033 {
0034 explicit CELER_FUNCTION operator bool() const { return true; }
0035 };
0036 template<Ownership W, MemSpace M>
0037 struct PhysicsStateData
0038 {
0039 explicit CELER_FUNCTION operator bool() const { return true; }
0040
0041
0042 template<Ownership W2, MemSpace M2>
0043 PhysicsStateData& operator=(PhysicsStateData<W2, M2>&)
0044 {
0045 return *this;
0046 }
0047 };
0048
0049 template<MemSpace M>
0050 inline void resize(PhysicsStateData<Ownership::value, M>*,
0051 HostCRef<PhysicsParamsData> const&,
0052 size_type)
0053 {
0054 }
0055
0056
0057
0058
0059
0060
0061 struct CoreScalars
0062 {
0063
0064
0065 ActionId boundary_action;
0066
0067 StreamId::size_type max_streams{0};
0068
0069
0070 explicit CELER_FUNCTION operator bool() const
0071 {
0072 return boundary_action && max_streams > 0;
0073 }
0074 };
0075
0076
0077
0078
0079
0080 template<Ownership W, MemSpace M>
0081 struct CoreParamsData
0082 {
0083 GeoParamsData<W, M> geometry;
0084 MaterialParamsData<W, M> material;
0085 PhysicsParamsData<W, M> physics;
0086 RngParamsData<W, M> rng;
0087 TrackInitParamsData<W, M> init;
0088
0089 CoreScalars scalars;
0090
0091
0092 explicit CELER_FUNCTION operator bool() const
0093 {
0094 return geometry && material && physics && rng && init && scalars;
0095 }
0096
0097
0098 template<Ownership W2, MemSpace M2>
0099 CoreParamsData& operator=(CoreParamsData<W2, M2> const& other)
0100 {
0101 CELER_EXPECT(other);
0102 geometry = other.geometry;
0103 material = other.material;
0104 physics = other.physics;
0105 rng = other.rng;
0106 init = other.init;
0107 scalars = other.scalars;
0108 return *this;
0109 }
0110 };
0111
0112
0113
0114
0115
0116 template<Ownership W, MemSpace M>
0117 struct CoreStateData
0118 {
0119 template<class T>
0120 using Items = StateCollection<T, W, M>;
0121
0122 GeoStateData<W, M> geometry;
0123
0124 ParticleStateData<W, M> particle;
0125 PhysicsStateData<W, M> physics;
0126 RngStateData<W, M> rng;
0127 SimStateData<W, M> sim;
0128 TrackInitStateData<W, M> init;
0129
0130
0131 StreamId stream_id;
0132
0133
0134 CELER_FUNCTION size_type size() const { return geometry.size(); }
0135
0136
0137 explicit CELER_FUNCTION operator bool() const
0138 {
0139 return geometry && particle && physics && rng && sim && init
0140 && stream_id;
0141 }
0142
0143
0144 template<Ownership W2, MemSpace M2>
0145 CoreStateData& operator=(CoreStateData<W2, M2>& other)
0146 {
0147 CELER_EXPECT(other);
0148 geometry = other.geometry;
0149 particle = other.particle;
0150 physics = other.physics;
0151 rng = other.rng;
0152 sim = other.sim;
0153 init = other.init;
0154 stream_id = other.stream_id;
0155 return *this;
0156 }
0157 };
0158
0159
0160
0161
0162
0163
0164
0165
0166 template<MemSpace M>
0167 void resize(CoreStateData<Ownership::value, M>* state,
0168 HostCRef<CoreParamsData> const& params,
0169 StreamId stream_id,
0170 size_type size);
0171
0172
0173 }
0174 }