17#include <fmt/format.h>
18#include <fmt/ranges.h>
21#include <magic_enum/magic_enum.hpp>
32 return magic_enum::enum_name(method);
39 throw std::logic_error(fmt::format(
40 "Default value of parameter {} has been already set to {}!", iter->second.first, iter->second.second));
49 throw std::logic_error(fmt::format(
"Method {} has been already set to {}!", iter->first, iter->second));
62 std::ios_base::out | std::ios_base::trunc };
64 if (not ofile.is_open())
66 throw std::runtime_error(fmt::format(
"Failed to open file {}",
filepath_));
87 std::ios_base::out | std::ios_base::trunc };
89 if (not ofile.is_open())
91 throw std::runtime_error(fmt::format(
"Can't open file {}",
parameter_file_));
94 ofile <<
"Parameter\n";
97 ofile << fmt::format(
"{} {:.1f} {:.1f}\n", par_id, values.first, values.second);
103 for (
const auto& [method, values] :
methods_)
105 ofile << fmt::format(
"method {} {} {}\n", method, values.first, values.second);
114 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)
static constexpr auto convert_method_to_str(Method) -> std::string_view
std::unordered_map< int, std::pair< float, float > > parameter_defaults_
void write_methods(std::ofstream &ofile)
void write_others(std::ofstream &ofile)