/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/configuration_helper.hh Source File#

DiFfRG: /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/configuration_helper.hh Source File
DiFfRG
Discretization Framework for functional Renormalization Group flows
configuration_helper.hh
Go to the documentation of this file.
1#pragma once
2
3// standard library
4#include <list>
5#include <string>
6
7// DiFfRG
9
10namespace DiFfRG
11{
16 {
17 public:
28 ConfigurationHelper(int argc, char *argv[], const std::string parameter_file = "parameter.json");
29
34
39
43 void append(std::string arg);
44
49
53 const ConfigTree &get_config() const;
54
60 [[deprecated("Use get_config() instead")]] ConfigTree &get_json();
61
67 [[deprecated("Use get_config() instead")]] const ConfigTree &get_json() const;
68
69 [[deprecated("Use OutputPath(config).run_file(\".log\").filename().string() instead")]] std::string
70 get_log_file() const;
71 std::string get_parameter_file() const;
72 [[deprecated("Use OutputPath(config).run_name() instead")]] std::string get_output_name() const;
73 [[deprecated("Use OutputPath(config).field_directory() instead")]] std::string get_output_folder() const;
74 [[deprecated("Use OutputPath(config).root() instead")]] std::string get_top_folder() const;
75
87 static ConfigTree probe(int argc, char *argv[], const std::string parameter_file = "parameter.json");
88
89 private:
91
92 void parse();
93 void parse_cli();
96
97 std::list<std::string> args;
98 std::list<std::pair<std::string, std::string>> cli_parameters;
99
101
102 bool parsed = false;
103
104 std::string parameter_file;
105
109
112 bool quiet = false;
113 };
114} // namespace DiFfRG
A hierarchical configuration tree, readable from JSON and TOML files.
Definition config_tree.hh:32
Class to read parameters given from the command line and from a parameter file.
Definition configuration_helper.hh:16
bool quiet
Definition configuration_helper.hh:112
ConfigTree & get_json()
Obtain the configuration tree containing all the parameters.
std::string parameter_file
Definition configuration_helper.hh:104
void append(std::string arg)
Add a CLI-like argument to the list of arguments.
ConfigurationHelper(int argc, char *argv[], const std::string parameter_file="parameter.json")
Construct a new Configuration Helper object To get an overview of the available arguments,...
const ConfigTree & get_config() const
Obtain the configuration tree containing all the parameters.
std::string get_output_name() const
std::string get_log_file() const
ConfigTree & get_config()
Obtain the configuration tree containing all the parameters.
bool parsed
Definition configuration_helper.hh:102
std::string get_parameter_file() const
const ConfigTree & get_json() const
Obtain the configuration tree containing all the parameters.
ConfigTree config
Definition configuration_helper.hh:100
std::list< std::pair< std::string, std::string > > cli_parameters
Definition configuration_helper.hh:98
std::string get_top_folder() const
ConfigurationHelper(const ConfigurationHelper &)
Copy a Configuration Helper.
std::string get_output_folder() const
ConfigurationHelper(const ConfigTree &config)
Construct a new Configuration Helper object from a ConfigTree object.
std::list< std::string > args
Definition configuration_helper.hh:97
bool parameter_file_explicit
Definition configuration_helper.hh:108
static ConfigTree probe(int argc, char *argv[], const std::string parameter_file="parameter.json")
Read the configuration without producing any diagnostics or terminating.
Definition complex_math.hh:10