File indexing completed on 2026-05-27 07:24:01
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 #include "detray/definitions/math.hpp"
0015 #include "detray/definitions/units.hpp"
0016 #include "detray/propagator/base_actor.hpp"
0017
0018
0019 #include <climits>
0020
0021 namespace detray {
0022
0023
0024
0025 struct always_init : public base_actor {
0026 struct state {};
0027
0028
0029
0030
0031
0032 template <typename propagator_state_t>
0033 DETRAY_HOST_DEVICE inline void operator()(
0034 const state & , propagator_state_t &propagation) const {
0035 propagation.navigation().set_no_trust();
0036 }
0037 };
0038
0039
0040
0041 struct guided_navigation : public base_actor {
0042 struct state {};
0043
0044
0045
0046
0047
0048 template <typename propagator_state_t>
0049 DETRAY_HOST_DEVICE inline void operator()(
0050 const state & , propagator_state_t &propagation) const {
0051 propagation.navigation().set_high_trust();
0052 }
0053 };
0054
0055
0056
0057
0058
0059 template <concepts::scalar scalar_t>
0060 struct stepper_default_policy : public base_actor {
0061 struct state {
0062 scalar_t tol{std::numeric_limits<scalar_t>::epsilon()};
0063 };
0064
0065
0066
0067
0068
0069 template <typename propagator_state_t>
0070 DETRAY_HOST_DEVICE inline void operator()(
0071 state &pol_state, propagator_state_t &propagation) const {
0072 const auto &stepping = propagation.stepping();
0073 auto &navigation = propagation.navigation();
0074
0075
0076 if (math::fabs(stepping.step_size()) <
0077 math::fabs(
0078 stepping.constraints().template size<>(stepping.direction())) -
0079 pol_state.tol) {
0080
0081 navigation.set_high_trust();
0082 }
0083
0084
0085 else {
0086
0087 navigation.set_fair_trust();
0088 }
0089 }
0090 };
0091
0092
0093
0094
0095 template <concepts::scalar scalar_t>
0096 struct stepper_rk_policy : public base_actor {
0097 struct state {
0098 scalar_t m_threshold_fair_trust{0.05f};
0099 scalar_t m_threshold_no_trust{0.1f};
0100 };
0101
0102
0103
0104
0105
0106 template <typename propagator_state_t>
0107 DETRAY_HOST_DEVICE inline void operator()(
0108 const state &pol_state, propagator_state_t &propagation) const {
0109 const auto &stepping = propagation.stepping();
0110 auto &navigation = propagation.navigation();
0111
0112
0113 if (math::fabs(navigation()) <= 1.f * unit<float>::um) {
0114 navigation.set_high_trust();
0115 return;
0116 }
0117
0118
0119 const scalar_t rel_correction{(stepping.step_size() - navigation()) /
0120 navigation()};
0121
0122
0123 if (rel_correction > pol_state.m_threshold_no_trust) {
0124 navigation.set_no_trust();
0125 }
0126
0127 else if (rel_correction > pol_state.m_threshold_fair_trust) {
0128 navigation.set_fair_trust();
0129 } else {
0130
0131 navigation.set_high_trust();
0132 }
0133 }
0134 };
0135
0136 }