File indexing completed on 2026-11-07 10:11:39
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/cont/EnumArray.hh"
0010 #include "corecel/data/Collection.hh"
0011 #include "corecel/grid/NonuniformGridData.hh"
0012 #include "celeritas/optical/Types.hh"
0013
0014 namespace celeritas
0015 {
0016 namespace optical
0017 {
0018
0019
0020
0021
0022 template<Ownership W, MemSpace M>
0023 struct GridReflectivityData
0024 {
0025
0026
0027 using Grid = NonuniformGridRecord;
0028 using GridId = OpaqueId<Grid>;
0029
0030 template<class T>
0031 using Items = Collection<T, W, M>;
0032
0033 template<class T>
0034 using SurfaceItems = Collection<T, W, M, SubModelId>;
0035
0036 using ReflectivityGrids = EnumArray<ReflectivityAction, SurfaceItems<Grid>>;
0037
0038
0039
0040
0041
0042 ReflectivityGrids reflectivity;
0043
0044
0045 SurfaceItems<GridId> efficiency_ids;
0046 Items<Grid> efficiency;
0047
0048
0049 Items<real_type> reals;
0050
0051
0052
0053
0054 explicit CELER_FUNCTION operator bool() const
0055 {
0056 return !reflectivity[ReflectivityAction::interact].empty()
0057 && !reflectivity[ReflectivityAction::transmit].empty()
0058 && !efficiency_ids.empty() && !reals.empty();
0059 }
0060
0061
0062 template<Ownership W2, MemSpace M2>
0063 GridReflectivityData<W, M>& operator=(
0064 GridReflectivityData<W2, M2> const& other)
0065 {
0066 CELER_EXPECT(other);
0067
0068 for (auto action : range(ReflectivityAction::size_))
0069 {
0070 reflectivity[action] = other.reflectivity[action];
0071 }
0072 efficiency_ids = other.efficiency_ids;
0073 efficiency = other.efficiency;
0074 reals = other.reals;
0075
0076 CELER_ENSURE(*this);
0077 return *this;
0078 }
0079 };
0080
0081
0082 }
0083 }