36 class SimulationBoxInfo {
38 static constexpr u32 dim = 3;
48 inline SimulationBoxInfo(
50 : pdl(pdl), patch_coord_bounding_box(std::move(patch_coord_bounding_box)),
56 void set_patch_coord_bounding_box(
PatchCoord<dim> new_patch_coord_box) {
57 patch_coord_bounding_box = new_patch_coord_box;
60 "changed patch coord bounds :",
63 new_patch_coord_box.coord_min[0],
64 new_patch_coord_box.coord_min[1],
65 new_patch_coord_box.coord_min[2]},
67 new_patch_coord_box.coord_max[0],
68 new_patch_coord_box.coord_max[1],
69 new_patch_coord_box.coord_max[2]}});
115 std::pair<T, T> reduced = shamalgs::collective::allreduce_bounds(
116 std::pair<T, T>{new_box.lower, new_box.upper});
178 template<
class primtype>
186 f32_3 center = (bmin + bmax) / 2;
187 f32_3 cur_delt = bmax - bmin;
192 bmin = center - cur_delt;
193 bmax = center + cur_delt;
202 f64_3 center = (bmin + bmax) / 2;
203 f64_3 cur_delt = bmax - bmin;
208 bmin = center - cur_delt;
209 bmax = center + cur_delt;
214 template<
class primtype>
215 inline std::tuple<sycl::vec<primtype, 3>, sycl::vec<primtype, 3>> get_box(Patch &p) {
220 inline PatchCoordTransform<T> get_transform() {
222 return PatchCoordTransform<T>{
223 patch_coord_bounding_box, shammath::CoordRange<T>{bmin, bmax}};
232 void to_json(nlohmann::json &j);
312 if (pdl.check_main_field_type<f32_3>()) {
313 bounding_box.value = shammath::CoordRange<f32_3>::max_range();
314 }
else if (pdl.check_main_field_type<f64_3>()) {
315 bounding_box.value = shammath::CoordRange<f64_3>::max_range();
316 }
else if (pdl.check_main_field_type<u32_3>()) {
317 bounding_box.value = shammath::CoordRange<u32_3>::max_range();
318 }
else if (pdl.check_main_field_type<u64_3>()) {
319 bounding_box.value = shammath::CoordRange<u64_3>::max_range();
320 }
else if (pdl.check_main_field_type<i64_3>()) {
321 bounding_box.value = shammath::CoordRange<i64_3>::max_range();
324 "the chosen type for the main field is not handled");