Skip to content

Commit a0fe7b1

Browse files
committed
Split the surface implementation
1 parent e3724d6 commit a0fe7b1

Some content is hidden

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

43 files changed

+468
-362
lines changed

core/include/detray/builders/detail/portal_accessor.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "detray/definitions/detail/qualifiers.hpp"
1313
#include "detray/geometry/shapes/cylinder2D.hpp"
1414
#include "detray/geometry/shapes/ring2D.hpp"
15-
#include "detray/geometry/tracking_surface.hpp"
15+
#include "detray/geometry/surface.hpp"
1616
#include "detray/geometry/tracking_volume.hpp"
1717

1818
// System include(s).
@@ -37,7 +37,7 @@ auto get_cylinder_portals(const tracking_volume<detector_t> &vol) {
3737

3838
// Loop over all portals
3939
for (const auto &pt_desc : vol.portals()) {
40-
auto pt = tracking_surface{vol.detector(), pt_desc};
40+
auto pt = geometry::surface{vol.detector(), pt_desc};
4141
const std::string name = pt.shape_name();
4242

4343
if (name == "cylinder2D" || name == "concentric_cylinder2D") {

core/include/detray/builders/grid_builder.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "detray/builders/surface_factory_interface.hpp"
1414
#include "detray/builders/volume_builder.hpp"
1515
#include "detray/builders/volume_builder_interface.hpp"
16-
#include "detray/geometry/tracking_surface.hpp"
1716
#include "detray/geometry/tracking_volume.hpp"
1817
#include "detray/utils/grid/detail/concepts.hpp"
1918

core/include/detray/builders/material_map_builder.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "detray/builders/material_map_generator.hpp"
1414
#include "detray/builders/surface_factory_interface.hpp"
1515
#include "detray/builders/volume_builder_interface.hpp"
16-
#include "detray/geometry/tracking_surface.hpp"
16+
#include "detray/geometry/surface.hpp"
1717
#include "detray/materials/material_map.hpp"
1818

1919
// System include(s)
@@ -125,7 +125,7 @@ class material_map_builder final : public volume_decorator<detector_t> {
125125
}
126126

127127
// Construct and append the material map for a given surface shape
128-
auto sf = tracking_surface{det, sf_desc};
128+
auto sf = geometry::surface{det, sf_desc};
129129
[[maybe_unused]] auto [mat_id, mat_idx] = sf.template visit_mask<
130130
detail::add_sf_material_map<materials_t>>(
131131
m_factory, m_bin_data.at(sf_idx), m_n_bins.at(sf_idx),

core/include/detray/builders/volume_builder.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "detray/builders/surface_factory_interface.hpp"
1212
#include "detray/builders/volume_builder_interface.hpp"
1313
#include "detray/definitions/geometry.hpp"
14-
#include "detray/geometry/tracking_surface.hpp"
14+
#include "detray/geometry/surface.hpp"
1515
#include "detray/utils/grid/detail/concepts.hpp"
1616

1717
// System include(s)
@@ -210,7 +210,7 @@ class volume_builder : public volume_builder_interface<detector_t> {
210210
std::size_t n_portals{0u};
211211
for (auto& sf_desc : m_surfaces) {
212212

213-
const auto sf = tracking_surface{det, sf_desc};
213+
const auto sf = geometry::surface{det, sf_desc};
214214

215215
sf.template visit_mask<detail::mask_index_update>(sf_desc);
216216
sf_desc.set_volume(m_volume.index());

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace detray::detail {
1717
/// @return the opening angle of a chord the size of tol (= 2*arcsin(c/(2r)))
1818
/// using a small angle approximation
1919
template <typename scalar_t>
20-
inline constexpr scalar_t phi_tolerance(scalar_t tol, scalar_t radius) {
20+
constexpr scalar_t phi_tolerance(scalar_t tol, scalar_t radius) {
2121
return tol / radius;
2222
}
2323

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

+1-111
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88
#pragma once
99

1010
// Project include(s)
11+
#include "detray/definitions/detail/algebra.hpp"
1112
#include "detray/definitions/detail/indexing.hpp"
1213
#include "detray/definitions/detail/qualifiers.hpp"
1314
#include "detray/materials/detail/concepts.hpp"
1415
#include "detray/materials/detail/material_accessor.hpp"
1516
#include "detray/materials/material.hpp"
16-
#include "detray/propagator/detail/jacobian_engine.hpp"
17-
#include "detray/tracks/detail/transform_track_parameters.hpp"
18-
#include "detray/tracks/tracks.hpp"
1917

2018
// System include(s)
2119
#include <limits>
@@ -33,9 +31,6 @@ struct surface_kernels {
3331
using point3_type = dpoint3D<algebra_t>;
3432
using vector3_type = dvector3D<algebra_t>;
3533
using transform3_type = dtransform3D<algebra_t>;
36-
using bound_param_vector_type = bound_parameters_vector<algebra_t>;
37-
using free_param_vector_type = free_parameters_vector<algebra_t>;
38-
using free_matrix_type = free_matrix<algebra_t>;
3934

4035
/// A functor to retrieve the masks shape name
4136
struct get_shape_name {
@@ -211,111 +206,6 @@ struct surface_kernels {
211206
}
212207
};
213208

214-
/// A functor to get from a free to a bound vector
215-
struct free_to_bound_vector {
216-
217-
// Visitor to the detector mask store that is called on the mask
218-
// collection that contains the mask (shape) type of the surface
219-
template <typename mask_group_t, typename index_t>
220-
DETRAY_HOST_DEVICE inline bound_param_vector_type operator()(
221-
const mask_group_t& /*mask_group*/, const index_t& /*index*/,
222-
const transform3_type& trf3,
223-
const free_param_vector_type& free_vec) const {
224-
225-
using frame_t = typename mask_group_t::value_type::local_frame;
226-
227-
return detail::free_to_bound_vector<frame_t>(trf3, free_vec);
228-
}
229-
};
230-
231-
/// A functor to get from a bound to a free vector
232-
struct bound_to_free_vector {
233-
234-
template <typename mask_group_t, typename index_t>
235-
DETRAY_HOST_DEVICE inline free_param_vector_type operator()(
236-
const mask_group_t& mask_group, const index_t& index,
237-
const transform3_type& trf3,
238-
const bound_param_vector_type& bound_vec) const {
239-
240-
return detail::bound_to_free_vector(trf3, mask_group[index],
241-
bound_vec);
242-
}
243-
};
244-
245-
/// A functor to get the free-to-bound Jacobian
246-
struct free_to_bound_jacobian {
247-
248-
template <typename mask_group_t, typename index_t>
249-
DETRAY_HOST_DEVICE inline auto operator()(
250-
const mask_group_t& /*mask_group*/, const index_t& /*index*/,
251-
const transform3_type& trf3,
252-
const free_param_vector_type& free_vec) const {
253-
254-
using frame_t = typename mask_group_t::value_type::local_frame;
255-
256-
return detail::jacobian_engine<frame_t>::free_to_bound_jacobian(
257-
trf3, free_vec);
258-
}
259-
};
260-
261-
/// A functor to get the bound-to-free Jacobian
262-
struct bound_to_free_jacobian {
263-
264-
template <typename mask_group_t, typename index_t>
265-
DETRAY_HOST_DEVICE inline auto operator()(
266-
const mask_group_t& mask_group, const index_t& index,
267-
const transform3_type& trf3,
268-
const bound_param_vector_type& bound_vec) const {
269-
270-
using frame_t = typename mask_group_t::value_type::local_frame;
271-
272-
return detail::jacobian_engine<frame_t>::bound_to_free_jacobian(
273-
trf3, mask_group[index], bound_vec);
274-
}
275-
};
276-
277-
/// A functor to get the path correction
278-
struct path_correction {
279-
280-
template <typename mask_group_t, typename index_t, typename scalar_t>
281-
DETRAY_HOST_DEVICE inline free_matrix_type operator()(
282-
const mask_group_t& /*mask_group*/, const index_t& /*index*/,
283-
const transform3_type& trf3, const vector3_type& pos,
284-
const vector3_type& dir, const vector3_type& dtds,
285-
const scalar_t dqopds) const {
286-
287-
using frame_t = typename mask_group_t::value_type::local_frame;
288-
289-
return detail::jacobian_engine<frame_t>::path_correction(
290-
pos, dir, dtds, dqopds, trf3);
291-
}
292-
};
293-
294-
/// A functor to get the local min bounds.
295-
struct local_min_bounds {
296-
297-
template <typename mask_group_t, typename index_t, typename scalar_t>
298-
DETRAY_HOST_DEVICE inline auto operator()(
299-
const mask_group_t& mask_group, const index_t& index,
300-
const scalar_t env =
301-
std::numeric_limits<scalar_t>::epsilon()) const {
302-
303-
return mask_group[index].local_min_bounds(env);
304-
}
305-
};
306-
307-
/// A functor to get the minimum distance to any surface boundary.
308-
struct min_dist_to_boundary {
309-
310-
template <typename mask_group_t, typename index_t, typename point_t>
311-
DETRAY_HOST_DEVICE inline auto operator()(
312-
const mask_group_t& mask_group, const index_t& index,
313-
const point_t& loc_p) const {
314-
315-
return mask_group[index].min_dist_to_boundary(loc_p);
316-
}
317-
};
318-
319209
/// A functor to get the vertices in local coordinates.
320210
struct local_vertices {
321211

0 commit comments

Comments
 (0)