Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
PatchCoordTransform.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
18#include "shambackends/vec.hpp"
19#include "shammath/AABB.hpp"
25
26namespace shamrock::patch {
27
28 template<class Tcoord>
30
32
33 CoordTransform transform;
34
35 public:
38 : transform(patch_range, obj_range) {}
39
41 return transform.transform(p);
42 }
43
44 inline shammath::AABB<Tcoord> to_obj_coord(shammath::AABB<u64_3> p) const {
45 auto ret = transform.transform(shammath::CoordRange<u64_3>(p.lower, p.upper));
46 return {ret.lower, ret.upper};
47 }
48
49 PatchCoord<3> to_patch_coord(shammath::CoordRange<Tcoord> obj) const {
50 return transform.reverse_transform(obj);
51 }
52
53 inline shammath::CoordRange<Tcoord> to_obj_coord(Patch p) const {
54 return to_obj_coord(p.get_patch_range());
55 }
56
57 inline void print_transform() const { transform.print_transform(); }
58 };
59} // namespace shamrock::patch
Header file for the patch struct and related function.
Axis-Aligned bounding box.
Definition AABB.hpp:99
Patch object that contain generic patch information.
Definition Patch.hpp:33