Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
orrery::sim::FileOutput Class Referencefinal

Writes the trajectory, the diagnostics and the checkpoints a configuration asks for. More...

#include <orrery/sim/run_output.hpp>

Inheritance diagram for orrery::sim::FileOutput:
orrery::sim::RunOutput

Public Member Functions

 FileOutput (const Configuration &configuration, std::span< const core::Real > masses)
 Open what configuration asks for.
void record (const Simulation &simulation, bool is_final) override
 Record the current state of simulation.
core::Index frames_written () const noexcept
 How many trajectory frames have been written.
core::Index checkpoints_written () const noexcept
 How many checkpoints have been written.

Additional Inherited Members

Protected Member Functions inherited from orrery::sim::RunOutput
 RunOutput (const RunOutput &)=default
 RunOutput (RunOutput &&)=default
RunOutput & operator= (const RunOutput &)=default
RunOutput & operator= (RunOutput &&)=default

Detailed Description

Writes the trajectory, the diagnostics and the checkpoints a configuration asks for.

An output not given a path is not opened, so a run that names no files does no I/O and pays for none of this.

Constructor & Destructor Documentation

◆ FileOutput()

orrery::sim::FileOutput::FileOutput ( const Configuration & configuration,
std::span< const core::Real > masses )

Open what configuration asks for.

The masses are needed here rather than at the first frame because they go in the trajectory header, which is written when the file is created. They do not change during a run, which is the reason the format puts them there.

Throws std::runtime_error if a path cannot be opened. Deliberately at construction, which is before the first step, so that a run with an unwritable output directory stops immediately rather than after an hour of computing.

Member Function Documentation

◆ record()

void orrery::sim::FileOutput::record ( const Simulation & simulation,
bool is_final )
overridevirtual

Record the current state of simulation.

Called once before the first step and once after each step, with is_final true only on the last of those. An implementation decides for itself which of those calls it acts on.

May throw. This is called between steps rather than inside one, so the prohibition in section 4 of the implementation plan on exceptions leaving a kernel is not engaged, and a disc that has filled is something the person running the simulation has to be told about rather than something to carry on quietly without.

Implements orrery::sim::RunOutput.


The documentation for this class was generated from the following file: