File indexing completed on 2026-10-29 09:13:54
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include <type_traits>
0010
0011 #include "GeoTrackInterface.hh"
0012
0013 namespace celeritas
0014 {
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 template<class GTV>
0025 class WrappedGeoTrackView final
0026 : public GeoTrackInterface<typename GTV::real_type>
0027 {
0028 using Base = GeoTrackInterface<typename GTV::real_type>;
0029
0030 public:
0031
0032
0033 using GeoTrackViewT = GTV;
0034 using Initializer_t = GeoTrackInitializer;
0035 using real_type = typename GTV::real_type;
0036 using Real3 = typename Base::Real3;
0037 using VolPathVisitor = typename Base::VolPathVisitor;
0038
0039
0040 public:
0041
0042 template<class... Args>
0043 WrappedGeoTrackView(Args&&... args) : t_(std::forward<Args>(args)...)
0044 {
0045 }
0046
0047 CELER_DEFAULT_MOVE_DELETE_COPY(WrappedGeoTrackView);
0048
0049
0050 CELER_FORCEINLINE GTV const& track_view() const { return t_; }
0051
0052 CELER_FORCEINLINE GTV& track_view() { return t_; }
0053
0054
0055
0056
0057 WrappedGeoTrackView& operator=(Initializer_t const& init) final
0058 {
0059 t_ = init;
0060 return *this;
0061 }
0062
0063
0064 Real3 const& pos() const final { return t_.pos(); }
0065 Real3 const& dir() const final { return t_.dir(); }
0066
0067
0068 VolumeId volume_id() const final { return t_.volume_id(); }
0069 VolumeInstanceId volume_instance_id() const final
0070 {
0071 return t_.volume_instance_id();
0072 }
0073 VolumeLevelId volume_level() const final { return t_.volume_level(); }
0074 void volume_instance_id(Span<VolumeInstanceId> levels) const final
0075 {
0076 t_.volume_instance_id(levels);
0077 }
0078 void foreach_volume_path(VolPathVisitor visit) const final
0079 {
0080 t_.foreach_volume_path(std::move(visit));
0081 }
0082
0083
0084 ImplVolumeId impl_volume_id() const final { return t_.impl_volume_id(); }
0085
0086
0087 bool is_outside() const final { return t_.is_outside(); }
0088 bool failed() const final { return t_.failed(); }
0089
0090
0091 bool is_on_boundary() const final { return t_.is_on_boundary(); }
0092 Real3 normal() const final { return t_.normal(); }
0093 GeoStatus geo_status() const final
0094 {
0095 if constexpr (HasGeoStatus_<GTV>::value)
0096 {
0097 return t_.geo_status();
0098 }
0099 else
0100 {
0101 return Base::geo_status();
0102 }
0103 }
0104
0105
0106 Propagation find_next_step(real_type max_step) final
0107 {
0108 return t_.find_next_step(max_step);
0109 }
0110 void move_internal(real_type step) final { t_.move_internal(step); }
0111 void move_to_boundary() final { t_.move_to_boundary(); }
0112 void cross_boundary() final { t_.cross_boundary(); }
0113
0114
0115 real_type find_safety() final { return t_.find_safety(); }
0116 real_type find_safety(real_type max_step) final
0117 {
0118 return t_.find_safety(max_step);
0119 }
0120 void set_dir(Real3 const& newdir) final { t_.set_dir(newdir); }
0121 void move_internal(Real3 const& pos) final { t_.move_internal(pos); }
0122
0123 private:
0124 GTV t_;
0125
0126
0127 template<class T, class = void>
0128 struct HasGeoStatus_ : std::false_type
0129 {
0130 };
0131 template<class T>
0132 struct HasGeoStatus_<
0133 T,
0134 std::void_t<decltype(std::declval<T const&>().geo_status())>>
0135 : std::true_type
0136 {
0137 };
0138 };
0139
0140
0141
0142
0143
0144 template<class GTV>
0145 WrappedGeoTrackView(GTV&&) -> WrappedGeoTrackView<GTV>;
0146
0147
0148 }