File indexing completed on 2025-12-15 10:10:59
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Assert.hh"
0010 #include "corecel/data/Collection.hh"
0011 #include "corecel/random/data/RngData.hh"
0012 #include "celeritas/Types.hh"
0013 #include "celeritas/geo/GeoData.hh"
0014
0015 #include "CoreTrackDataFwd.hh"
0016 #include "MaterialData.hh"
0017 #include "ParticleData.hh"
0018 #include "PhysicsData.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 struct CoreScalars
0032 {
0033
0034
0035 ActionId boundary_action;
0036 ActionId tracking_cut_action;
0037
0038 StreamId::size_type max_streams{0};
0039
0040
0041 explicit CELER_FUNCTION operator bool() const
0042 {
0043 return boundary_action && max_streams > 0;
0044 }
0045 };
0046
0047
0048
0049
0050
0051 template<Ownership W, MemSpace M>
0052 struct CoreParamsData
0053 {
0054 GeoParamsData<W, M> geometry;
0055 MaterialParamsData<W, M> material;
0056 PhysicsParamsData<W, M> physics;
0057 RngParamsData<W, M> rng;
0058 TrackInitParamsData<W, M> init;
0059
0060 CoreScalars scalars;
0061
0062
0063 explicit CELER_FUNCTION operator bool() const
0064 {
0065 return geometry && material && physics && rng && init && scalars;
0066 }
0067
0068
0069 template<Ownership W2, MemSpace M2>
0070 CoreParamsData& operator=(CoreParamsData<W2, M2> const& other)
0071 {
0072 CELER_EXPECT(other);
0073 geometry = other.geometry;
0074 material = other.material;
0075 physics = other.physics;
0076 rng = other.rng;
0077 init = other.init;
0078 scalars = other.scalars;
0079 return *this;
0080 }
0081 };
0082
0083
0084
0085
0086
0087 template<Ownership W, MemSpace M>
0088 struct CoreStateData
0089 {
0090 template<class T>
0091 using Items = StateCollection<T, W, M>;
0092
0093 GeoStateData<W, M> geometry;
0094
0095 ParticleStateData<W, M> particle;
0096 PhysicsStateData<W, M> physics;
0097 RngStateData<W, M> rng;
0098 SimStateData<W, M> sim;
0099 TrackInitStateData<W, M> init;
0100
0101
0102 StreamId stream_id;
0103
0104
0105 CELER_FUNCTION size_type size() const { return geometry.size(); }
0106
0107
0108 explicit CELER_FUNCTION operator bool() const
0109 {
0110 return geometry && particle && physics && rng && sim && init
0111 && stream_id;
0112 }
0113
0114
0115 template<Ownership W2, MemSpace M2>
0116 CoreStateData& operator=(CoreStateData<W2, M2>& other)
0117 {
0118 CELER_EXPECT(other);
0119 geometry = other.geometry;
0120 particle = other.particle;
0121 physics = other.physics;
0122 rng = other.rng;
0123 sim = other.sim;
0124 init = other.init;
0125 stream_id = other.stream_id;
0126 return *this;
0127 }
0128 };
0129
0130
0131
0132
0133
0134
0135
0136
0137 template<MemSpace M>
0138 void resize(CoreStateData<Ownership::value, M>* state,
0139 HostCRef<CoreParamsData> const& params,
0140 StreamId stream_id,
0141 size_type size);
0142
0143
0144 }
0145 }