Skip to content

Commit 4655c16

Browse files
author
Vakho Tsulaia
committed
Removed one hack from grid_impl::search()
Fixed the navigator and propagator code accordingly
1 parent 94fb38c commit 4655c16

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

core/include/detray/navigation/navigator.hpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,8 @@ class navigator {
674674
/// @return a heartbeat to indicate if the navigation is still alive
675675
template <typename propagator_state_t>
676676
DETRAY_HOST_DEVICE inline bool update(propagator_state_t &propagation,
677-
const navigation::config &cfg) const {
677+
const navigation::config &cfg,
678+
const context_type& ctx = {}) const {
678679

679680
state &navigation = propagation._navigation;
680681

@@ -707,7 +708,7 @@ class navigator {
707708
// navigation.run_inspector(cfg, track.pos(), track.dir(), "Volume
708709
// switch: ");
709710

710-
init(propagation, cfg);
711+
init(propagation, cfg, ctx);
711712

712713
// Fresh initialization, reset trust and hearbeat
713714
navigation.m_trust_level = navigation::trust_level::e_full;
@@ -717,7 +718,7 @@ class navigator {
717718
}
718719
// If no trust could be restored for the current state, (local)
719720
// navigation might be exhausted: re-initialize volume
720-
navigation.m_heartbeat &= init(propagation, cfg);
721+
navigation.m_heartbeat &= init(propagation, cfg, ctx);
721722

722723
// Sanity check: Should never be the case after complete update call
723724
if (navigation.trust_level() != navigation::trust_level::e_full ||
@@ -738,7 +739,8 @@ class navigator {
738739
/// @param propagation contains the stepper and navigator states
739740
template <typename propagator_state_t>
740741
DETRAY_HOST_DEVICE inline void update_kernel(
741-
propagator_state_t &propagation, const navigation::config &cfg) const {
742+
propagator_state_t &propagation, const navigation::config &cfg,
743+
const context_type& ctx = {}) const {
742744

743745
state &navigation = propagation._navigation;
744746
const auto &det = navigation.detector();
@@ -819,7 +821,7 @@ class navigator {
819821
// Actor flagged cache as broken (other cases of 'no trust' are
820822
// handeled after volume switch was checked in 'update()')
821823
if (navigation.trust_level() == navigation::trust_level::e_no_trust) {
822-
navigation.m_heartbeat &= init(propagation, cfg);
824+
navigation.m_heartbeat &= init(propagation, cfg, ctx);
823825
return;
824826
}
825827
}

core/include/detray/propagator/propagator.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ struct propagator {
156156

157157
// Find next candidate
158158
propagation._heartbeat &=
159-
m_navigator.update(propagation, m_cfg.navigation);
159+
m_navigator.update(propagation, m_cfg.navigation, m_cfg.context);
160160

161161
// Run all registered actors/aborters after update
162162
run_actors(actor_state_refs, propagation);

core/include/detray/utils/grid/grid.hpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,10 @@ class grid_impl {
273273
template <typename detector_t, typename track_t, typename config_t>
274274
DETRAY_HOST_DEVICE auto search(
275275
const detector_t &det, const typename detector_t::volume_type &volume,
276-
const track_t &track, const config_t &cfg, const typename detector_t::geometry_context& /*ctx*/) const {
276+
const track_t &track, const config_t &cfg, const typename detector_t::geometry_context& ctx) const {
277277

278278
// Track position in grid coordinates
279-
// const auto &trf = det.transform_store().at(volume.transform(),ctx);
280-
typename detector_t::geometry_context cttx{0}; // Hack!
281-
const auto &trf = det.transform_store().at(volume.transform(),cttx);
279+
const auto &trf = det.transform_store().at(volume.transform(),ctx);
282280
const auto loc_pos = project(trf, track.pos(), track.dir());
283281

284282
// Grid lookup

0 commit comments

Comments
 (0)