3FileOutput::FileOutput(std::string_view filename) : _filename(filename) {}
 
    5FileOutput::~FileOutput() {
 
    7  if (_ofstr.is_open()) {
 
   13void FileOutput::writeTableHeaderToDisk(
 
   14    const std::vector<std::string> &header) {
 
   18    if (!_ofstr.is_open()) {
 
   20      _ofstr.open(_filename.c_str(), std::ios::out);
 
   23    for (
const auto &record : header) {
 
   25      _ofstr << record << 
'\n';
 
   29  } 
catch (
const std::exception &e) {
 
   37void FileOutput::writeTableToDisk(
 
   38    const std::vector<std::vector<double>> &table) {
 
   42    if (!_ofstr.is_open()) {
 
   44      _ofstr.open(_filename.c_str(), std::ios::out);
 
   47    _ofstr.setf(std::ios::right);
 
   49    _ofstr << std::setprecision(5) << std::showpoint << std::scientific;
 
   51    size_t nj = table.size();
 
   53    size_t ni = table.begin()->size();
 
   57      for (
size_t i = 0; i < ni; i++) {
 
   59        for (
size_t j = 0; j < nj - 1; j++) {
 
   61          _ofstr << std::setw(12) << table.at(j).at(i) << 
'\t';
 
   64        _ofstr << std::setw(12) << table.at(nj - 1).at(i) << 
'\n';
 
   68    } 
catch (
const std::exception &e) {
 
   74  } 
catch (
const std::ofstream::failure &e) {