Orrery
A GPU-accelerated N-body gravitational simulator
Toggle main menu visibility
Loading...
Searching...
No Matches
diagnostics_log.hpp
Go to the documentation of this file.
1
#pragma once
2
32
33
#include <filesystem>
34
#include <fstream>
35
#include <optional>
36
37
#include "
orrery/core/diagnostics.hpp
"
38
#include "
orrery/core/types.hpp
"
39
40
namespace
orrery::sim {
41
43
class
DiagnosticsLog
{
44
public
:
49
explicit
DiagnosticsLog
(
const
std::filesystem::path& path);
50
59
void
record
(
core::Index
step, core::Real time,
const
core::Diagnostics
& diagnostics);
60
62
[[nodiscard]] std::optional<core::Real>
reference_energy
() const noexcept {
63
return
reference_energy_;
64
}
65
66
[[nodiscard]]
bool
ok()
const
{
return
file_.good(); }
67
68
void
flush() { file_.flush(); }
69
70
private
:
71
std::ofstream file_;
72
std::optional<core::Real> reference_energy_;
73
};
74
75
}
// namespace orrery::sim
orrery::sim::DiagnosticsLog::record
void record(core::Index step, core::Real time, const core::Diagnostics &diagnostics)
Write one row.
orrery::sim::DiagnosticsLog::DiagnosticsLog
DiagnosticsLog(const std::filesystem::path &path)
Create the file and write the header row.
orrery::sim::DiagnosticsLog::reference_energy
std::optional< core::Real > reference_energy() const noexcept
The total energy of the first row, if there has been one.
Definition
diagnostics_log.hpp:62
diagnostics.hpp
The conserved quantities, which are how this project knows it is right.
orrery::core::Diagnostics
Every conserved quantity of a configuration, measured at one instant.
Definition
diagnostics.hpp:52
types.hpp
The scalar and index types that every layer of the project agrees on.
orrery::core::Index
std::size_t Index
The type of a particle index and of any count of particles.
Definition
types.hpp:45
orrery
sim
diagnostics_log.hpp
Generated by
1.17.0