Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
SolverLog.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
22#include <optional>
23#include <vector>
24
25namespace shammodels::sph {
26 struct SolverLog;
27} // namespace shammodels::sph
28
34
35 struct StepInfo {
36 f64 solver_t;
37 f64 solver_dt;
38 i32 world_rank;
39 u64 rank_count;
40 f64 rate;
41 f64 elasped_sec;
42 f64 wtime;
43 shamsys::SystemMetrics system_metrics;
44 };
45
46 std::vector<StepInfo> step_logs = {};
47
48 f64 cumulated_step_time = 0;
49 u64 step_count = 0;
50
51 inline void register_log(StepInfo info) {
52 step_logs.push_back(info);
53 cumulated_step_time += info.elasped_sec;
54 step_count++;
55 }
56
57 f64 get_last_rate();
58 u64 get_last_obj_count();
59 shamsys::SystemMetrics get_last_system_metrics();
60
61 u64 get_iteration_count() { return step_logs.size(); }
62
63 f64 get_cumulated_step_time() { return cumulated_step_time; }
64
65 void reset_cumulated_step_time() { cumulated_step_time = 0; }
66
67 u64 get_step_count() { return step_count; }
68 void reset_step_count() { step_count = 0; }
69};
double f64
Alias for double.
std::uint64_t u64
64 bit unsigned integer
std::int32_t i32
32 bit integer
namespace for the sph model
Class holding the logs of the solver /todo add a variable to keep only a definite number of steps in ...
Definition SolverLog.hpp:33