Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
AMRSortBlocks.cpp
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
19
20template<class Tvec, class TgridVec>
22
23 using MortonBuilder = RadixTreeMortonBuilder<u64, TgridVec, 3>;
24 using namespace shamrock::patch;
25
26 scheduler().for_each_patchdata_nonempty([&](Patch cur_p, PatchDataLayer &pdat) {
27 std::unique_ptr<sycl::buffer<u64>> out_buf_morton;
28 std::unique_ptr<sycl::buffer<u32>> out_buf_particle_index_map;
29
30 MortonBuilder::build(
31 shamsys::instance::get_compute_scheduler_ptr(),
32 scheduler().get_sim_box().template patch_coord_to_domain<TgridVec>(cur_p),
33 pdat.get_field<TgridVec>(0).get_buf(),
34 pdat.get_obj_cnt(),
35 out_buf_morton,
36 out_buf_particle_index_map);
37
38 // apply list permut on patch
39
40 u32 pre_merge_obj_cnt = pdat.get_obj_cnt();
41
42 pdat.index_remap(*out_buf_particle_index_map, pre_merge_obj_cnt);
43 });
44}
45
Utility to build morton codes for the radix tree.
std::uint32_t u32
32 bit unsigned integer
Helper class to build morton codes.
PatchDataLayer container class, the layout is described in patchdata_layout.
void index_remap(sycl::buffer< u32 > &index_map, u32 len)
this function remaps the patchdatafield like so val[id] = val[index_map[id]] This function can be use...
Patch object that contain generic patch information.
Definition Patch.hpp:33