Orrery
A GPU-accelerated N-body gravitational simulator
Toggle main menu visibility
Loading...
Searching...
No Matches
checkpoint.hpp
Go to the documentation of this file.
1
#pragma once
2
41
42
#include <cstdint>
43
#include <filesystem>
44
#include <string_view>
45
46
#include "
orrery/core/particle_data.hpp
"
47
#include "
orrery/core/types.hpp
"
48
#include "
orrery/sim/configuration.hpp
"
49
50
namespace
orrery::sim {
51
53
inline
constexpr
std::string_view
kCheckpointMagic
=
"ORRERYCK"
;
54
56
inline
constexpr
std::uint32_t
kCheckpointVersion
= 1;
57
59
struct
Checkpoint
{
62
Configuration
configuration
;
63
69
core::Index
step
= 0;
70
72
core::ParticleData
particles
;
73
};
74
85
void
write_checkpoint
(
const
std::filesystem::path& path,
const
Checkpoint
& checkpoint);
86
94
[[nodiscard]]
Checkpoint
read_checkpoint
(
const
std::filesystem::path& path);
95
96
}
// namespace orrery::sim
orrery::sim::write_checkpoint
void write_checkpoint(const std::filesystem::path &path, const Checkpoint &checkpoint)
Write checkpoint to path, atomically.
orrery::sim::read_checkpoint
Checkpoint read_checkpoint(const std::filesystem::path &path)
Read a checkpoint back.
orrery::sim::kCheckpointVersion
constexpr std::uint32_t kCheckpointVersion
The version of the layout in docs/formats/checkpoint.md.
Definition
checkpoint.hpp:56
orrery::sim::kCheckpointMagic
constexpr std::string_view kCheckpointMagic
The eight bytes every checkpoint starts with.
Definition
checkpoint.hpp:53
orrery::core::ParticleData
Storage for a set of point masses in structure-of-arrays layout.
Definition
particle_data.hpp:43
configuration.hpp
Everything a run is, as data.
particle_data.hpp
The particle store: one contiguous array per component.
orrery::sim::Checkpoint
A run, stopped.
Definition
checkpoint.hpp:59
orrery::sim::Checkpoint::particles
core::ParticleData particles
Positions, velocities, accelerations and masses, exactly as they were.
Definition
checkpoint.hpp:72
orrery::sim::Checkpoint::configuration
Configuration configuration
The settings the run was started with, including the ones the command line supplied rather than the f...
Definition
checkpoint.hpp:62
orrery::sim::Checkpoint::step
core::Index step
How many steps had been taken when this was written.
Definition
checkpoint.hpp:69
orrery::sim::Configuration
A whole run, as data.
Definition
configuration.hpp:332
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
checkpoint.hpp
Generated by
1.17.0