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,
51 static std::unique_ptr<sycl::buffer<u_morton>> build_raw(
55 sycl::buffer<T> &pos_buf);
57 [[nodiscard]]
inline u64 memsize()
const {
60 auto add_ptr = [&](
auto &a) {
62 sum += a->byte_size();
66 sum +=
sizeof(obj_cnt);
69 add_ptr(buf_particle_index_map);
77 : obj_cnt(other.obj_cnt),
79 shamalgs::memory::duplicate(
80 shamsys::instance::get_compute_queue(), other.buf_morton)),
81 buf_particle_index_map(
82 shamalgs::memory::duplicate(
83 shamsys::instance::get_compute_queue(), other.buf_particle_index_map)) {}
86 obj_cnt = std::move(other.obj_cnt);
87 buf_morton = std::move(other.buf_morton);
88 buf_particle_index_map = std::move(other.buf_particle_index_map);
103 serializer.write(obj_cnt);
108 serializer.write_buf(*buf_morton, obj_cnt);
109 if (!buf_particle_index_map) {
112 serializer.write_buf(*buf_particle_index_map, obj_cnt);
128 serializer.load(ret.obj_cnt);
132 ret.buf_morton = std::make_unique<sycl::buffer<u_morton>>(ret.obj_cnt);
133 ret.buf_particle_index_map = std::make_unique<sycl::buffer<u32>>(ret.obj_cnt);
135 serializer.load_buf(*ret.buf_morton, ret.obj_cnt);
136 serializer.load_buf(*ret.buf_particle_index_map, ret.obj_cnt);
148 return H::serialize_byte_size<u32>() + H::serialize_byte_size<u32>(obj_cnt)
149 + H::serialize_byte_size<u_morton>(obj_cnt);