16#include <fmt/format.h>
17#include <fmt/ranges.h>
31 throw std::logic_error(fmt::format(
32 "Default value of parameter {} has been already set to {}!", iter->second.first, iter->second.second));
41 throw std::logic_error(fmt::format(
"Method {} has been already set to {}!", iter->first, iter->second));
53 auto ofile = std::ofstream{
filepath_, std::ios_base::out | std::ios_base::trunc };
55 if (not ofile.is_open())
57 throw std::runtime_error(fmt::format(
"Failed to open file {}",
filepath_));
77 auto ofile = std::ofstream{
parameter_file_, std::ios_base::out | std::ios_base::trunc };
79 if (not ofile.is_open())
81 throw std::runtime_error(fmt::format(
"Can't open file {}",
parameter_file_));
84 ofile <<
"Parameter\n";
87 ofile << fmt::format(
"{} {:.1f} {:.1f}\n", par_id, values.first, values.second);
93 for (
const auto& [method, values] :
methods_)
95 ofile << fmt::format(
"method {} {} {}\n", method, values.first, values.second);
104 ofile << fmt::format(
"{}\n", fmt::join(other,
" "));
std::string data_filepath_
std::vector< std::vector< std::string > > other_options_
std::string parameter_file_
void write_data_file(std::ofstream &ofile)
void add_method(Method method, const std::pair< float, float > &values)
void write_parameter_defaults()
std::map< Method, std::pair< float, float > > methods_
void add_other_options(std::vector< std::string > options)
void add_parameter_default(int par_num, const std::pair< float, float > &values)
std::unordered_map< int, std::pair< float, float > > parameter_defaults_
void write_methods(std::ofstream &ofile)
void write_others(std::ofstream &ofile)