Skip to content

Commit 035a8e2

Browse files
committed
Fix compilation
1 parent 8cbf3bf commit 035a8e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+876
-696
lines changed

core/include/detray/builders/bin_fillers.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
// Project include(s).
1111
#include "detray/builders/detail/bin_association.hpp"
12-
#include "detray/navigation/accelerators/concepts.hpp"
1312
#include "detray/utils/grid/detail/axis.hpp"
1413
#include "detray/utils/grid/detail/concepts.hpp"
1514
#include "detray/utils/grid/populators.hpp"

core/include/detray/builders/detector_builder.hpp

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
/** Detray library, part of the ACTS project (R&D line)
22
*
3-
* (c) 2023 CERN for the benefit of the ACTS project
3+
* (c) 2023-2025 CERN for the benefit of the ACTS project
44
*
55
* Mozilla Public License Version 2.0
66
*/
77

88
#pragma once
99

1010
// Project include(s).
11-
#include "detray/builders/grid_factory.hpp"
1211
#include "detray/builders/volume_builder.hpp"
1312
#include "detray/builders/volume_builder_interface.hpp"
1413
#include "detray/core/detector.hpp"
15-
#include "detray/definitions/geometry.hpp"
16-
#include "detray/utils/grid/detail/concepts.hpp"
17-
#include "detray/utils/type_traits.hpp"
1814

1915
// Vecmem include(s)
2016
#include <vecmem/memory/memory_resource.hpp>
@@ -30,7 +26,6 @@ namespace detray {
3026
/// @brief Provides functionality to build a detray detector volume by volume
3127
///
3228
/// @tparam metadata the type definitions for the detector
33-
/// @tparam bfield_bknd_t the type of magnetic field to be used
3429
/// @tparam volume_builder_t the basic volume builder to be used for the
3530
/// geometry data
3631
/// @tparam volume_data_t the data structure that holds the volume builders
@@ -141,48 +136,12 @@ class detector_builder {
141136
return build(resource);
142137
}
143138

144-
/// Put the volumes into a search data structure
145-
/*template <typename... Args>
146-
DETRAY_HOST void set_volume_accelerator([[maybe_unused]] Args&&... args) {
147-
148-
using vol_finder_t = typename detector_type::volume_accelerator;
149-
150-
// Add dummy volume grid for now
151-
if constexpr (concepts::grid<vol_finder_t>) {
152-
153-
// TODO: Construct it correctly with the grid builder
154-
mask<cylinder3D, algebra_type> vgrid_dims{
155-
0u, 0.f, -constant<scalar_type>::pi,
156-
-2000.f, 180.f, constant<scalar_type>::pi,
157-
2000.f};
158-
darray<std::size_t, 3> n_vgrid_bins{1u, 1u, 1u};
159-
160-
darray<std::vector<scalar_type>, 3UL> bin_edges{
161-
std::vector<scalar_type>{0.f, 180.f},
162-
std::vector<scalar_type>{-constant<scalar_type>::pi,
163-
constant<scalar_type>::pi},
164-
std::vector<scalar_type>{-2000.f, 2000.f}};
165-
166-
grid_factory_type<vol_finder_t> vgrid_factory{};
167-
m_vol_finder = vgrid_factory.template new_grid<
168-
axis::open<axis::label::e_r>,
169-
axis::circular<axis::label::e_phi>,
170-
axis::open<axis::label::e_z>, axis::irregular<scalar_type>,
171-
axis::regular<scalar_type>, axis::irregular<scalar_type>>(
172-
vgrid_dims, n_vgrid_bins, {}, bin_edges);
173-
} else {
174-
m_vol_finder = vol_finder_t{args...};
175-
}
176-
}*/
177-
178139
private:
179140
/// Name of the new detector
180141
std::string m_detector_name{"detray_detector"};
181142
/// Data structure that holds a volume builder for every detector volume
182143
volume_data_t<std::unique_ptr<volume_builder_interface<detector_type>>>
183144
m_volumes{};
184-
/// Data structure to find volumes
185-
// typename detector_type::volume_accelerator m_vol_finder{};
186145
};
187146

188147
} // namespace detray

core/include/detray/builders/grid_builder.hpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include "detray/builders/volume_builder.hpp"
1515
#include "detray/builders/volume_builder_interface.hpp"
1616
#include "detray/geometry/tracking_volume.hpp"
17+
#include "detray/navigation/accelerators/concepts.hpp"
18+
#include "detray/navigation/accelerators/spatial_grid.hpp"
1719
#include "detray/utils/grid/detail/concepts.hpp"
1820

