File indexing completed on 2026-05-27 07:23:58
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011
0012 #include "detray/definitions/algebra.hpp"
0013 #include "detray/definitions/detail/qualifiers.hpp"
0014
0015 namespace detray {
0016
0017 namespace detail {
0018
0019
0020
0021
0022
0023
0024
0025
0026 template <concepts::scalar scalar_t>
0027 constexpr scalar_t phi_tolerance(scalar_t tol, scalar_t radius) {
0028 return radius > 0.f ? tol / radius : tol;
0029 }
0030
0031
0032 template <typename bool_t>
0033 using boundary_check_result = darray<bool_t, 2>;
0034
0035 }
0036
0037
0038 enum class check_type : std::uint_least8_t {
0039 e_precise = 0u,
0040 e_with_edge = 1u,
0041 };
0042
0043
0044 template <check_type C, typename bool_t>
0045 DETRAY_HOST_DEVICE constexpr bool_t get(
0046 const detail::boundary_check_result<bool_t> result) {
0047 if constexpr (C == check_type::e_precise) {
0048 return result[0];
0049 } else if constexpr (C == check_type::e_with_edge) {
0050 return result[1];
0051 } else {
0052
0053 return bool_t(false);
0054 }
0055 }
0056
0057
0058 template <check_type C, typename bool_t>
0059 DETRAY_HOST_DEVICE constexpr bool_t get(const bool_t& result) {
0060 return result;
0061 }
0062
0063 }