Program Listing for File OutputManager.hpp
↰ Return to documentation for file (src/io/OutputManager.hpp)
#ifndef OUTPUTMANAGER_HPP
#define OUTPUTMANAGER_HPP
#include "SimControls.hpp"
#include <array>
#include <string>
#include <utility>
namespace core
{
class Cluster;
class Galaxy;
} // namespace core
namespace io
{
class OutputManager
{
public:
explicit OutputManager(const SimControls& simControls);
virtual ~OutputManager() = default;
// Disallow copying and moving: subclasses represent exclusive
// ownership of on-disk output, so duplicating them makes no sense
OutputManager(const OutputManager&) = delete;
auto operator=(const OutputManager&) -> OutputManager& = delete;
OutputManager(OutputManager&&) = delete;
auto operator=(OutputManager&&) -> OutputManager& = delete;
virtual void writeCluster(unsigned long trial, const core::Cluster& cluster) = 0;
virtual void writeClusterSpec(unsigned long trial, double time,
core::Cluster& cluster) = 0;
virtual void writeClusterPhot(unsigned long trial, double time,
core::Cluster& cluster) = 0;
virtual void writeClusterYields(unsigned long trial, double time,
core::Cluster& cluster) = 0;
virtual void writeGalaxy(unsigned long trial, double time,
core::Galaxy& galaxy) = 0;
virtual void writeGalaxySpec(unsigned long trial, double time,
core::Galaxy& galaxy) = 0;
virtual void writeGalaxyPhot(unsigned long trial, double time,
core::Galaxy& galaxy) = 0;
virtual void writeGalaxyYields(unsigned long trial, double time,
core::Galaxy& galaxy) = 0;
virtual void writeClusterFeedback(unsigned long trial, double time,
core::Cluster& cluster) = 0;
virtual void writeGalaxyFeedback(unsigned long trial, double time,
core::Galaxy& galaxy) = 0;
virtual void checkpoint(unsigned long trialsCompleted) = 0;
[[nodiscard]] virtual auto restartTrialsDone() const -> unsigned long = 0;
[[nodiscard]] virtual auto restartMaxTrial() const -> unsigned long = 0;
virtual void notifyEarlyTermination(unsigned long trialsCompleted) = 0;
protected:
static auto currentDateAndTime() -> std::pair<std::string, std::string>;
static auto currentRngStateString() -> std::string;
static auto feedbackRow(core::Cluster& cluster) -> std::array<double, 4>;
static auto feedbackRow(core::Galaxy& galaxy) -> std::array<double, 4>;
const SimControls& simControls_;
};
} // namespace io
#endif // OUTPUTMANAGER_HPP