1414#include " detray/materials/detail/concepts.hpp"
1515#include " detray/materials/detail/material_accessor.hpp"
1616#include " detray/materials/material.hpp"
17+ #include " detray/navigation/accelerators/search_window.hpp"
1718#include " detray/navigation/concepts.hpp"
1819
1920namespace detray ::detail {
@@ -67,27 +68,6 @@ struct surface_getter {
6768 }
6869};
6970
70- // / A functor to access the daughter volumes of a volume
71- template <typename functor_t >
72- struct volume_getter {
73-
74- // / Call operator that forwards the functor call to all contained daughter
75- // / volumes
76- template <concepts::accelerator_collection accel_coll_t ,
77- typename accel_index_t , typename ... Args>
78- DETRAY_HOST_DEVICE inline void operator ()(const accel_coll_t &,
79- const accel_index_t ,
80- Args &&...) const {
81-
82- using accel_type = typename accel_coll_t ::value_type;
83-
84- if constexpr (concepts::volume_accelerator<accel_type>) {
85- // Run over all the daughter volumes
86- // TODO: Implement e.g. BVH
87- }
88- }
89- };
90-
9171// / A functor to find surfaces in the neighborhood of a track position
9272template <typename functor_t >
9373struct neighborhood_getter {
@@ -96,30 +76,53 @@ struct neighborhood_getter {
9676 // / to a surface finder data structure
9777 template <concepts::accelerator_collection accel_coll_t ,
9878 typename accel_index_t , typename detector_t , typename track_t ,
99- typename config_t , typename ... Args>
79+ concepts::arithmetic window_size_t , typename ... Args>
10080 DETRAY_HOST_DEVICE inline void operator ()(
10181 const accel_coll_t &coll, const accel_index_t index,
10282 const detector_t &det, const typename detector_t ::volume_type &volume,
103- const track_t &track, const config_t &cfg ,
83+ const track_t &track, const search_window< window_size_t , 2 > &win_size ,
10484 const typename detector_t ::geometry_context &ctx,
10585 Args &&...args) const {
10686
87+ using accel_type = typename accel_coll_t ::value_type;
88+
10789 decltype (auto ) accel = coll[index];
10890
109- // Run over the surfaces in a single acceleration data structure
110- for (const auto &sf : accel.search (det, volume, track, cfg, ctx)) {
111- functor_t {}(sf, std::forward<Args>(args)...);
91+ if constexpr (concepts::surface_accelerator<accel_type>) {
92+ // Run over the surfaces in a single acceleration data structure
93+ for (const auto &sf :
94+ accel.search (det, volume, track, win_size, ctx)) {
95+ functor_t {}(sf, std::forward<Args>(args)...);
96+ }
97+ } else if constexpr (concepts::volume_accelerator<accel_type>) {
98+ // Run over the daughter volumes in a single acceleration data
99+ // structure
100+ for (const dindex daughter_idx :
101+ accel.search (det, volume, track, win_size, ctx)) {
102+ functor_t {}(daughter_idx, std::forward<Args>(args)...);
103+ }
112104 }
113105 }
114106};
115107
116- // / Query the maximal number of candidates from the acceleration
117- struct n_candidates_getter {
108+ // / A functor to access the daughter volumes of a volume
109+ template <typename functor_t >
110+ struct volume_getter {
111+
112+ // / Call operator that forwards the functor call to all contained daughter
113+ // / volumes
118114 template <concepts::accelerator_collection accel_coll_t ,
119- typename accel_index_t >
120- DETRAY_HOST_DEVICE inline auto operator ()(const accel_coll_t &coll,
121- const accel_index_t index) const {
122- return coll[index].n_max_candidates ();
115+ typename accel_index_t , typename ... Args>
116+ DETRAY_HOST_DEVICE inline void operator ()(const accel_coll_t &,
117+ const accel_index_t ,
118+ Args &&...) const {
119+
120+ using accel_type = typename accel_coll_t ::value_type;
121+
122+ if constexpr (concepts::volume_accelerator<accel_type>) {
123+ // Run over all the daughter volumes
124+ // TODO: Implement e.g. BVH
125+ }
123126 }
124127};
125128
0 commit comments