Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
shamrock::scheduler::PatchTree Class Reference

Patch Tree : Tree structure organisation for an abstract list of patches Nb : this tree is compatible with multiple roots cf value in roots_id. More...

#include <shamrock/include/shamrock/scheduler/PatchTree.hpp>

+ Collaboration diagram for shamrock::scheduler::PatchTree:

Public Types

using Patch = patch::Patch
 
using Node = scheduler::PatchTreeNode
 

Public Member Functions

void split_node (u64 id)
 split a leaf node
 
void merge_node_dm1 (u64 idparent)
 merge childs of idparent (id parent should have only leafs as childs)
 
void build_from_patchtable (std::vector< Patch > &plist, u64 max_val_1axis)
 make tree from a patch table
 
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)
 
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
 
std::unordered_set< u64get_split_request (u64 crit_load_split)
 Get list of nodes id to split.
 
std::unordered_set< u64get_merge_request (u64 crit_load_merge)
 Get list of nodes id to merge.
 
void insert_root_node (u32 patch_id, patch::PatchCoord< 3 > coords)
 
nlohmann::json serialize_patch_metadata () const
 Serialize the metadata of the patch tree.
 
void load_json (const nlohmann::json &j)
 Load the metadata of the patch tree from a JSON object.
 

Public Attributes

std::unordered_set< u64roots_id
 set of root nodes ids
 
std::unordered_map< u64, Nodetree
 store the tree using a map
 
std::unordered_set< u64leaf_key
 key of leaf nodes in tree
 
std::unordered_set< u64parent_of_only_leaf_key
 key of nodes that have only leafs as child
 

Detailed Description

Patch Tree : Tree structure organisation for an abstract list of patches Nb : this tree is compatible with multiple roots cf value in roots_id.

Definition at line 29 of file PatchTree.hpp.

Member Typedef Documentation

◆ Node

Definition at line 32 of file PatchTree.hpp.

◆ Patch

Definition at line 31 of file PatchTree.hpp.

Member Function Documentation

◆ build_from_patchtable()

void shamrock::scheduler::PatchTree::build_from_patchtable ( std::vector< Patch > &  plist,
u64  max_val_1axis 
)

make tree from a patch table

Parameters
plist
max_val_1axis

Definition at line 140 of file PatchTree.cpp.

+ Here is the call graph for this function:

◆ get_merge_request()

std::unordered_set< u64 > shamrock::scheduler::PatchTree::get_merge_request ( u64  crit_load_merge)

Get list of nodes id to merge.

Parameters
crit_load_merge
Returns
std::unordered_set<u64>

Definition at line 308 of file PatchTree.cpp.

◆ get_split_request()

std::unordered_set< u64 > shamrock::scheduler::PatchTree::get_split_request ( u64  crit_load_split)

Get list of nodes id to split.

Parameters
crit_load_split
Returns
std::unordered_set<u64>

Definition at line 295 of file PatchTree.cpp.

◆ insert_root_node()

void shamrock::scheduler::PatchTree::insert_root_node ( u32  patch_id,
patch::PatchCoord< 3 >  coords 
)

Definition at line 126 of file PatchTree.cpp.

◆ load_json()

void shamrock::scheduler::PatchTree::load_json ( const nlohmann::json &  j)

Load the metadata of the patch tree from a JSON object.

Parameters
jThe JSON object containing the metadata.

Definition at line 347 of file PatchTree.cpp.

◆ merge_node_dm1()

void shamrock::scheduler::PatchTree::merge_node_dm1 ( u64  idparent)

merge childs of idparent (id parent should have only leafs as childs)

Parameters
idparent

Definition at line 66 of file PatchTree.cpp.

+ Here is the call graph for this function:

◆ partial_values_reduction()

void shamrock::scheduler::PatchTree::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

Parameters
plist
id_patch_to_global_idx

Definition at line 281 of file PatchTree.cpp.

◆ serialize_patch_metadata()

nlohmann::json shamrock::scheduler::PatchTree::serialize_patch_metadata ( ) const

Serialize the metadata of the patch tree.

Returns
The serialized metadata as a JSON object.

Definition at line 326 of file PatchTree.cpp.

◆ split_node()

void shamrock::scheduler::PatchTree::split_node ( u64  id)

split a leaf node

Parameters
id

Definition at line 36 of file PatchTree.cpp.

◆ update_values_node()

void shamrock::scheduler::PatchTree::update_values_node ( std::vector< Patch > &  plist,
const std::unordered_map< u64, u64 > &  id_patch_to_global_idx 
)

update value in nodes (tree reduction)

Parameters
plist
id_patch_to_global_idx

Definition at line 268 of file PatchTree.cpp.

Member Data Documentation

◆ leaf_key

std::unordered_set<u64> shamrock::scheduler::PatchTree::leaf_key

key of leaf nodes in tree

Definition at line 49 of file PatchTree.hpp.

◆ parent_of_only_leaf_key

std::unordered_set<u64> shamrock::scheduler::PatchTree::parent_of_only_leaf_key

key of nodes that have only leafs as child

Definition at line 55 of file PatchTree.hpp.

◆ roots_id

std::unordered_set<u64> shamrock::scheduler::PatchTree::roots_id

set of root nodes ids

Definition at line 37 of file PatchTree.hpp.

◆ tree

std::unordered_map<u64, Node> shamrock::scheduler::PatchTree::tree

store the tree using a map

Definition at line 43 of file PatchTree.hpp.


The documentation for this class was generated from the following files: