Skip to content

Commit e424ca1

Browse files
committed
Revert "Removed the trailing f in floating point numbers."
This reverts commit 95cbb93.
1 parent cf6f87a commit e424ca1

File tree

106 files changed

+734
-652
lines changed

Some content is hidden

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

106 files changed

+734
-652
lines changed

core/include/detray/builders/bin_fillers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ struct bin_associator {
128128
// Fill the surfaces into the grid by matching their contour onto the
129129
// grid bins
130130
bin_association(ctx, surfaces, transforms, masks, grid,
131-
darray<scalar_t, 2>{0.1, 0.1}, false);
131+
darray<scalar_t, 2>{0.1f, 0.1f}, false);
132132
}
133133
};
134134

core/include/detray/builders/cuboid_portal_generator.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class cuboid_portal_generator final
117117

118118
// Max distance in case of infinite bounds
119119
constexpr scalar_type max_shift{
120-
0.01 * std::numeric_limits<scalar_type>::max()};
120+
0.01f * std::numeric_limits<scalar_type>::max()};
121121

122122
// The bounding boxes around the module surfaces
123123
std::vector<aabb_t> boxes;
@@ -139,7 +139,7 @@ class cuboid_portal_generator final
139139
const point3_t box_max = world_box.template loc_max<point3_t>();
140140

141141
// Get the half lengths for the rectangle sides and translation
142-
const point3_t h_lengths = 0.5 * (box_max - box_min);
142+
const point3_t h_lengths = 0.5f * (box_max - box_min);
143143
const scalar_type h_x{math::fabs(h_lengths[0])};
144144
const scalar_type h_y{math::fabs(h_lengths[1])};
145145
const scalar_type h_z{math::fabs(h_lengths[2])};
@@ -160,7 +160,7 @@ class cuboid_portal_generator final
160160
h_x, h_y);
161161

162162
// No rotation, but shift in z for both faces
163-
vector3_t shift{0., 0.,
163+
vector3_t shift{0.f, 0.f,
164164
detail::is_invalid_value(h_z) ? max_shift : h_z};
165165
transforms.emplace_back(ctx, static_cast<vector3_t>(center + shift));
166166
transforms.emplace_back(ctx, static_cast<vector3_t>(center - shift));
@@ -183,9 +183,9 @@ class cuboid_portal_generator final
183183
h_x, h_z);
184184

185185
// Rotate by 90deg around x-axis, plus shift in y
186-
shift = {0., detail::is_invalid_value(h_y) ? max_shift : h_y, 0.};
187-
vector3_t new_x{1., 0., 0.};
188-
vector3_t new_z{0., -1., 0.};
186+
shift = {0.f, detail::is_invalid_value(h_y) ? max_shift : h_y, 0.f};
187+
vector3_t new_x{1.f, 0.f, 0.f};
188+
vector3_t new_z{0.f, -1.f, 0.f};
189189
transforms.emplace_back(ctx, static_cast<vector3_t>(center + shift),
190190
new_z, new_x);
191191
transforms.emplace_back(ctx, static_cast<vector3_t>(center - shift),
@@ -207,9 +207,9 @@ class cuboid_portal_generator final
207207
h_z, h_y);
208208

