37 static constexpr u32 dim = 3;
49 : pdl(pdl), patch_coord_bounding_box(std::move(patch_coord_bounding_box)),
55 void set_patch_coord_bounding_box(
PatchCoord<dim> new_patch_coord_box) {
56 patch_coord_bounding_box = new_patch_coord_box;
59 "changed patch coord bounds :",
62 new_patch_coord_box.coord_min[0],
63 new_patch_coord_box.coord_min[1],
64 new_patch_coord_box.coord_min[2]},
66 new_patch_coord_box.coord_max[0],
67 new_patch_coord_box.coord_max[1],
68 new_patch_coord_box.coord_max[2]}});
88 auto [bmin, bmax] = get_bounding_box<T>();
114 std::pair<T, T> reduced = shamalgs::collective::allreduce_bounds(
115 std::pair<T, T>{new_box.lower, new_box.upper});
177 template<
class primtype>
181 inline void clean_box<f32>(
f32 tol) {
183 auto [bmin, bmax] = get_bounding_box<f32_3>();
185 f32_3 center = (bmin + bmax) / 2;
186 f32_3 cur_delt = bmax - bmin;
191 bmin = center - cur_delt;
192 bmax = center + cur_delt;
194 set_bounding_box<f32_3>({bmin, bmax});
198 inline void clean_box<f64>(
f64 tol) {
199 auto [bmin, bmax] = get_bounding_box<f64_3>();
201 f64_3 center = (bmin + bmax) / 2;
202 f64_3 cur_delt = bmax - bmin;
207 bmin = center - cur_delt;
208 bmax = center + cur_delt;
210 set_bounding_box<f64_3>({bmin, bmax});
213 template<
class primtype>
214 inline std::tuple<sycl::vec<primtype, 3>, sycl::vec<primtype, 3>> get_box(Patch &p) {
215 return patch_coord_to_domain<sycl::vec<primtype, 3>>(p);
219 inline PatchCoordTransform<T> get_transform() {
220 auto [bmin, bmax] = get_bounding_box<T>();
221 return PatchCoordTransform<T>{
231 void to_json(nlohmann::json &j);