22#include <nlohmann/json.hpp>
23#include <unordered_map>
24#include <unordered_set>
49 std::vector<shamrock::patch::Patch>
global;
54 std::vector<shamrock::patch::Patch>
local;
65 "the load values are invalid please update them", loc);
108 std::unordered_set<u64> &patch_id_lst,
109 std::vector<u64> &to_send_idx,
110 std::vector<u64> &to_recv_idx);
146 std::tuple<u64, u64, u64, u64, u64, u64, u64, u64>
split_patch(
u64 id_patch);
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
Handle the patch list of the mpi scheduler.
std::vector< shamrock::patch::Patch > local
contain the list of patch owned by the current node
void reset_local_pack_index()
reset Patch's pack index value
bool is_load_values_up_to_date
Are patch load values up to date.
std::unordered_map< u64, u64 > id_patch_to_local_idx
id_patch_to_local_idx[patch_id] = index in local patch list
std::vector< shamrock::patch::Patch > global
contain the list of all patches in the simulation
void build_global()
rebuild global from the local list of each tables
void invalidate_load_values()
Invalidate current load values (To use after a change the patches is made)
void build_local_differantial(std::unordered_set< u64 > &patch_id_lst, std::vector< u64 > &to_send_idx, std::vector< u64 > &to_recv_idx)
Build the local patch list and create a differential of patches to send / recv since last time.
u64 _next_patch_id
The next available patch id.
std::tuple< u64, u64, u64, u64, u64, u64, u64, u64 > split_patch(u64 id_patch)
split the Patch having id_patch as id and return the index of the 8 subpatches in the global vector
std::unordered_set< u64 > build_local()
select owned patches owned by the node to rebuild local
std::unordered_map< u64, u64 > id_patch_to_global_idx
id_patch_to_global_idx[patch_id] = index in global patch list
void merge_patch(u64 idx0, u64 idx1, u64 idx2, u64 idx3, u64 idx4, u64 idx5, u64 idx6, u64 idx7)
merge the 8 given patches index in the global vector
void build_local_idx_map()
recompute id_patch_to_local_idx
void check_load_values_valid(SourceLocation loc=SourceLocation{})
Check if the load values are valid, throw otherwise.
void build_global_idx_map()
recompute id_patch_to_global_idx
This header file contains utility functions related to exception handling in the code.
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
void to_json(nlohmann::json &j, const SchedulerPatchList &p)
Serializes a SchedulerPatchList object to a JSON object.
std::vector< shamrock::patch::Patch > make_fake_patch_list(u32 total_dtcnt, u64 div_limit)
generate a fake patch list corresponding to a tree structure
void from_json(const nlohmann::json &j, SchedulerPatchList &p)
Deserializes a JSON object into a SchedulerPatchList object.
provide information about the source location