35 class SimulationBoxInfo {
37 static constexpr u32 dim = 3;
47 inline SimulationBoxInfo(
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]}});
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>
185 f32_3 center = (bmin + bmax) / 2;
186 f32_3 cur_delt = bmax - bmin;
191 bmin = center - cur_delt;
192 bmax = center + cur_delt;
201 f64_3 center = (bmin + bmax) / 2;
202 f64_3 cur_delt = bmax - bmin;
207 bmin = center - cur_delt;
208 bmax = center + cur_delt;
213 template<
class primtype>
214 inline std::tuple<sycl::vec<primtype, 3>, sycl::vec<primtype, 3>> get_box(Patch &p) {
219 inline PatchCoordTransform<T> get_transform() {
221 return PatchCoordTransform<T>{
222 patch_coord_bounding_box, shammath::CoordRange<T>{bmin, bmax}};
231 void to_json(nlohmann::json &j);
311 if (pdl.check_main_field_type<f32_3>()) {
312 bounding_box.value = shammath::CoordRange<f32_3>::max_range();
313 }
else if (pdl.check_main_field_type<f64_3>()) {
314 bounding_box.value = shammath::CoordRange<f64_3>::max_range();
315 }
else if (pdl.check_main_field_type<u32_3>()) {
316 bounding_box.value = shammath::CoordRange<u32_3>::max_range();
317 }
else if (pdl.check_main_field_type<u64_3>()) {
318 bounding_box.value = shammath::CoordRange<u64_3>::max_range();
319 }
else if (pdl.check_main_field_type<i64_3>()) {
320 bounding_box.value = shammath::CoordRange<i64_3>::max_range();
323 "the chosen type for the main field is not handled");