29 class TreeMortonCodes {
33 std::unique_ptr<sycl::buffer<u_morton>> buf_morton;
34 std::unique_ptr<sycl::buffer<u32>> buf_particle_index_map;
41 sycl::buffer<T> &pos_buf);
45 sham::DeviceScheduler_ptr dev_sched,
50 [[nodiscard]]
inline u64 memsize()
const {
53 auto add_ptr = [&](
auto &a) {
55 sum += a->byte_size();
59 sum +=
sizeof(obj_cnt);
62 add_ptr(buf_particle_index_map);
67 inline TreeMortonCodes() =
default;
69 inline TreeMortonCodes(
const TreeMortonCodes &other)
70 : obj_cnt(other.obj_cnt),
72 shamalgs::memory::duplicate(
74 buf_particle_index_map(
75 shamalgs::memory::duplicate(
78 inline TreeMortonCodes &operator=(TreeMortonCodes &&other)
noexcept {
79 obj_cnt = std::move(other.obj_cnt);
80 buf_morton = std::move(other.buf_morton);
81 buf_particle_index_map = std::move(other.buf_particle_index_map);
86 bool operator==(
const TreeMortonCodes &rhs)
const;
96 serializer.write(obj_cnt);
101 serializer.write_buf(*buf_morton, obj_cnt);
102 if (!buf_particle_index_map) {
105 serializer.write_buf(*buf_particle_index_map, obj_cnt);
121 serializer.load(ret.obj_cnt);
125 ret.buf_morton = std::make_unique<sycl::buffer<u_morton>>(ret.obj_cnt);
126 ret.buf_particle_index_map = std::make_unique<sycl::buffer<u32>>(ret.obj_cnt);
128 serializer.load_buf(*ret.buf_morton, ret.obj_cnt);
129 serializer.load_buf(*ret.buf_particle_index_map, ret.obj_cnt);
141 return H::serialize_byte_size<u32>() + H::serialize_byte_size<u32>(obj_cnt)
142 + H::serialize_byte_size<u_morton>(obj_cnt);