20#include <nlohmann/json.hpp>
21#include <unordered_set>
23namespace shamrock::scheduler {
43 std::unordered_map<u64, Node>
tree;
86 std::vector<Patch> &plist,
const std::unordered_map<u64, u64> &id_patch_to_global_idx);
95 std::vector<Patch> &plist,
const std::unordered_map<u64, u64> &id_patch_to_global_idx);
123 void remove_node(
u64 id);
127 std::vector<Patch> &plist,
128 const std::unordered_map<u64, u64> &id_patch_to_global_idx);
131 void to_json(nlohmann::json &j,
const PatchTree &p);
133 void from_json(
const nlohmann::json &j,
PatchTree &p);
Header file for the patch struct and related function.
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
Node information in the patchtree + held patch info.
Patch Tree : Tree structure organisation for an abstract list of patches Nb : this tree is compatible...
void load_json(const nlohmann::json &j)
Load the metadata of the patch tree from a JSON object.
std::unordered_set< u64 > roots_id
set of root nodes ids
std::unordered_set< u64 > leaf_key
key of leaf nodes in tree
std::unordered_set< u64 > get_merge_request(u64 crit_load_merge)
Get list of nodes id to merge.
void build_from_patchtable(std::vector< Patch > &plist, u64 max_val_1axis)
make tree from a patch table
nlohmann::json serialize_patch_metadata() const
Serialize the metadata of the patch tree.
std::unordered_set< u64 > get_split_request(u64 crit_load_split)
Get list of nodes id to split.
void update_values_node(std::vector< Patch > &plist, const std::unordered_map< u64, u64 > &id_patch_to_global_idx)
update value in nodes (tree reduction)
std::unordered_set< u64 > parent_of_only_leaf_key
key of nodes that have only leafs as child
void partial_values_reduction(std::vector< Patch > &plist, const std::unordered_map< u64, u64 > &id_patch_to_global_idx)
update values in leafs and parent_of_only_leaf_key only
void merge_node_dm1(u64 idparent)
merge childs of idparent (id parent should have only leafs as childs)
std::unordered_map< u64, Node > tree
store the tree using a map
void split_node(u64 id)
split a leaf node
Patch object that contain generic patch information.