1921
// System include(s)
@@ -40,7 +42,7 @@ class grid_builder : public volume_decorator<detector_t> {
4042
using value_type = typename detector_type::surface_type;
4143
using scalar_type = dscalar<algebra_type>;
4244

43-
/// Decorate a volume with a grid
45+
/// Decorate a volume with a surface accelerator grid
4446
DETRAY_HOST
4547
explicit grid_builder(
4648
std::unique_ptr<volume_builder_interface<detector_t>> vol_builder)
@@ -58,13 +60,13 @@ class grid_builder : public volume_decorator<detector_t> {
5860
}
5961

6062
/// Set the surface category this grid should contain (type id in the
61-
/// accelrator link in the volume)
63+
/// accelerator link in the volume descriptor)
6264
void set_type(std::size_t sf_id) {
6365
set_type(static_cast<link_id_t>(sf_id));
6466
}
6567

6668
/// Set the surface category this grid should contain (type id in the
67-
/// accelrator link in the volume)
69+
/// accelerator link in the volume descriptor)
6870
void set_type(link_id_t sf_id) {
6971
// Exclude zero, it is reserved for the brute force method
7072
assert(static_cast<int>(sf_id) > 0);
@@ -182,11 +184,19 @@ class grid_builder : public volume_decorator<detector_t> {
182184
}
183185
}
184186

185-
// Add the grid to the detector and link it to its volume
186-
constexpr auto gid{detector_t::accel::template get_id<grid_t>()};
187+
// Is the given grid type already an acceleration structure?
188+
using spatial_grid_t =
189+
std::conditional_t<concepts::surface_accelerator<grid_t>, grid_t,
190+
spatial_grid_impl<grid_t>>;
191+
constexpr auto gid{
192+
detector_t::accel::template get_id<spatial_grid_t>()};
193+
const dindex grid_idx{det.accelerator_store().template size<gid>()};
194+
195+
// Set: contained surface type, grid type, grid instance index
196+
vol_ptr->set_link(m_id, gid, grid_idx);
197+
198+
// Add to detector
187199
det._accelerators.template push_back<gid>(m_grid);
188-
vol_ptr->set_link(m_id, gid,
189-
det.accelerator_store().template size<gid>() - 1);
190200

191201
return vol_ptr;
192202
}
@@ -198,6 +208,7 @@ class grid_builder : public volume_decorator<detector_t> {
198208
private:
199209
link_id_t m_id{link_id_t::e_sensitive};
200210
grid_factory_t m_factory{};
211+
// Data owning grid type, so that surface data can be filled into memory
201212
typename grid_t::template type<true> m_grid{};
202213
bin_filler_t m_bin_filler{};
203214
bool m_add_passives{false};

core/include/detray/builders/surface_factory.hpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,12 @@ class surface_factory : public surface_factory_interface<detector_t> {
162162
return {surfaces_offset, surfaces_offset};
163163
}
164164

165-
constexpr auto mask_id = detector_t::masks::template get_id<
166-
mask<mask_shape_t, algebra_t, volume_link_t>>();
167-
if constexpr (static_cast<std::size_t>(mask_id) >=
168-
detector_t::masks::n_types) {
165+
using mask_t = mask<mask_shape_t, algebra_t, volume_link_t>;
166+
if constexpr (!detector_t::masks::template is_defined<mask_t>()) {
169167

170168
throw std::invalid_argument(
171-
"ERROR: Cannot match shape type to mask ID: Found " +
172-
std::string(mask_shape_t::name) + " at mask id " +
173-
std::to_string(static_cast<std::size_t>(mask_id)));
169+
"ERROR: Cannot match shape type to mask ID. Shape type: " +
170+
std::string(mask_shape_t::name));
174171

175172
} else {
176173

@@ -180,6 +177,8 @@ class surface_factory : public surface_factory_interface<detector_t> {
180177

181178
// The material will be added in a later step
182179
constexpr auto no_material{surface_t::material_id::e_none};
180+
constexpr auto mask_id =
181+
detector_t::masks::template get_id<mask_t>();
183182

184183
for (const auto [idx, bounds_per_mask] :
185184
detray::views::enumerate(m_bounds)) {

core/include/detray/core/detail/alignment.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ typename host_detector_type::view_type misaligned_detector_view(
2525
detray::get_data(
2626
detray::detail::get<4>(det_buffer.m_buffer)), // materials
2727
detray::get_data(
28-
detray::detail::get<5>(det_buffer.m_buffer)), // accelerators
29-
detray::get_data(detray::detail::get<6>(
30-
det_buffer.m_buffer))}; // volume search grid
28+
detray::detail::get<5>(det_buffer.m_buffer))}; // accelerators
3129
return detview;
3230
}
3331

core/include/detray/core/detail/multi_store.hpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "detray/core/detail/tuple_container.hpp"
1515
#include "detray/definitions/detail/qualifiers.hpp"
1616
#include "detray/definitions/indexing.hpp"
17-
#include "detray/utils/type_list.hpp"
1817
#include "detray/utils/type_registry.hpp"
1918
#include "detray/utils/type_traits.hpp"
2019

@@ -29,13 +28,11 @@ namespace detray {
2928
/// @brief Wraps a vecmem enabled tuple and adds functionality to handle data
3029
/// collections @tparam Ts.
3130
///
32-
/// @tparam An enum of type IDs that needs to match the value types of the
33-
/// @tparam Ts pack.
31+
/// @tparam An enum of type IDs that needs to match the value types of the Ts
32+
/// pack.
3433
/// @tparam context_t How to retrieve data according to e.g. conditions data
3534
/// @tparam tuple_t The type of the underlying tuple container.
36-
/// @tparam container_t The type of container to use for the respective
37-
/// data collections.
38-
/// @tparam Ts the data types (value types of the collections)
35+
/// @tparam Ts the data collection types
3936
template <typename ID = std::size_t, typename context_t = empty_context,
4037
template <typename...> class tuple_t = dtuple, typename... Ts>
4138
class multi_store {
@@ -53,10 +50,8 @@ class multi_store {
5350
/// How to find and index a data collection in the store
5451
/// @{
5552
using ids = ID;
56-
template <typename index_t>
57-
using link_type = dtyped_index<ID, index_t>;
58-
using single_link = link_type<dindex>;
59-
using range_link = link_type<index_range_t>;
53+
using single_link = dtyped_index<ID, dindex>;
54+
using range_link = dtyped_index<ID, index_range_t>;
6055
/// @}
6156

6257
/// Allow matching between IDs and collection value types
@@ -387,7 +382,7 @@ class multi_store {
387382
tuple_type m_tuple_container;
388383
};
389384

390-
/// Helper type for a data store that uses a sinlge collection container
385+
/// Helper type for a data store that uses a single collection container
391386
template <typename ID, typename context_t, template <typename...> class tuple_t,
392387
template <typename...> class container_t, typename... Ts>
393388
using regular_multi_store =

core/include/detray/core/detail/single_store.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ class single_store {
4343

4444
/// How to find data in the store
4545
/// @{
46-
using link_type = dindex;
4746
using single_link = dindex;
4847
using range_link = dindex_range;
4948
/// @}

core/include/detray/core/detector.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,17 @@ class detector {
220220

221221
/// @return the volume by global cartesian @param position - const access
222222
DETRAY_HOST_DEVICE
223-
inline const auto &volume(const point3_type &p) const {
223+
inline const auto &volume(const point3_type & /*p*/) const {
224224
volume_type v_desc{};
225225
// Allow to call the volume search data structure
226226
v_desc.template set_accel_link<geo_obj_ids::e_volume>(
227-
accel::id::e_volume_brute_force, 0u);
228-
tracking_volume world{v_desc, *this};
227+
accel::id::e_default_volume_searcher, 0u);
228+
tracking_volume world{*this, v_desc};
229229

230-
const dindex volume_index =
230+
const dindex volume_index{0u};
231+
/*const dindex volume_index =
231232
world.template visit_accelerator<geo_obj_ids::e_volume,
232-
volume_search>(p);
233+
volume_search>(p);*/
233234
return _volumes[volume_index];
234235
}
235236

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

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
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

1920
namespace 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
9272
template <typename functor_t>
9373
struct neighborhood_getter {
@@ -96,30 +76,46 @@ 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+
}
11297
}
11398
}
11499
};
115100

116-
/// Query the maximal number of candidates from the acceleration
117-
struct n_candidates_getter {
101+
/// A functor to access the daughter volumes of a volume
102+
template <typename functor_t>
103+
struct volume_getter {
104+
105+
/// Call operator that forwards the functor call to all contained daughter
106+
/// volumes
118107
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();
108+
typename accel_index_t, typename... Args>
109+
DETRAY_HOST_DEVICE inline void operator()(const accel_coll_t &,
110+
const accel_index_t,
111+
Args &&...) const {
112+
113+
using accel_type = typename accel_coll_t::value_type;
114+
115+
if constexpr (concepts::volume_accelerator<accel_type>) {
116+
// Run over all the daughter volumes
117+
// TODO: Implement e.g. BVH
118+
}
123119
}
124120
};
125121

0 commit comments

Comments
 (0)