Simulation Archive

group SimulationArchiveFunctions

Functions for interacting with simulation archives

Functions

struct reb_simulation *reb_create_simulation_from_simulationarchive(struct reb_simulationarchive *sa, long snapshot)

Allocates a simulation and sets it to a specific snapshot in a SimulationArchive file.

struct reb_simulationarchive *reb_open_simulationarchive(const char *filename)

Opens a SimulationArchive.

This function opens a SimulationArchive file and creates an index to find snapshots within the file. This may take a few seconds if there are many snapshots in the file. Note that opening a file on a slow filesystem (for example via a network) might be partiucularly slow. The file is kept open until the user calls reb_close_simulationarchive.

Return
Returns a reb_simulationarchive struct.
Parameters
  • filename: The path and filename of the SimulationArchive input file.

void reb_close_simulationarchive(struct reb_simulationarchive *sa)

Closes a SimulationArchive.

This function closes a SimulationArchive that was previously opened by the reb_open_simulationarchive function. It also destroys the index created and frees the allocated memory.

Parameters
  • sa: The SimulationArchive to be closed.

void reb_simulationarchive_snapshot(struct reb_simulation *r, const char *filename)

Appends a SimulationArchive snapshot to a file.

This function can either be called manually or via one of the convenience methods reb_simulationarchive_automate_interval and reb_simulationarchive_automate_walltime. If the file does not exist, the function outputs a binary file. If a file exists, it appends a SimulationArchive snapshot to that file.

Parameters
  • r: The rebound simulation to be considered.
  • filename: The path and filename of the SimulationArchive output file.

void reb_simulationarchive_automate_interval(struct reb_simulation *const r, const char *filename, double interval)

Automatically create a SimulationArchive Snapshot at regular intervals.

Parameters
  • r: The rebound simulation to be considered.
  • filename: The path and filename of the SimulationArchive output file.
  • interval: The interval between snapshots (in simulation time units).

void reb_simulationarchive_automate_walltime(struct reb_simulation *const r, const char *filename, double walltime)

Automatically create a SimulationArchive Snapshot at regular walltime intervals.

Parameters
  • r: The rebound simulation to be considered.
  • filename: The path and filename of the SimulationArchive output file.
  • interval: The walltime interval between snapshots (in seconds).