Program Listing for File OutputManagerAscii.hpp

↰ Return to documentation for file (src/io/OutputManagerAscii.hpp)

#ifndef OUTPUTMANAGERASCII_HPP
#define OUTPUTMANAGERASCII_HPP

#include "OutputManager.hpp"
#include "SimControls.hpp"
#include <fstream>
#include <vector>

namespace core
{
    class Cluster;
    class Galaxy;
} // namespace core

namespace io
{

    class OutputManagerAscii : public OutputManager
    {
    public:

        explicit OutputManagerAscii(const SimControls& simControls);

        ~OutputManagerAscii() override;

        OutputManagerAscii(const OutputManagerAscii&) = delete;
        auto operator=(const OutputManagerAscii&) -> OutputManagerAscii& = delete;
        OutputManagerAscii(OutputManagerAscii&&) = delete;
        auto operator=(OutputManagerAscii&&) -> OutputManagerAscii& = delete;

        void writeCluster(unsigned long trial, const core::Cluster& cluster) override;

        void writeClusterSpec(unsigned long trial, double time,
            core::Cluster& cluster) override;

        void writeClusterPhot(unsigned long trial, double time,
            core::Cluster& cluster) override;

        void writeClusterYields(unsigned long trial, double time,
            core::Cluster& cluster) override;

        void writeGalaxy(unsigned long trial, double time,
            core::Galaxy& galaxy) override;

        void writeGalaxySpec(unsigned long trial, double time,
            core::Galaxy& galaxy) override;

        void writeGalaxyPhot(unsigned long trial, double time,
            core::Galaxy& galaxy) override;

        void writeGalaxyYields(unsigned long trial, double time,
            core::Galaxy& galaxy) override;

        void writeClusterFeedback(unsigned long trial, double time,
            core::Cluster& cluster) override;

        void writeGalaxyFeedback(unsigned long trial, double time,
            core::Galaxy& galaxy) override;

        void checkpoint(unsigned long trialsCompleted) override;

        [[nodiscard]] auto restartTrialsDone() const -> unsigned long override;

        [[nodiscard]] auto restartMaxTrial() const -> unsigned long override;

        void notifyEarlyTermination(unsigned long trialsCompleted) override;

    private:

        void openClustersFile();

        void openClusterSpectraFile();

        void openClusterPhotFile();

        void openClusterYieldsFile();

        void openGalaxyFile();

        void openGalaxySpectraFile();

        void openGalaxyPhotFile();

        void openGalaxyYieldsFile();

        void openClusterFeedbackFile();

        void openGalaxyFeedbackFile();

        void openClusterNebLinesFile();

        void openGalaxyNebLinesFile();

        void writeClusterNebLines(unsigned long trial, double time, core::Cluster& cluster);

        void writeGalaxyNebLines(unsigned long trial, double time, core::Galaxy& galaxy);

        std::ofstream clustersFile_;
        std::ofstream clusterSpectraFile_;
        std::ofstream clusterPhotFile_;
        std::ofstream clusterYieldsFile_;
        std::ofstream clusterNebLinesFile_;
        std::ofstream galaxyFile_;
        std::ofstream galaxySpectraFile_;
        std::ofstream galaxyPhotFile_;
        std::ofstream galaxyYieldsFile_;
        std::ofstream clusterFeedbackFile_;
        std::ofstream galaxyFeedbackFile_;
        std::ofstream galaxyNebLinesFile_;
        std::vector<double> wlObs_;
        std::vector<int> photColWidths_;
        std::vector<int> photExtinctColWidths_;
        std::vector<int> photNebColWidths_;
        std::vector<int> photNebExtinctColWidths_;
        std::vector<int> yieldsColWidths_;
        int lineLabelWidth_ = 0;
    };

} // namespace io

#endif // OUTPUTMANAGERASCII_HPP