Shamrock
2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shamrock
include
shamrock
patch
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
"
20
#include "
shammath/CoordRange.hpp
"
21
#include "
shammath/CoordRangeTransform.hpp
"
22
#include "
shamrock/patch/Patch.hpp
"
23
#include "
shamrock/patch/PatchCoord.hpp
"
24
#include "
shamsys/legacy/log.hpp
"
25
26
namespace
shamrock::patch {
27
28
template
<
class
Tcoord>
29
class
PatchCoordTransform
{
30
31
using
CoordTransform
=
shammath::CoordRangeTransform<u64_3, Tcoord>
;
32
33
CoordTransform
transform;
34
35
public
:
36
inline
PatchCoordTransform
(
37
shammath::CoordRange<u64_3>
patch_range,
shammath::CoordRange<Tcoord>
obj_range)
38
: transform(patch_range, obj_range) {}
39
40
inline
shammath::CoordRange<Tcoord>
to_obj_coord(
shammath::CoordRange<u64_3>
p)
const
{
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
AABB.hpp
CoordRangeTransform.hpp
CoordRange.hpp
PatchCoord.hpp
Patch.hpp
Header file for the patch struct and related function.
shammath::CoordRangeTransform< u64_3, Tcoord >
shamrock::patch::PatchCoordTransform
Definition
PatchCoordTransform.hpp:29
shamrock::patch::PatchCoord
Definition
PatchCoord.hpp:24
log.hpp
shammath::AABB
Axis-Aligned bounding box.
Definition
AABB.hpp:99
shammath::CoordRange
Definition
CoordRange.hpp:29
shamrock::patch::Patch
Patch object that contain generic patch information.
Definition
Patch.hpp:33
vec.hpp
Generated on Wed May 13 2026 13:21:49 for Shamrock by
1.9.8