File indexing completed on 2026-01-07 10:01:47
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Assert.hh"
0010 #include "corecel/data/Collection.hh"
0011 #include "corecel/data/CollectionMirror.hh"
0012 #include "corecel/data/ParamsDataInterface.hh"
0013 #include "corecel/io/Label.hh"
0014
0015 #include "SDData.hh"
0016
0017 namespace celeritas
0018 {
0019
0020 class GeoParamsInterface;
0021
0022
0023
0024
0025
0026 class SDParams final : public ParamsDataInterface<SDParamsData>
0027 {
0028 public:
0029 using VecLabel = std::vector<Label>;
0030
0031 public:
0032
0033 SDParams() {}
0034
0035
0036 SDParams(VecLabel const& volume_labels, GeoParamsInterface const& geo);
0037
0038
0039 bool empty() const { return !static_cast<bool>(mirror_); }
0040
0041
0042 DetectorId::size_type size() const { return volume_ids_.size(); }
0043
0044
0045 DetectorId volume_to_detector_id(VolumeId vol_id)
0046 {
0047 return host_ref().detector[vol_id];
0048 }
0049
0050
0051 VolumeId detector_to_volume_id(DetectorId det_id)
0052 {
0053 CELER_EXPECT(det_id < this->size());
0054 return volume_ids_[det_id.get()];
0055 }
0056
0057
0058
0059
0060
0061 HostRef const& host_ref() const final { return mirror_.host_ref(); }
0062
0063 DeviceRef const& device_ref() const final { return mirror_.device_ref(); }
0064
0065
0066 private:
0067 std::vector<VolumeId> volume_ids_;
0068 CollectionMirror<SDParamsData> mirror_;
0069 };
0070
0071
0072 }