81 using int_vec_repr_base =
u32;
82 using int_vec_repr = u32_3;
83 static constexpr int_vec_repr_base max_val = 2097152 - 1;
85 inline static u64 icoord_to_hilbert(
u64 x,
u64 y,
u64 z) {
86 return details::compute_hilbert_index_3d<21>(x, y, z);
90 inline static u64 coord_to_hilbert(flt x, flt y, flt z) {
92 constexpr bool ok_type = std::is_same<flt, f32>::value || std::is_same<flt, f64>::value;
93 static_assert(ok_type,
"unknown input type");
95 if constexpr (std::is_same<flt, f32>::value) {
97 x = sycl::fmin(sycl::fmax(x * 2097152.F, 0.F), 2097152.F - 1.F);
98 y = sycl::fmin(sycl::fmax(y * 2097152.F, 0.F), 2097152.F - 1.F);
99 z = sycl::fmin(sycl::fmax(z * 2097152.F, 0.F), 2097152.F - 1.F);
101 return icoord_to_hilbert(x, y, z);
103 }
else if constexpr (std::is_same<flt, f64>::value) {
105 x = sycl::fmin(sycl::fmax(x * 2097152., 0.), 2097152. - 1.);
106 y = sycl::fmin(sycl::fmax(y * 2097152., 0.), 2097152. - 1.);
107 z = sycl::fmin(sycl::fmax(z * 2097152., 0.), 2097152. - 1.);
109 return icoord_to_hilbert(x, y, z);
122 using int_vec_repr_base =
u64;
123 using int_vec_repr = u64_3;
124 static constexpr int_vec_repr_base max_val = divisor * divisor - 1;
126 inline static quad_hilbert_num icoord_to_hilbert(
u64 x,
u64 y,
u64 z) {
128 u64 upper_val_x = x / divisor;
129 u64 upper_val_y = y / divisor;
130 u64 upper_val_z = z / divisor;
132 u64 lower_val_x = x % divisor;
133 u64 lower_val_y = y % divisor;
134 u64 lower_val_z = z % divisor;
137 details::compute_hilbert_index_3d<21>(upper_val_x, upper_val_y, upper_val_z),
138 details::compute_hilbert_index_3d<21>(lower_val_x, lower_val_y, lower_val_z),