Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
run_output.hpp File Reference

Where a run's results go, behind one interface so that the simulation does not know. More...

#include <filesystem>
#include <optional>
#include <span>
#include "orrery/core/types.hpp"
#include "orrery/sim/configuration.hpp"
#include "orrery/sim/diagnostics_log.hpp"
#include "orrery/sim/trajectory.hpp"

Go to the source code of this file.

Classes

class  orrery::sim::RunOutput
 Somewhere for a run to report itself to. More...
class  orrery::sim::FileOutput
 Writes the trajectory, the diagnostics and the checkpoints a configuration asks for. More...

Detailed Description

Where a run's results go, behind one interface so that the simulation does not know.

Simulation::run calls record once for the state it starts from and once after every step. What that means is entirely the output's business: the implementation here writes three files at three independent strides, the test suite uses one that keeps the states in memory so that a resumed run can be compared against an uninterrupted one bit for bit, and a renderer in a later phase would use one that draws.

The alternative, a simulation that opened files itself, would put the file formats on the include path of the class that owns the physics and would make the resume test impossible to write without a disc.

Strides

Each output has its own, in steps, and zero means the two ends of the run only. Writing every step is almost never right: the diagnostics cost an N^2 pass, and a trajectory of a million particles is 24 MB a frame in double precision, so a run that recorded each step would spend more time writing than integrating and would fill a disc in about a minute.