diff --git a/core/include/detray/geometry/detail/surface_kernels.hpp b/core/include/detray/geometry/detail/surface_kernels.hpp index 77ba8cb880..3dc36106a9 100644 --- a/core/include/detray/geometry/detail/surface_kernels.hpp +++ b/core/include/detray/geometry/detail/surface_kernels.hpp @@ -43,7 +43,7 @@ struct surface_kernels { DETRAY_HOST_DEVICE inline auto operator()( const mask_group_t& mask_group, const index_t& index) const { - return mask_group.at(index).volume_link(); + return mask_group[index].volume_link(); } }; @@ -64,7 +64,7 @@ struct surface_kernels { DETRAY_HOST_DEVICE inline point3 operator()( const mask_group_t& mask_group, const index_t& index, const transform3& trf3, const point2& bound) const { - // Get the concrete mask instance for this surface + const auto& m = mask_group[index]; return m.local_frame().normal(trf3, bound, m); @@ -114,6 +114,7 @@ struct surface_kernels { const mask_group_t& mask_group, const index_t& index, const transform3& trf3, const point2& bound, const vector3& dir) const { + const auto& m = mask_group[index]; return mask_group[index].local_frame().bound_local_to_global( @@ -138,10 +139,9 @@ struct surface_kernels { DETRAY_HOST_DEVICE inline bound_vector_type operator()( const mask_group_t& mask_group, const index_t& index, const transform3& trf3, const free_vector_type& free_vec) const { - // Get the concrete mask instance for this surface - const auto& m = mask_group[index]; - // Call shape-specific behaviour on the mask - return m.local_frame().free_to_bound_vector(trf3, free_vec); + + return mask_group[index].local_frame().free_to_bound_vector( + trf3, free_vec); } }; @@ -167,9 +167,8 @@ struct surface_kernels { const mask_group_t& mask_group, const index_t& index, const transform3& trf3, const free_vector_type& free_vec) const { - const auto& m = mask_group[index]; - - return m.local_frame().free_to_bound_jacobian(trf3, free_vec); + return mask_group[index].local_frame().free_to_bound_jacobian( + trf3, free_vec); } }; @@ -196,9 +195,8 @@ struct surface_kernels { const transform3& trf3, const vector3& pos, const vector3& dir, const vector3& dtds) const { - const auto& m = mask_group[index]; - - return m.local_frame().path_correction(pos, dir, dtds, trf3); + return mask_group[index].local_frame().path_correction(pos, dir, + dtds, trf3); } }; @@ -211,9 +209,19 @@ struct surface_kernels { const scalar_t env = std::numeric_limits::epsilon()) const { - const auto& m = mask_group[index]; + return mask_group[index].local_min_bounds(env); + } + }; + + /// A functor to get the vertices in local coordinates. + struct local_vertices { + + template + DETRAY_HOST_DEVICE inline auto operator()( + const mask_group_t& mask_group, const index_t& index, + const dindex lseg) const { - return m.local_min_bounds(env); + return mask_group[index].vertices(lseg); } }; }; diff --git a/core/include/detray/geometry/surface.hpp b/core/include/detray/geometry/surface.hpp index a3f66cdd0f..bd328845ec 100644 --- a/core/include/detray/geometry/surface.hpp +++ b/core/include/detray/geometry/surface.hpp @@ -237,17 +237,19 @@ class surface { pos, dir, dtds); } - /// @returns the vertices in local frame + /// @returns the vertices in local frame with @param lseg the number of + /// segments used along acrs DETRAY_HOST - constexpr auto local_vertices() const { - return visit_mask(); + constexpr auto local_vertices(const dindex lseg) const { + return visit_mask(lseg); } - /// @returns the vertices in global frame. + /// @returns the vertices in global frame with @param lseg the number of + /// segments used along acrs DETRAY_HOST - constexpr auto global_vertices(const context &ctx, + constexpr auto global_vertices(const context &ctx, const dindex lseg, const vector3 &dir) const { - auto vertices = local_vertices(); + auto vertices = local_vertices(lseg); for (size_t i = 0; i < vertices.size(); i++) { vertices[i] = local_to_global(ctx, vertices[i], dir); } @@ -269,7 +271,7 @@ class surface { /// @tparam functor_t the prescription to be applied to the mask /// @tparam Args types of additional arguments to the functor template - DETRAY_HOST_DEVICE constexpr auto visit_mask(Args &&... args) const { + DETRAY_HOST_DEVICE constexpr auto visit_mask(Args &&...args) const { const auto &masks = m_detector.mask_store(); return masks.template visit(m_desc.mask(), @@ -281,7 +283,7 @@ class surface { /// @tparam functor_t the prescription to be applied to the mask /// @tparam Args types of additional arguments to the functor template - DETRAY_HOST_DEVICE constexpr auto visit_material(Args &&... args) const { + DETRAY_HOST_DEVICE constexpr auto visit_material(Args &&...args) const { const auto &materials = m_detector.material_store(); return materials.template visit(m_desc.material(), @@ -370,10 +372,10 @@ class surface { template DETRAY_HOST_DEVICE surface(const detector_t &, const descr_t &) - ->surface; + -> surface; template DETRAY_HOST_DEVICE surface(const detector_t &, const geometry::barcode) - ->surface; + -> surface; } // namespace detray diff --git a/core/include/detray/masks/annulus2D.hpp b/core/include/detray/masks/annulus2D.hpp index 4bfab3dc47..8c5fbb1826 100644 --- a/core/include/detray/masks/annulus2D.hpp +++ b/core/include/detray/masks/annulus2D.hpp @@ -14,11 +14,11 @@ #include "detray/definitions/qualifiers.hpp" #include "detray/definitions/units.hpp" #include "detray/intersection/plane_intersector.hpp" +#include "detray/masks/detail/vertexing.hpp" #include "detray/surface_finders/grid/detail/axis_binning.hpp" #include "detray/surface_finders/grid/detail/axis_bounds.hpp" // System include(s) -#include #include #include #include @@ -93,24 +93,6 @@ class annulus2D { using binning = dtuple, binning_loc1>; }; - /// Given a local polar point given in the disc frame, @returns the - /// correponding point in the focal frame - /*DETRAY_HOST_DEVICE - template - static inline constexpr loc_point_type to_focal_frame( - const loc_point_type & pc_mod_point) { - return {}; - } - - /// Given a local polar point given in the focal frame, @returns the - /// correponding point in the disc frame - DETRAY_HOST_DEVICE - template - static inline constexpr loc_point_type to_disc_frame( - const loc_point_type & pc_strp_point) { - return {}; - }*/ - /// @returns the stereo angle calculated from the mask @param bounds . template