File indexing completed on 2025-09-17 08:53:38
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Macros.hh"
0010 #include "corecel/Types.hh"
0011 #include "corecel/data/Collection.hh"
0012 #include "corecel/grid/UniformGridData.hh"
0013
0014 #include "FieldDriverOptions.hh"
0015
0016 namespace celeritas
0017 {
0018
0019
0020
0021
0022 struct MapFieldGridData
0023 {
0024 UniformGridData data_z;
0025 UniformGridData data_r;
0026 };
0027
0028
0029
0030
0031
0032 struct MapFieldElement
0033 {
0034 real_type value_z;
0035 real_type value_r;
0036 };
0037
0038
0039
0040
0041
0042 template<Ownership W, MemSpace M>
0043 struct RZMapFieldParamsData
0044 {
0045
0046 MapFieldGridData grids;
0047
0048
0049 FieldDriverOptions options;
0050
0051
0052 using ElementId = ItemId<size_type>;
0053
0054 template<class T>
0055 using ElementItems = Collection<T, W, M, ElementId>;
0056 ElementItems<MapFieldElement> fieldmap;
0057
0058
0059 explicit inline CELER_FUNCTION operator bool() const
0060 {
0061 return !fieldmap.empty();
0062 }
0063
0064 inline CELER_FUNCTION bool valid(real_type z, real_type r) const
0065 {
0066 CELER_EXPECT(grids.data_z);
0067 CELER_EXPECT(grids.data_r);
0068 return (z >= grids.data_z.front && z <= grids.data_z.back
0069 && r >= grids.data_r.front && r <= grids.data_r.back);
0070 }
0071
0072 inline CELER_FUNCTION ElementId id(size_type idx_z, size_type idx_r) const
0073 {
0074 CELER_EXPECT(grids.data_r);
0075 return ElementId(idx_z * grids.data_r.size + idx_r);
0076 }
0077
0078
0079 template<Ownership W2, MemSpace M2>
0080 RZMapFieldParamsData& operator=(RZMapFieldParamsData<W2, M2> const& other)
0081 {
0082 CELER_EXPECT(other);
0083 grids = other.grids;
0084 options = other.options;
0085 fieldmap = other.fieldmap;
0086 return *this;
0087 }
0088 };
0089
0090
0091 }