Skip to content

Commit 945980f

Browse files
committed
remove python changes
1 parent d1cd2cc commit 945980f

27 files changed

+125
-1115
lines changed

core/include/detray/core/detector.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ class detector {
220220
inline const auto &volume(const point3_type &p) const {
221221
volume_type v_desc{};
222222
// Allow to call the volume search data structure
223-
v_desc.set_accel_link(geo_obj_ids::e_volume, 0u);
223+
v_desc.template set_accel_link<geo_obj_ids::e_volume>(
224+
accel::id::e_volume_brute_force, 0u);
224225
tracking_volume world{v_desc, *this};
225226

226227
const dindex volume_index =
@@ -328,12 +329,13 @@ class detector {
328329
/// Volume lookup in the volume acceleration data structures
329330
struct volume_search {
330331
///@TODO: Move this to a volume search grid type
331-
template <typename accel_group_t, typename accel_index_t>
332+
template <concepts::accelerator_collection accel_coll_t,
333+
typename accel_index_t>
332334
DETRAY_HOST_DEVICE inline dindex operator()(
333-
const accel_group_t &group, const accel_index_t index,
335+
const accel_coll_t &coll, const accel_index_t index,
334336
const point3_type &p) const {
335337

336-
const auto volume_accelerator = group[index];
338+
const auto volume_accelerator = coll[index];
337339

338340
// The 3D cylindrical volume search grid is concentric
339341
const transform3_type identity{};

core/include/detray/geometry/detail/volume_descriptor.hpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class volume_descriptor {
5252
/// surface store.
5353
///
5454
/// E.g. a 'portal' can be found under @c ID::e_portal in this link,
55-
/// and will then receive link to the @c brute_force_finder that holds the
55+
/// and will then receive link to the @c brute_force_searcher that holds the
5656
/// portals (the accelerator structure's id and index).
5757
using accel_link_type = dmulti_index<acc_link_t, ID::e_size>;
5858

@@ -68,6 +68,17 @@ class volume_descriptor {
6868
/// @param id id values that determines how to interpret the bounds.
6969
explicit constexpr volume_descriptor(const volume_id id) : m_id{id} {}
7070

71+
/// @returns true if the object ID corresponds to a surface
72+
static consteval bool is_surface_id(const object_id id) {
73+
return (id == object_id::e_portal || id == object_id::e_sensitive ||
74+
id == object_id::e_passive);
75+
}
76+
77+
/// @returns true if the object ID corresponds to a [daughter] volume
78+
static consteval bool is_volume_id(const object_id id) {
79+
return (id == object_id::e_volume);
80+
}
81+
7182
/// @returns the volume shape id, e.g. 'cylinder'
7283
DETRAY_HOST_DEVICE
7384
constexpr auto id() const -> volume_id { return m_id; }

core/include/detray/geometry/detail/volume_kernels.hpp

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,17 @@ template <typename functor_t>
5050
struct surface_getter {
5151

5252
/// Call operator that forwards the functor to all contained surfaces
53-
template <typename accel_group_t, typename accel_index_t, typename... Args>
54-
DETRAY_HOST_DEVICE inline void operator()(const accel_group_t &group,
53+
template <concepts::accelerator_collection accel_coll_t,
54+
typename accel_index_t, typename... Args>
55+
DETRAY_HOST_DEVICE inline void operator()(const accel_coll_t &coll,
5556
const accel_index_t index,
5657
Args &&... args) const {
5758

58-
using accel_type = typename accel_group_t::value_type;
59+
using accel_type = typename accel_coll_t::value_type;
5960

6061
if constexpr (concepts::surface_accelerator<accel_type>) {
6162
// Run over the surfaces in a single acceleration data structure
62-
for (const auto &sf : group[index].all()) {
63+
for (const auto &sf : coll[index].all()) {
6364
functor_t{}(sf, std::forward<Args>(args)...);
6465
}
6566
}
@@ -68,16 +69,17 @@ struct surface_getter {
6869

6970
/// A functor to access the daughter volumes of a volume
7071
template <typename functor_t>
71-
struct daughter_volume_getter {
72+
struct volume_getter {
7273

7374
/// Call operator that forwards the functor call to all contained daughter
7475
/// volumes
75-
template <typename accel_group_t, typename accel_index_t, typename... Args>
76-
DETRAY_HOST_DEVICE inline void operator()(const accel_group_t &group,
77-
const accel_index_t index,
78-
Args &&... args) const {
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 {
7981

80-
using accel_type = typename accel_group_t::value_type;
82+
using accel_type = typename accel_coll_t::value_type;
8183

8284
if constexpr (concepts::volume_accelerator<accel_type>) {
8385
// Run over all the daughter volumes
@@ -92,17 +94,17 @@ struct neighborhood_getter {
9294

9395
/// Call operator that forwards the neighborhood search call in a volume
9496
/// to a surface finder data structure
95-
template <typename accel_group_t, typename accel_index_t,
96-
typename detector_t, typename track_t, typename config_t,
97-
typename... Args>
97+
template <concepts::accelerator_collection accel_coll_t,
98+
typename accel_index_t, typename detector_t, typename track_t,
99+
typename config_t, typename... Args>
98100
DETRAY_HOST_DEVICE inline void operator()(
99-
const accel_group_t &group, const accel_index_t index,
101+
const accel_coll_t &coll, const accel_index_t index,
100102
const detector_t &det, const typename detector_t::volume_type &volume,
101103
const track_t &track, const config_t &cfg,
102104
const typename detector_t::geometry_context &ctx,
103105
Args &&... args) const {
104106

105-
decltype(auto) accel = group[index];
107+
decltype(auto) accel = coll[index];
106108

107109
// Run over the surfaces in a single acceleration data structure
108110
for (const auto &sf : accel.search(det, volume, track, cfg, ctx)) {
@@ -113,10 +115,11 @@ struct neighborhood_getter {
113115

114116
/// Query the maximal number of candidates from the acceleration
115117
struct n_candidates_getter {
116-
template <typename accel_group_t, typename accel_index_t>
117-
DETRAY_HOST_DEVICE inline auto operator()(const accel_group_t &group,
118+
template <concepts::accelerator_collection accel_coll_t,
119+
typename accel_index_t>
120+
DETRAY_HOST_DEVICE inline auto operator()(const accel_coll_t &coll,
118121
const accel_index_t index) const {
119-
return group[index].n_max_candidates();
122+
return coll[index].n_max_candidates();
120123
}
121124
};
122125

core/include/detray/geometry/tracking_volume.hpp

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,6 @@ class tracking_volume {
6868
constexpr tracking_volume(const detector_t &det, const dindex vol_idx)
6969
: tracking_volume(det, det.volume(vol_idx)) {}
7070

71-
/// @returns true if the object ID corresponds to a surface
72-
static consteval bool is_surface_id(const object_id id) {
73-
return (id == object_id::e_portal || id == object_id::e_sensitive ||
74-
id == object_id::e_passive);
75-
}
76-
77-
/// @returns true if the object ID corresponds to a [daughter] volume
78-
static consteval bool is_volume_id(const object_id id) {
79-
return (id == object_id::e_volume);
80-
}
81-
8271
/// @returns access to the underlying detector
8372
DETRAY_HOST_DEVICE
8473
auto detector() const -> const detector_t & { return m_detector; }
@@ -160,21 +149,16 @@ class tracking_volume {
160149

161150
if (const auto &link{m_desc.template accel_link<I>()};
162151
!link.is_invalid()) {
163-
if constexpr (tracking_volume::is_surface_id(I)) {
164-
// Run over the surfaces in a single acceleration data structure
165-
// and apply the functor to the resulting neighborhood
166-
m_detector.accelerator_store().template visit<functor_t>(
167-
link, std::forward<Args>(args)...);
168-
} else {
169-
// TODO: Call volume accelerator to find daughter volumes
170-
// [...]
171-
}
152+
// Run over the surfaces in a single acceleration data structure
153+
// and apply the functor to the resulting neighborhood
154+
m_detector.accelerator_store().template visit<functor_t>(
155+
link, std::forward<Args>(args)...);
172156
}
173157
}
174158

175159
/// Apply a functor to all acceleration structures of this volume.
176160
///
177-
/// @tparam I type of object to retrieve (passive, portal, sensitive etc)
161+
/// @tparam I type of object to retrieve (surface types, daughters etc)
178162
/// @tparam functor_t the prescription to be applied to the acc structure
179163
/// @tparam Args types of additional arguments to the functor
180164
template <typename functor_t,
@@ -195,6 +179,8 @@ class tracking_volume {
195179
/// Apply a functor to all surfaces of a given surface id (portal, passive,
196180
/// sensitive) in the volume
197181
///
182+
/// Translates the detray surface type id to the volume geometry object id
183+
///
198184
/// @tparam functor_t the prescription to be applied to the surfaces
199185
/// @tparam Args types of additional arguments to the functor
200186
template <surface_id I, typename functor_t, typename... Args>
@@ -231,8 +217,25 @@ class tracking_volume {
231217
}
232218
}
233219

234-
/// Apply a functor to a neighborhood of surfaces around a track position
235-
/// in the volume.
220+
/// Apply a functor to all daughter volumes
221+
///
222+
/// @tparam functor_t the prescription to be applied to the daughter volumes
223+
/// @tparam Args types of additional arguments to the functor
224+
template <surface_id I, typename functor_t, typename... Args>
225+
DETRAY_HOST_DEVICE constexpr void visit_daughter_volumes(
226+
Args &&... args) const {
227+
using volume_getter_t = detail::volume_getter<functor_t>;
228+
229+
visit_accelerator<object_id::e_volume, volume_getter_t>(
230+
std::forward<Args>(args)...);
231+
}
232+
233+
/// Apply a functor to a neighborhood of geometric objects around a
234+
/// track position in the volume.
235+
///
236+
/// @note: The acceleration structures in the volume might return different
237+
/// geometric objects (e.g. surfaces vs. volumes). The passed functor must
238+
/// provide corresponding overloads of the call operator.
236239
///
237240
/// @tparam functor_t the prescription to be applied to the surfaces (
238241
/// customization point for the navigation)

core/include/detray/navigation/accelerators/brute_force_finder.hpp renamed to core/include/detray/navigation/accelerators/brute_force_searcher.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class brute_force_collection {
4545
: public detray::ranges::subrange<const vector_type<value_t>> {
4646

4747
using base = detray::ranges::subrange<const vector_type<value_t>>;
48+
using value_type = value_t;
4849

4950
/// Default constructor
5051
brute_forcer() = default;

core/include/detray/navigation/accelerators/concepts.hpp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#pragma once
99

1010
// Project include(s)
11+
#include "detray/core/detail/container_buffers.hpp"
12+
#include "detray/core/detail/container_views.hpp"
1113
#include "detray/definitions/indexing.hpp"
1214
#include "detray/geometry/detail/surface_descriptor.hpp"
1315
#include "detray/utils/concepts.hpp"
@@ -27,7 +29,23 @@ concept accelerator = requires(const A acc) {
2729

2830
// Iterate through all contained geometry objects
2931
{ acc.all() }
30-
->detray::ranges::range_of<typename A::value_type>;
32+
->ranges::range_of<typename A::value_type>;
33+
34+
// TODO: In order to require the search method, we need to pass a detector
35+
// which is auto-deduced
36+
};
37+
38+
/// Concept for a collection of accelerator (data) that can be stored in the
39+
/// detector
40+
template <class AC>
41+
concept accelerator_collection = viewable<AC>&& bufferable<AC>&& requires(
42+
const AC accel_coll, unsigned int idx) {
43+
44+
typename AC::size_type;
45+
requires concepts::accelerator<typename AC::value_type>;
46+
47+
{ accel_coll[idx] }
48+
->concepts::accelerator;
3149
};
3250

3351
/// Acceleration structure that contains surfaces (surface descriptors)
@@ -48,11 +66,11 @@ concept volume_accelerator =
4866
/// Brute force acceleration structures
4967
/// @{
5068
template <class A>
51-
concept brute_force_surface_finder =
69+
concept brute_force_surface_searcher =
5270
!concepts::grid<A> && concepts::volume_accelerator<A>;
5371

5472
template <class A>
55-
concept brute_force_volume_finder =
73+
concept brute_force_volume_searcher =
5674
!concepts::grid<A> && concepts::surface_accelerator<A>;
5775
/// @}
5876

core/include/detray/navigation/accelerators/accelerator_grid.hpp renamed to core/include/detray/navigation/accelerators/grid_searcher.hpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,22 @@
1010
// Project include(s)
1111
#include "detray/geometry/detail/surface_descriptor.hpp"
1212
#include "detray/utils/grid/detail/axis_helpers.hpp"
13-
#include "detray/utils/grid/detail/grid_bins.hpp"
1413
#include "detray/utils/grid/detail/bin_view.hpp"
14+
#include "detray/utils/grid/detail/grid_bins.hpp"
1515
#include "detray/utils/grid/grid.hpp"
1616
#include "detray/utils/grid/grid_collection.hpp"
1717

1818
namespace detray {
1919

2020
/// @brief An N-dimensional spacial grid for geometry object searches.
21-
///
22-
/// @tparam value_t Type of values contained in the grid
2321
template <typename axes_t, typename bin_t,
2422
template <std::size_t> class serializer_t = simple_serializer>
25-
class accelerator_grid_impl : public grid_impl<axes_t, bin_t, serializer_t> {
23+
class grid_searcher_impl : public grid_impl<axes_t, bin_t, serializer_t> {
2624

2725
using base_grid = grid_impl<axes_t, bin_t, serializer_t>;
2826

2927
public:
30-
/// Adopt type definitions and static variables
28+
/// Adopt type definitions and static variables of the underlying grid
3129
/// @{
3230
template <typename neighbor_t>
3331
using neighborhood_type = darray<neighbor_t, base_grid::dim>;
@@ -56,8 +54,8 @@ class accelerator_grid_impl : public grid_impl<axes_t, bin_t, serializer_t> {
5654

5755
/// Find the corresponding (non-)owning grid type
5856
template <bool owning>
59-
using type =
60-
accelerator_grid_impl<typename axes_t::template type<owning>, bin_t, serializer_t>;
57+
using type = grid_searcher_impl<typename axes_t::template type<owning>,
58+
bin_t, serializer_t>;
6159
/// @}
6260

6361
/// Use all of the grid constructors
@@ -117,12 +115,11 @@ class accelerator_grid_impl : public grid_impl<axes_t, bin_t, serializer_t> {
117115
}
118116
};
119117

120-
/// Type alias for easier construction
121118
template <concepts::algebra algebra_t, typename axes_t, typename bin_t,
122119
template <std::size_t> class serializer_t = simple_serializer,
123120
typename containers = host_container_types, bool ownership = true>
124-
using accelerator_grid =
125-
accelerator_grid_impl<coordinate_axes<axes_t, algebra_t, ownership, containers>, bin_t,
126-
simple_serializer>;
121+
using grid_searcher = grid_searcher_impl<
122+
coordinate_axes<axes_t, algebra_t, ownership, containers>, bin_t,
123+
simple_serializer>;
127124

128-
} // namespace detray
125+
} // namespace detray

detectors/include/detray/detectors/default_metadata.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
#include "detray/materials/material_map.hpp"
2222
#include "detray/materials/material_rod.hpp"
2323
#include "detray/materials/material_slab.hpp"
24-
#include "detray/navigation/accelerators/accelerator_grid.hpp"
25-
#include "detray/navigation/accelerators/brute_force_finder.hpp"
24+
#include "detray/navigation/accelerators/brute_force_searcher.hpp"
25+
#include "detray/navigation/accelerators/grid_searcher.hpp"
2626

2727
namespace detray {
2828

@@ -110,8 +110,8 @@ struct default_metadata {
110110
// surface grid definition: bin-content: darray<surface_type, 9>
111111
template <typename axes_t, typename bin_entry_t, typename container_t>
112112
using surface_grid_t =
113-
accelerator_grid<algebra_type, axes_t, bins::dynamic_array<bin_entry_t>,
114-
simple_serializer, container_t, false>;
113+
grid_searcher<algebra_type, axes_t, bins::dynamic_array<bin_entry_t>,
114+
simple_serializer, container_t, false>;
115115

116116
// 2D cylindrical grid for the barrel layers
117117
template <typename bin_entry_t, typename container_t>
@@ -270,11 +270,11 @@ unbounded_cell, unmasked_plane*/>;
270270
/// Volume search grid
271271
template <typename container_t = host_container_types>
272272
using volume_accelerator =
273-
accelerator_grid<algebra_type,
274-
axes<cylinder3D, axis::bounds::e_open, axis::irregular,
275-
axis::regular, axis::irregular>,
276-
bins::single<dindex>, simple_serializer, container_t,
277-
false>;
273+
grid_searcher<algebra_type,
274+
axes<cylinder3D, axis::bounds::e_open, axis::irregular,
275+
axis::regular, axis::irregular>,
276+
bins::single<dindex>, simple_serializer, container_t,
277+
false>;
278278

279279
/// How to store the acceleration data structures
280280
template <typename container_t = host_container_types>

detectors/include/detray/detectors/itk_metadata.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
#include "detray/geometry/shapes/ring2D.hpp"
2222
#include "detray/materials/material_map.hpp"
2323
#include "detray/materials/material_slab.hpp"
24-
#include "detray/navigation/accelerators/accelerator_grid.hpp"
25-
#include "detray/navigation/accelerators/brute_force_finder.hpp"
24+
#include "detray/navigation/accelerators/brute_force_searcher.hpp"
25+
#include "detray/navigation/accelerators/grid_searcher.hpp"
2626

2727
// Linear algebra types
2828
#include "detray/definitions/algebra.hpp"
@@ -160,10 +160,11 @@ struct itk_metadata {
160160
/// given position. Here: Uniform grid with a 3D cylindrical shape
161161
template <typename container_t = host_container_types>
162162
using volume_accelerator =
163-
grid<algebra_type,
164-
axes<cylinder3D, axis::bounds::e_open, axis::irregular,
165-
axis::regular, axis::irregular>,
166-
bins::single<dindex>, simple_serializer, container_t, false>;
163+
grid_searcher<algebra_type,
164+
axes<cylinder3D, axis::bounds::e_open, axis::irregular,
165+
axis::regular, axis::irregular>,
166+
bins::single<dindex>, simple_serializer, container_t,
167+
false>;
167168

168169
/// The tuple store that hold the acceleration data structures for all
169170
/// volumes. Every collection of accelerationdata structures defines its

0 commit comments

Comments
 (0)