File indexing completed on 2026-11-07 10:11:39
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Macros.hh"
0010 #include "corecel/cont/EnumArray.hh"
0011 #include "corecel/data/Collection.hh"
0012 #include "corecel/grid/NonuniformGridData.hh"
0013 #include "celeritas/Quantities.hh"
0014 #include "celeritas/grid/NonuniformGridCalculator.hh"
0015 #include "celeritas/optical/Types.hh"
0016
0017 namespace celeritas
0018 {
0019 namespace optical
0020 {
0021
0022
0023
0024
0025 enum class DielectricInterface
0026 {
0027 metal,
0028 dielectric,
0029 };
0030
0031
0032
0033
0034
0035
0036
0037
0038 template<Ownership W, MemSpace M>
0039 struct DielectricData
0040 {
0041
0042
0043 template<class T>
0044 using SurfaceItems = Collection<T, W, M, SubModelId>;
0045
0046
0047 SurfaceItems<DielectricInterface> interface;
0048
0049
0050 explicit CELER_FUNCTION operator bool() const
0051 {
0052 return !interface.empty();
0053 }
0054
0055
0056 template<Ownership W2, MemSpace M2>
0057 DielectricData<W, M>& operator=(DielectricData<W2, M2> const& other)
0058 {
0059 CELER_EXPECT(other);
0060 interface = other.interface;
0061 CELER_ENSURE(*this);
0062 return *this;
0063 }
0064 };
0065
0066
0067
0068
0069
0070 template<Ownership W, MemSpace M>
0071 struct UnifiedReflectionData
0072 {
0073
0074
0075 template<class T>
0076 using UnifiedModeArray = EnumArray<ReflectionMode, T>;
0077
0078 template<class T>
0079 using Items = Collection<T, W, M>;
0080
0081 using SurfaceGrids = Collection<NonuniformGridRecord, W, M, SubModelId>;
0082
0083
0084 UnifiedModeArray<SurfaceGrids> reflection_grids;
0085
0086
0087 Items<real_type> reals;
0088
0089
0090 CELER_FUNCTION SubModelId::size_type size() const
0091 {
0092 return reflection_grids.front().size();
0093 }
0094
0095
0096 explicit CELER_FUNCTION operator bool() const
0097 {
0098 return this->size() > 0
0099 && all_of(reflection_grids.begin(),
0100 reflection_grids.end(),
0101 [this](auto const& grid) {
0102 return grid.size() == this->size();
0103 });
0104 }
0105
0106
0107 template<Ownership W2, MemSpace M2>
0108 UnifiedReflectionData<W, M>& operator=(
0109 UnifiedReflectionData<W2, M2> const& other)
0110 {
0111 CELER_EXPECT(other);
0112 for (auto mode : range(ReflectionMode::size_))
0113 {
0114 reflection_grids[mode] = other.reflection_grids[mode];
0115 }
0116 reals = other.reals;
0117 return *this;
0118 }
0119 };
0120
0121
0122 }
0123 }