@@ -640,9 +640,10 @@ class navigator {
640640 // / @param state the current navigation state
641641 // / @param cfg the navigation configuration
642642 template <typename track_t >
643- DETRAY_HOST_DEVICE inline void init (const track_t &track, state &navigation,
644- const navigation::config &cfg,
645- const context_type &ctx) const {
643+ DETRAY_HOST_DEVICE inline void init (
644+ const track_t &track, state &navigation, const navigation::config &cfg,
645+ const context_type &ctx,
646+ const bool use_path_tolerance_as_overstep_tolerance = true ) const {
646647 const auto &det = navigation.detector ();
647648 const auto volume = tracking_volume{det, navigation.volume ()};
648649
@@ -651,12 +652,16 @@ class navigator {
651652 navigation.m_heartbeat = true ;
652653
653654 // Search for neighboring surfaces and fill candidates into cache
655+ const scalar_type overstep_tol =
656+ use_path_tolerance_as_overstep_tolerance ? -cfg.path_tolerance
657+ : cfg.overstep_tolerance ;
658+
654659 volume.template visit_neighborhood <candidate_search>(
655660 track, cfg, ctx, det, ctx, track, navigation,
656661 darray<scalar_type, 2u >{cfg.min_mask_tolerance ,
657662 cfg.max_mask_tolerance },
658663 static_cast <scalar_type>(cfg.mask_tolerance_scalor ),
659- static_cast <scalar_type>(cfg. overstep_tolerance ));
664+ static_cast <scalar_type>(overstep_tol ));
660665
661666 // Determine overall state of the navigation after updating the cache
662667 update_navigation_state (navigation, cfg);
@@ -729,7 +734,11 @@ class navigator {
729734 // If no trust could be restored for the current state, (local)
730735 // navigation might be exhausted: re-initialize volume
731736 else {
732- init (track, navigation, cfg, ctx);
737+ // Use overstep tolerance instead of path tolerance
738+ const bool use_path_tolerance_as_overstep_tolerance = false ;
739+
740+ init (track, navigation, cfg, ctx,
741+ use_path_tolerance_as_overstep_tolerance);
733742 is_init = true ;
734743
735744 // Sanity check: Should never be the case after complete update call
@@ -743,7 +752,8 @@ class navigator {
743752 math::min (100 .f * cfg.overstep_tolerance ,
744753 -10 .f * cfg.max_mask_tolerance );
745754
746- init (track, navigation, loose_cfg, ctx);
755+ init (track, navigation, loose_cfg, ctx,
756+ use_path_tolerance_as_overstep_tolerance);
747757
748758 // Unrecoverable
749759 if (navigation.trust_level () !=
@@ -849,7 +859,11 @@ class navigator {
849859 // Actor flagged cache as broken (other cases of 'no trust' are
850860 // handeled after volume switch was checked in 'update()')
851861 if (navigation.trust_level () == navigation::trust_level::e_no_trust) {
852- init (track, navigation, cfg, ctx);
862+ // Use overstep tolerance instead of path tolerance
863+ const bool use_path_tolerance_as_overstep_tolerance = false ;
864+
865+ init (track, navigation, cfg, ctx,
866+ use_path_tolerance_as_overstep_tolerance);
853867 return true ;
854868 }
855869
0 commit comments