File indexing completed on 2025-01-30 10:09:32
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #pragma once
0013
0014 #include <VecGeom/base/Config.h>
0015 #include <VecGeom/base/Global.h>
0016 #include <VecGeom/base/Vector3D.h>
0017 #include <VecGeom/navigation/NavStateIndex.h>
0018 #include <VecGeom/surfaces/Navigator.h>
0019
0020 #ifdef VECGEOM_ENABLE_CUDA
0021 # include <VecGeom/backend/cuda/Interface.h>
0022 #endif
0023 #include "corecel/Macros.hh"
0024
0025 namespace celeritas
0026 {
0027 namespace detail
0028 {
0029
0030 class SurfNavigator
0031 {
0032 public:
0033 using Precision = vecgeom::Precision;
0034 using Vector3D = vecgeom::Vector3D<vecgeom::Precision>;
0035 using VPlacedVolumePtr_t = vecgeom::VPlacedVolume const*;
0036 using SurfData = vgbrep::SurfData<Precision>;
0037
0038 static constexpr Precision kBoundaryPush = 10 * vecgeom::kTolerance;
0039
0040
0041 CELER_FUNCTION static VPlacedVolumePtr_t
0042 LocatePointIn(VPlacedVolumePtr_t vol,
0043 Vector3D const& point,
0044 vecgeom::NavStateIndex& path,
0045 bool top)
0046 {
0047 return vgbrep::protonav::LocatePointIn(vol, point, path, top);
0048 }
0049
0050
0051 CELER_FUNCTION static Precision
0052 ComputeSafety(Vector3D const& globalpoint,
0053 vecgeom::NavStateIndex const& state)
0054 {
0055 int closest_surf = 0;
0056 return vgbrep::protonav::ComputeSafety(
0057 globalpoint, state, closest_surf);
0058 }
0059
0060
0061
0062
0063
0064
0065
0066
0067 CELER_FUNCTION static Precision
0068 ComputeStepAndNextVolume(Vector3D const& globalpoint,
0069 Vector3D const& globaldir,
0070 Precision step_limit,
0071 vecgeom::NavStateIndex const& in_state,
0072 vecgeom::NavStateIndex& out_state,
0073 [[maybe_unused]] Precision push = 0)
0074 {
0075 if (step_limit <= 0)
0076 {
0077 in_state.CopyTo(&out_state);
0078 out_state.SetBoundaryState(false);
0079 return step_limit;
0080 }
0081
0082 int exit_surf = 0;
0083 auto step = vgbrep::protonav::ComputeStepAndHit(
0084 globalpoint, globaldir, in_state, out_state, exit_surf, step_limit);
0085 return step;
0086 }
0087
0088
0089
0090
0091
0092 CELER_FUNCTION static Precision
0093 ComputeStepAndPropagatedState(Vector3D const& globalpoint,
0094 Vector3D const& globaldir,
0095 Precision step_limit,
0096 vecgeom::NavStateIndex const& in_state,
0097 vecgeom::NavStateIndex& out_state,
0098 Precision push = 0)
0099 {
0100 return ComputeStepAndNextVolume(
0101 globalpoint, globaldir, step_limit, in_state, out_state, push);
0102 }
0103
0104
0105
0106
0107 CELER_FUNCTION static void
0108 RelocateToNextVolume(Vector3D const& ,
0109 Vector3D const& ,
0110 vecgeom::NavStateIndex& )
0111 {
0112 }
0113 };
0114
0115
0116 }
0117 }