|
Orrery
A GPU-accelerated N-body gravitational simulator
|
Appends one row per measurement to a CSV file. More...
#include <orrery/sim/diagnostics_log.hpp>
Public Member Functions | |
| DiagnosticsLog (const std::filesystem::path &path) | |
| Create the file and write the header row. | |
| void | record (core::Index step, core::Real time, const core::Diagnostics &diagnostics) |
| Write one row. | |
| std::optional< core::Real > | reference_energy () const noexcept |
| The total energy of the first row, if there has been one. | |
| bool | ok () const |
| void | flush () |
Appends one row per measurement to a CSV file.
|
explicit |
Create the file and write the header row.
Throws std::runtime_error if the file cannot be opened. A setup boundary, and the right place to discover an unwritable path.
| void orrery::sim::DiagnosticsLog::record | ( | core::Index | step, |
| core::Real | time, | ||
| const core::Diagnostics & | diagnostics ) |
Write one row.
The first row measured fixes the reference the energy error is relative to, which is the initial state when a run starts and the state resumed from when it is resumed. That difference is real and is why the step number is in the file: an energy error column from a resumed run is relative to where that segment began, and a reader joining two segments has the information needed to notice.