20#include <nlohmann/json.hpp>
22namespace shamrock::scheduler {
28 std::array<u64, 8> childs_id;
83 std::array<PatchTreeNode, split_count> get_split_nodes(
u32 cur_id);
85 bool is_leaf() {
return tree_node.
is_leaf; }
102 auto [bmin, bmax] = box_transform.to_obj_coord(patch_coord.get_patch_range());
120 return (lhs.patch_coord == rhs.patch_coord) && (lhs.tree_node == rhs.tree_node)
121 && (lhs.linked_patchid == rhs.linked_patchid) && (lhs.load_value == rhs.load_value);
124 inline auto PatchTreeNode::get_split_nodes(
u32 cur_id)
125 -> std::array<PatchTreeNode, split_count> {
126 std::array<PatchCoord, split_count> splt_coord = patch_coord.split();
128 std::array<PatchTreeNode, split_count> ret;
131 for (
u32 i = 0; i < split_count; i++) {
132 ret[i].patch_coord = splt_coord[i];
133 ret[i].tree_node.level = tree_node.level + 1;
134 ret[i].tree_node.parent_nid = cur_id;
150 {
"parent_nid", p.parent_nid},
151 {
"childs_nid", p.childs_nid},
152 {
"is_leaf", p.is_leaf},
153 {
"child_are_all_leafs", p.child_are_all_leafs}};
163 j.at(
"level").get_to(p.level);
164 j.at(
"parent_nid").get_to(p.parent_nid);
165 j.at(
"childs_nid").get_to(p.childs_nid);
166 j.at(
"is_leaf").get_to(p.is_leaf);
167 j.at(
"child_are_all_leafs").get_to(p.child_are_all_leafs);
179 {
"linked_patchid", p.linked_patchid},
180 {
"load_value", p.load_value},
181 {
"tree_node", p.tree_node},
184 {
"min", p.patch_coord.coord_min},
185 {
"max", p.patch_coord.coord_max},
197 j.at(
"linked_patchid").get_to(p.linked_patchid);
198 j.at(
"load_value").get_to(p.load_value);
199 j.at(
"tree_node").get_to(p.tree_node);
200 j.at(
"patch_coord").at(
"min").get_to(p.patch_coord.coord_min);
201 j.at(
"patch_coord").at(
"max").get_to(p.patch_coord.coord_max);
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
Node information in the PatchTree link list.
bool child_are_all_leafs
Store true if all childrens of this node are leafs.
std::array< u64, 8 > childs_nid
Array of childs node ids.
u32 level
Level of the tree node.
u64 parent_nid
Parent node id.
bool is_leaf
Is this node a leaf.
Node information in the patchtree + held patch info.
SerialPatchNode< vec > convert(const shamrock::patch::PatchCoordTransform< vec > box_transform)
Convert PatchTreeNode to SerialPatchNode using given coordinate transform.
constexpr u64 u64_max
u64 max value