Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
MortonKernels.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
21
22namespace shamrock::sfc {
23
24 namespace details {
25
35 template<class morton_t>
37 sycl::queue &queue,
38 u32 morton_count,
39 u32 fill_count,
40 std::unique_ptr<sycl::buffer<morton_t>> &buf_morton);
41 } // namespace details
42
43 template<class morton_t, class _pos_t, u32 dim>
45
46 public:
48
49 using pos_t = _pos_t;
50 using coord_t = typename shambase::VectorProperties<pos_t>::component_type;
51 using ipos_t = typename Morton::int_vec_repr;
52 using int_t = typename Morton::int_vec_repr_base;
53
55
56 inline static CoordTransform get_transform(pos_t bounding_box_min, pos_t bounding_box_max) {
58 bounding_box_min, bounding_box_max);
59 }
60 inline static ipos_t to_morton_grid(pos_t pos, CoordTransform transform) {
62 }
63
64 inline static pos_t to_real_space(ipos_t pos, CoordTransform transform) {
66 }
67
78 static void sycl_xyz_to_morton(
79 sycl::queue &queue,
80 u32 pos_count,
81 sycl::buffer<pos_t> &in_positions,
82 pos_t bounding_box_min,
83 pos_t bounding_box_max,
84 std::unique_ptr<sycl::buffer<morton_t>> &out_morton);
85
86 static void sycl_xyz_to_morton(
87 const sham::DeviceScheduler_ptr &dev_sched,
88 u32 pos_count,
89 sham::DeviceBuffer<pos_t> &in_positions,
90 pos_t bounding_box_min,
91 pos_t bounding_box_max,
92 std::unique_ptr<sycl::buffer<morton_t>> &out_morton);
102 inline static void sycl_fill_trailling_buffer(
103 sycl::queue &queue,
104 u32 morton_count,
105 u32 fill_count,
106 std::unique_ptr<sycl::buffer<morton_t>> &buf_morton) {
107 details::sycl_fill_trailling_buffer<morton_t>(
108 queue, morton_count, fill_count, buf_morton);
109 }
110
111 static void sycl_irange_to_range(
112 sycl::queue &queue,
113 u32 buf_len,
114 pos_t bounding_box_min,
115 pos_t bounding_box_max,
116 std::unique_ptr<sycl::buffer<ipos_t>> &buf_pos_min_cell,
117 std::unique_ptr<sycl::buffer<ipos_t>> &buf_pos_max_cell,
118 std::unique_ptr<sycl::buffer<pos_t>> &out_buf_pos_min_cell_flt,
119 std::unique_ptr<sycl::buffer<pos_t>> &out_buf_pos_max_cell_flt);
120 };
121
122} // namespace shamrock::sfc
void sycl_fill_trailling_buffer(sycl::queue &queue, u32 morton_count, u32 fill_count, std::unique_ptr< sycl::buffer< morton_t > > &buf_morton)
fill the end of a buffer (indices from morton_count up to fill_count-1) with error values (maximum in...
std::uint32_t u32
32 bit unsigned integer
A buffer allocated in USM (Unified Shared Memory)
static void sycl_xyz_to_morton(sycl::queue &queue, u32 pos_count, sycl::buffer< pos_t > &in_positions, pos_t bounding_box_min, pos_t bounding_box_max, std::unique_ptr< sycl::buffer< morton_t > > &out_morton)
convert a buffer of 3d positions to morton codes
static void sycl_fill_trailling_buffer(sycl::queue &queue, u32 morton_count, u32 fill_count, std::unique_ptr< sycl::buffer< morton_t > > &buf_morton)
fill the end of a buffer (indices from morton_count up to fill_count-1) with error values (maximum in...
Morton curve implementation.
Namespace for internal details of the logs module.