|
Orrery
A GPU-accelerated N-body gravitational simulator
|
Reads the format above. More...
#include <orrery/sim/trajectory.hpp>
Public Member Functions | |
| TrajectoryReader (const std::filesystem::path &path) | |
| Open the file and read its header. | |
| const TrajectoryInfo & | info () const noexcept |
| std::span< const core::Real > | masses () const noexcept |
| The masses from the header, in the order the frames use. | |
| bool | read_frame (TrajectoryFrame &frame) |
| Read the next frame into frame, or return false at the end of the file. | |
Reads the format above.
The intended use is a loop over read_frame until it returns false, which happens at a clean end of file. Anything else, a truncated frame or one whose checksum does not match, throws instead, so that a reader cannot mistake a damaged file for a short run.
|
explicit |
Open the file and read its header.
Throws std::runtime_error if the file cannot be opened, does not carry the magic, is of an unknown version, or was written by a build of the other precision.
|
nodiscard |
Read the next frame into frame, or return false at the end of the file.
frame is resized as needed and may be reused across calls, which is what keeps reading a long trajectory free of allocation after the first frame.
Throws std::runtime_error on a partial or corrupt frame.