27#include "../Solver/ThermalHydraulicSolver.h"
28#include "../Solver/AdsidacCallback.h"
31#include <unordered_map>
33namespace fs = std::filesystem;
35using PU = ParallelUtilities;
91 std::shared_ptr<RestartNodeInfo>
rinfo;
129 std::unique_ptr<ThermalHydraulicSolver>
solver_;
Shared declarations for MPI parallel execution: message tags, utilities, Fortran callbacks.
Static MPI utility functions — colored logging, Boost object serialization over MPI.
ADS-IDAC engine's implementation of SolverCallback.
MPI worker client that executes simulation sequences.
void execute_relap()
Run one sequence on this client's solver: sets the thermo cache mode from the configuration,...
void hold_branch_data(int cid, std::shared_ptr< RestartNodeInfo > rinfo, BranchRecord &br, const std::string &path, int refs)
Store branch data for deferred peer transfer or a later self-run.
AdsidacCallback callback_
Per-rank callback instance.
int rank
MPI rank of this client.
int Work()
Main client work loop: receive tasks, execute, report back.
void restore_buffer(std::vector< char > raw)
Splice the base on if raw lacks it (MPI_Abort if impossible), then solver_->restore()
void self_merge_outputs()
Client(int rank)
Create the solver, initialize the engine modules and redirect the scheduler's output directories to <...
MPI_Status status_client
Status of the message being handled by Work()
int parent_seq_id_
Parent sequence ID for current run (received from server)
double branch_time_
Sim time when parent branched to create this sequence.
bool ensure_base_cache()
Load <project>/restart_base.bin if not already resident; false if unavailable.
int branches_this_seq_
Count of branching events during current sequence.
int getNextLocalBranchID()
Increment and return the rank-local branch-point counter. The value names restart transfer files and ...
std::unordered_map< int, HeldBranchData > held_data_
Rank-local branch-point id -> data held for deferred peer sends and self-runs.
void parallel_restartforanewsequence_(int branch_index)
Install the received branch tree as the global one and prepare the restart of one branch alternative.
void restore_relap_state(const std::string &file_path, bool clear_buf)
Restore the solver state from restart_info_'s buffer or a restart file.
std::shared_ptr< RestartNodeInfo > restart_info_
Snapshot of the task being started (immutable after creation)
std::unique_ptr< ThermalHydraulicSolver > solver_
Per-rank solver instance.
void complete_sequence(int seq_id)
Post-sequence completion: write the sequence's ES, KPS, analysis and PE node files,...
int local_branch_counter_
Per-client branch-point counter (see getNextLocalBranchID)
std::shared_ptr< BranchRecord > branch_center_
Branch record of the task being started (consumed by parallel_restartforanewsequence_)
std::vector< char > base_cache_
[header][complete restart base], cached once per rank.
KeyParameterHistory KPS
Unused; sequences record into g_sim.KPS.
Data held locally for deferred peer-to-peer transfer.
std::string file_path
Restart transfer file (read only when rinfo carries no buffer)
int ref_count
Number of queued tasks still referencing this data.
std::shared_ptr< RestartNodeInfo > rinfo
Shared with g_sim.restart_info (no extra buffer copy)
std::shared_ptr< BranchRecord > branch_record
Deep copy (owns its own BranchCluster objects)