ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
unmasked.hpp
1// This file is part of the ACTS project.
2//
3// Copyright (C) 2016 CERN for the benefit of the ACTS project
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9#pragma once
10
11// Project include(s)
12#include "detray/definitions/algebra.hpp"
13#include "detray/definitions/containers.hpp"
14#include "detray/definitions/detail/qualifiers.hpp"
15#include "detray/definitions/indexing.hpp"
16#include "detray/geometry/coordinates/cartesian2D.hpp"
17#include "detray/geometry/detail/shape_utils.hpp"
18
19// System include(s)
20#include <limits>
21#include <ostream>
22#include <string_view>
23
24namespace detray {
25
27template <std::size_t DIM = 2>
28class unmasked {
29 public:
31 static constexpr std::string_view name = "unmasked";
32
34 enum boundaries : unsigned int { e_size = 1u };
35
37 template <concepts::scalar scalar_t>
39
41 template <concepts::algebra algebra_t>
43
45 template <typename bool_t>
46 using result_type = bool_t;
47
49 static constexpr std::size_t dim{DIM};
50
57 template <concepts::scalar scalar_t, concepts::point point_t>
58 DETRAY_HOST_DEVICE inline scalar_t min_dist_to_boundary(
59 const bounds_type<scalar_t>& /*bounds*/, const point_t& /*loc_p*/) const {
60 return std::numeric_limits<scalar_t>::max();
61 }
62
71 template <concepts::algebra algebra_t>
72 DETRAY_HOST_DEVICE constexpr dbool<algebra_t> check_boundaries(
73 const bounds_type<dscalar<algebra_t>>& /*bounds*/,
74 const dtransform3D<algebra_t>& /*trf*/,
75 const dpoint3D<algebra_t>& /*glob_p*/,
76 const dscalar<algebra_t> /*tol*/ = 0.f,
77 const dscalar<algebra_t> /*edge_tol*/ = 0.f) const {
78 return true;
79 }
80
85 template <concepts::scalar scalar_t, concepts::point point_t>
86 DETRAY_HOST_DEVICE constexpr auto check_boundaries(
87 const bounds_type<scalar_t>& /*bounds*/, const point_t& /*loc_p*/,
88 const scalar_t tol = 0.f, const scalar_t edge_tol = 0.f) const
89 -> decltype(tol < edge_tol) {
90 return true;
91 }
92
93
99 template <concepts::scalar scalar_t>
100 DETRAY_HOST_DEVICE constexpr scalar_t measure(
101 const bounds_type<scalar_t>& bounds) const {
102 if constexpr (dim == 2) {
103 return area(bounds);
104 } else {
105 return volume(bounds);
106 }
107 }
108
112 template <concepts::scalar scalar_t>
113 DETRAY_HOST_DEVICE constexpr scalar_t area(
114 const bounds_type<scalar_t>& /*unused*/) const {
115 return std::numeric_limits<scalar_t>::max();
116 }
117
121 template <concepts::scalar scalar_t>
122 DETRAY_HOST_DEVICE constexpr scalar_t volume(
123 const bounds_type<scalar_t>& /*unused*/) const {
124 return std::numeric_limits<scalar_t>::max();
125 }
126
130 template <concepts::scalar scalar_t>
131 DETRAY_HOST_DEVICE constexpr bounds_type<scalar_t> merge(
132 const bounds_type<scalar_t>& /*bounds*/,
133 const bounds_type<scalar_t>& /*o_bounds*/) const {
134 return {};
135 }
136
143 template <concepts::algebra algebra_t>
144 DETRAY_HOST_DEVICE inline darray<dscalar<algebra_t>, 6> local_min_bounds(
145 const bounds_type<dscalar<algebra_t>>& /*bounds*/,
146 const dscalar<algebra_t> /*env*/ =
147 std::numeric_limits<dscalar<algebra_t>>::epsilon()) const {
148 using scalar_t = dscalar<algebra_t>;
149 constexpr scalar_t inv{detail::invalid_value<scalar_t>()};
150
151 return {-inv, -inv, -inv, inv, inv, inv};
152 }
153
155 template <concepts::algebra algebra_t>
156 DETRAY_HOST_DEVICE dpoint3D<algebra_t> centroid(
157 const bounds_type<dscalar<algebra_t>>& /*unused*/) const {
158 return {0.f, 0.f, 0.f};
159 }
160
166 template <concepts::algebra algebra_t>
168 const bounds_type<dscalar<algebra_t>>& bounds, dindex /*unused*/) const {
169 return local_min_bounds(bounds);
170 }
171
175 template <concepts::scalar scalar_t>
176 DETRAY_HOST constexpr bool check_consistency(
177 const bounds_type<scalar_t>& /*bounds*/,
178 const std::ostream& /*os*/) const {
179 return true;
180 }
181};
182
183} // namespace detray
Generic shape without boundaries.
Definition unmasked.hpp:28
static constexpr std::size_t dim
Dimension of the local coordinate system.
Definition unmasked.hpp:49
darray< scalar_t, boundaries::e_size > bounds_type
Container definition for the shape boundary values.
Definition unmasked.hpp:38
dvector< dpoint3D< algebra_t > > vertices(const bounds_type< dscalar< algebra_t > > &bounds, dindex) const
Generate vertices in local cartesian frame.
Definition unmasked.hpp:167
static constexpr std::string_view name
The name for this shape.
Definition unmasked.hpp:31
bool_t result_type
Result type of a boundary check.
Definition unmasked.hpp:46
constexpr bounds_type< scalar_t > merge(const bounds_type< scalar_t > &, const bounds_type< scalar_t > &) const
Merge two unmasked shapes.
Definition unmasked.hpp:131
constexpr dbool< algebra_t > check_boundaries(const bounds_type< dscalar< algebra_t > > &, const dtransform3D< algebra_t > &, const dpoint3D< algebra_t > &, const dscalar< algebra_t >=0.f, const dscalar< algebra_t >=0.f) const
Check boundary values for a local point.
Definition unmasked.hpp:72
constexpr bool check_consistency(const bounds_type< scalar_t > &, const std::ostream &) const
Check consistency of boundary values.
Definition unmasked.hpp:176
cartesian2D< algebra_t > local_frame_type
Local coordinate frame for boundary checks.
Definition unmasked.hpp:42
constexpr scalar_t volume(const bounds_type< scalar_t > &) const
The volume of a the shape.
Definition unmasked.hpp:122
darray< dscalar< algebra_t >, 6 > local_min_bounds(const bounds_type< dscalar< algebra_t > > &, const dscalar< algebra_t >=std::numeric_limits< dscalar< algebra_t > >::epsilon()) const
Lower and upper point for minimal axis aligned bounding box.
Definition unmasked.hpp:144
constexpr scalar_t area(const bounds_type< scalar_t > &) const
The area of a the shape.
Definition unmasked.hpp:113
boundaries
Boundary array layout; this shape has one placeholder entry.
Definition unmasked.hpp:34
dpoint3D< algebra_t > centroid(const bounds_type< dscalar< algebra_t > > &) const
Definition unmasked.hpp:156
constexpr auto check_boundaries(const bounds_type< scalar_t > &, const point_t &, const scalar_t tol=0.f, const scalar_t edge_tol=0.f) const -> decltype(tol< edge_tol)
Always accept a point supplied in local coordinates.
Definition unmasked.hpp:86
constexpr scalar_t measure(const bounds_type< scalar_t > &bounds) const
Measure of the shape: Inf.
Definition unmasked.hpp:100
scalar_t min_dist_to_boundary(const bounds_type< scalar_t > &, const point_t &) const
Find the minimum distance to any boundary.
Definition unmasked.hpp:58
Detray include(s).
Definition array_operators.hpp:18
get_scalar_t< A, T > dscalar
Scalar type for algebra A and value type T.
Definition algebra.hpp:64
vecmem::vector< value_t > dvector
Vector container backed by vecmem.
Definition containers.hpp:34
unsigned int dindex
Default index type.
Definition indexing.hpp:18
get_boolean_t< A > dbool
Boolean type associated with the algebra backend.
Definition algebra.hpp:52
std::array< value_t, kDIM > darray
Fixed-size array container.
Definition containers.hpp:30
get_transform3D_t< A, T > dtransform3D
Three-dimensional transform type for algebra A and value type T.
Definition algebra.hpp:84
get_point3D_t< A, T > dpoint3D
Three-dimensional point type for algebra A and value type T.
Definition algebra.hpp:72
Projection into a 2D cartesian coordinate frame.
Definition cartesian2D.hpp:19