209209
// Rotate by 90deg around y-axis, plus shift in x
210-
shift = {detail::is_invalid_value(h_x) ? max_shift : h_x, 0., 0.};
211-
new_x = {0., 0., -1.};
212-
new_z = {1., 0., 0.};
210+
shift = {detail::is_invalid_value(h_x) ? max_shift : h_x, 0.f, 0.f};
211+
new_x = {0.f, 0.f, -1.f};
212+
new_z = {1.f, 0.f, 0.f};
213213
transforms.emplace_back(ctx, static_cast<vector3_t>(center + shift),
214214
new_z, new_x);
215215
transforms.emplace_back(ctx, static_cast<vector3_t>(center - shift),

core/include/detray/builders/cylinder_portal_generator.hpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ struct cylinder_portal_config {
3333
/// Autofit the lower/upper z extend and inner/outer radii
3434
bool m_do_autofit{true};
3535
/// Minimal envelope for the portals (used in autofitting)
36-
scalar_t m_envelope{100. * unit<scalar_t>::um};
36+
scalar_t m_envelope{100.f * unit<scalar_t>::um};
3737
/// Fixed inner radius during autofit
38-
scalar_t m_fixed_inner_r{0.};
38+
scalar_t m_fixed_inner_r{0.f};
3939
/// Fixed outer radius during autofit
40-
scalar_t m_fixed_outer_r{0.};
40+
scalar_t m_fixed_outer_r{0.f};
4141
/// Fixed length of the cylinder
42-
scalar_t m_fixed_z{0.};
42+
scalar_t m_fixed_z{0.f};
4343
/// The portal volumes links (north, south, east, west)
4444
std::vector<dindex> m_volume_links{dindex_invalid, dindex_invalid,
4545
dindex_invalid, dindex_invalid};
@@ -137,10 +137,10 @@ class cylinder_portal_generator final
137137
public:
138138
/// Save the boundaries of the cylinder after autofitting the portals
139139
struct boundaries {
140-
scalar_t inner_radius{0.};
141-
scalar_t outer_radius{0.};
142-
scalar_t lower_z{0.};
143-
scalar_t upper_z{0.};
140+
scalar_t inner_radius{0.f};
141+
scalar_t outer_radius{0.f};
142+
scalar_t lower_z{0.f};
143+
scalar_t upper_z{0.f};
144144
};
145145

146146
/// Construct from configuration @param cfg
@@ -194,9 +194,9 @@ class cylinder_portal_generator final
194194

195195
if (!m_cfg.do_autofit()) {
196196
// Without autofit, the portal bounds have to be given explicitly
197-
assert(!(m_cfg.fixed_inner_radius() == 0. &&
198-
m_cfg.fixed_outer_radius() == 0.) ||
199-
m_cfg.fixed_half_length() != 0.);
197+
assert(!(m_cfg.fixed_inner_radius() == 0.f &&
198+
m_cfg.fixed_outer_radius() == 0.f) ||
199+
m_cfg.fixed_half_length() != 0.f);
200200
} else {
201201
// Need surfaces in volume to do autofit
202202
assert(n_surfaces != 0u);
@@ -228,7 +228,7 @@ class cylinder_portal_generator final
228228
const point3_t box_max = world_box.template loc_max<point3_t>();
229229

230230
// Get the half lengths for the cylinder height and disc translation
231-
const point3_t h_lengths = 0.5 * (box_max - box_min);
231+
const point3_t h_lengths = 0.5f * (box_max - box_min);
232232
const scalar_t h_x{math::fabs(h_lengths[0])};
233233
const scalar_t h_y{math::fabs(h_lengths[1])};
234234
const scalar_t h_z{math::fabs(h_lengths[2])};
@@ -243,13 +243,13 @@ class cylinder_portal_generator final
243243
}
244244

245245
// Observe boundary conditions
246-
if (m_cfg.fixed_inner_radius() > 0.) {
246+
if (m_cfg.fixed_inner_radius() > 0.f) {
247247
inner_r = m_cfg.fixed_inner_radius();
248248
}
249-
if (m_cfg.fixed_outer_radius() > 0.) {
249+
if (m_cfg.fixed_outer_radius() > 0.f) {
250250
outer_r = m_cfg.fixed_outer_radius();
251251
}
252-
if (m_cfg.fixed_half_length() > 0.) {
252+
if (m_cfg.fixed_half_length() > 0.f) {
253253
lower_z = -m_cfg.fixed_half_length();
254254
upper_z = m_cfg.fixed_half_length();
255255
}
@@ -295,7 +295,7 @@ class cylinder_portal_generator final
295295
const scalar_t max_z{math::max(lower_z, upper_z)};
296296

297297
// translation
298-
const point3_t tsl{0., 0., 0.};
298+
const point3_t tsl{0.f, 0.f, 0.f};
299299

300300
// Add transform and mask data
301301
transforms.emplace_back(ctx, tsl);
@@ -335,7 +335,7 @@ class cylinder_portal_generator final
335335
const scalar_t max_r{math::max(inner_r, outer_r)};
336336

337337
// translation
338-
point3_t tsl{0., 0., z};
338+
point3_t tsl{0.f, 0.f, z};
339339

340340
// Add transform and mask data
341341
transforms.emplace_back(ctx, tsl);

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ struct center_of_gravity_rectangle {
3838
using point2_t = dpoint2D<algebra_t>;
3939

4040
// Check if centre of gravity is inside bin
41-
point2_t cgs = {0., 0.};
41+
point2_t cgs = {0.f, 0.f};
4242
for (const auto &svtx : surface_contour) {
4343
cgs = cgs + svtx;
4444
}
45-
cgs = 1. / static_cast<scalar_t>(surface_contour.size()) * cgs;
45+
cgs = 1.f / static_cast<scalar_t>(surface_contour.size()) * cgs;
4646
scalar_t min_l0 = std::numeric_limits<scalar_t>::max();
4747
scalar_t max_l0 = -std::numeric_limits<scalar_t>::max();
4848
scalar_t min_l1 = std::numeric_limits<scalar_t>::max();
@@ -80,11 +80,11 @@ struct center_of_gravity_generic {
8080
using point2_t = dpoint2D<algebra_t>;
8181

8282
// Check if centre of gravity is inside bin
83-
point2_t cgs = {0., 0.};
83+
point2_t cgs = {0.f, 0.f};
8484
for (const auto &svtx : surface_contour) {
8585
cgs = cgs + svtx;
8686
}
87-
cgs = 1. / static_cast<scalar_t>(surface_contour.size()) * cgs;
87+
cgs = 1.f / static_cast<scalar_t>(surface_contour.size()) * cgs;
8888

8989
std::size_t i = 0u;
9090
std::size_t j = 0u;
@@ -126,14 +126,14 @@ struct edges_intersect_generic {
126126
scalar_t d = (pj[0] - pi[0]) * (pl[1] - pk[1]) -
127127
(pj[1] - pi[1]) * (pl[0] - pk[0]);
128128

129-
if (d != 0.) {
129+
if (d != 0.f) {
130130
double r = ((pi[1] - pk[1]) * (pl[0] - pk[0]) -
131131
(pi[0] - pk[0]) * (pl[1] - pk[1])) /
132132
d;
133133
double s = ((pi[1] - pk[1]) * (pj[0] - pi[0]) -
134134
(pi[0] - pk[0]) * (pj[1] - pi[1])) /
135135
d;
136-
if (r >= 0. && r <= 1. && s >= 0. && s <= 1.) {
136+
if (r >= 0.f && r <= 1.f && s >= 0.f && s <= 1.f) {
137137
return true;
138138
}
139139
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ static inline void bin_association(const context_t & /*context*/,
200200
phi_min = math::min(phi, phi_min);
201201
phi_max = math::max(phi, phi_max);
202202
surface_contour.push_back({vg[2], phi});
203-
if (phi < 0.) {
203+
if (phi < 0.f) {
204204
s_c_neg.push_back({vg[2], phi});
205205
z_min_neg = math::min(vg[2], z_min_neg);
206206
z_max_neg = math::max(vg[2], z_max_neg);
@@ -214,7 +214,7 @@ static inline void bin_association(const context_t & /*context*/,
214214
std::vector<std::vector<point2_t>>
215215
surface_contours{};
216216
if (phi_max - phi_min > constant<scalar_t>::pi &&
217-
phi_max * phi_min < 0.) {
217+
phi_max * phi_min < 0.f) {
218218
s_c_neg.push_back(
219219
{z_max_neg, -constant<scalar_t>::pi});
220220
s_c_neg.push_back(

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ auto get_cylinder_portals(const tracking_volume<detector_t> &vol) {
3232
std::vector<const typename detector_t::volume_type &> inner_pt{},
3333
outer_pt{}, lower_pt{}, upper_pr{};
3434

35-
std::map<const typename detector_t::surface_type &, scalar_t> radii{0.};
36-
std::map<const typename detector_t::surface_type &, scalar_t> z_pos{0.};
35+
std::map<const typename detector_t::surface_type &, scalar_t> radii{0.f};
36+
std::map<const typename detector_t::surface_type &, scalar_t> z_pos{0.f};
3737

3838
// Loop over all portals
3939
for (const auto &pt_desc : vol.portals()) {

core/include/detray/builders/detector_builder.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,22 @@ class detector_builder {
123123

124124
// TODO: Construct it correctly with the grid builder
125125
mask<cylinder3D, algebra_type> vgrid_dims{
126+
<<<<<<< HEAD
126127
0u, 0., -constant<scalar_type>::pi,
127128
-2000., 180., constant<scalar_type>::pi,
128129
2000.};
130+
=======
131+
0u, 0.f, -constant<scalar_type>::pi,
132+
-2000.f, 180.f, constant<scalar_type>::pi,
133+
2000.f};
134+
>>>>>>> parent of 95cbb93f (Removed the trailing `f` in floating point numbers.)
129135
darray<std::size_t, 3> n_vgrid_bins{1u, 1u, 1u};
130136

131137
darray<std::vector<scalar_type>, 3UL> bin_edges{
132-
std::vector<scalar_type>{0., 180.},
138+
std::vector<scalar_type>{0.f, 180.f},
133139
std::vector<scalar_type>{-constant<scalar_type>::pi,
134140
constant<scalar_type>::pi},
135-
std::vector<scalar_type>{-2000., 2000.}};
141+
std::vector<scalar_type>{-2000.f, 2000.f}};
136142

137143
grid_factory_type<vol_finder_t> vgrid_factory{};
138144
m_vol_finder = vgrid_factory.template new_grid<

core/include/detray/builders/homogeneous_material_generator.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct hom_material_config {
3333
/// Type of material to put on the portal surfaces
3434
material<scalar_t> m_portal_material{vacuum<scalar_t>{}};
3535
/// Minimal envelope for the portals (used in autofitting)
36-
scalar_t m_thickness{1.5 * unit<scalar_t>::mm};
36+
scalar_t m_thickness{1.5f * unit<scalar_t>::mm};
3737

3838
/// Setters
3939
/// @{

core/include/detray/builders/material_map_generator.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ inline std::vector<material_slab<scalar_t>> generate_cyl_mat(
4444
// Make sure the cylinder bounds are centered around zero
4545
const scalar_t length{math::fabs(bounds[cylinder2D::e_upper_z] -
4646
bounds[cylinder2D::e_lower_z])};
47-
scalar_t z{-0.5 * length};
47+
scalar_t z{-0.5f * length};
4848
const scalar_t z_step{length / static_cast<scalar_t>(nbins - 1u)};
4949
for (std::size_t n = 0u; n < nbins; ++n) {
5050
ts.emplace_back(mat, static_cast<scalar_t>(scalor * z * z) + t);
@@ -92,9 +92,9 @@ struct material_map_config {
9292
/// Material to be filled into the maps
9393
material<scalar_t> mapped_material{silicon_tml<scalar_t>()};
9494
/// Minimal thickness of the material slabs in the material maps
95-
scalar_t thickness{0.15 * unit<scalar_t>::mm};
95+
scalar_t thickness{0.15f * unit<scalar_t>::mm};
9696
/// Scale factor for the material thickness calculation
97-
scalar_t scalor{1.};
97+
scalar_t scalor{1.f};
9898
/// How to vary the material thickness along the bins
9999
std::function<std::vector<material_slab<scalar_t>>(
100100
const std::vector<scalar_t> &, const std::size_t,

core/include/detray/geometry/coordinates/cartesian2D.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct cartesian2D {
5959
DETRAY_HOST_DEVICE static inline point3_type local_to_global(
6060
const transform3_type &trf, const mask_t & /*mask*/, const loc_point &p,
6161
const vector3_type & /*dir*/) {
62-
return trf.point_to_global(point3_type{p[0], p[1], 0.});
62+
return trf.point_to_global(point3_type{p[0], p[1], 0.f});
6363
}
6464

6565
/// @returns the normal vector in global coordinates

0 commit comments

Comments
 (0)