55 "Usage: quartic [OPTION] <E> <alpha> <dim>\n\n" 56 "Calculate action for one-dimensional quartic potential\n" 57 "parameterized by E and alpha.\n\n" 58 "Example: quartic 1.0 0.6 3\n\n" 60 " -h, --help print this help message\n" 61 " -v, --verbose produce verbose output" 65 bool starts_with(
const std::string& option,
const std::string& prefix)
67 return !option.compare(0, prefix.size(), prefix);
73 const auto n_positional_args = args.size();
75 if (n_positional_args == 0) {
77 "value of E must be provided");
78 }
else if (n_positional_args == 1) {
80 "value of alpha must be provided");
81 }
else if (n_positional_args == 2) {
83 "number of dimensions must be provided");
84 }
else if (n_positional_args > 3) {
86 "unrecognized command line argument '" 91 options.
E = std::stod(args[0]);
92 }
catch (
const std::invalid_argument& e) {
94 "invalid value for E, '" + args[0] +
"'");
98 options.
alpha = std::stod(args[1]);
99 }
catch (
const std::invalid_argument& e) {
101 "invalid value for alpha, '" + args[1] +
"'");
105 options.
dim = std::stoi(args[2]);
106 }
catch (
const std::invalid_argument& e) {
108 "invalid number of dimensions '" + args[2] +
"'");
116 std::vector<std::string> positional_args;
119 const std::string opt(argv[i++]);
122 positional_args.push_back(opt);
126 if (opt ==
"-h" || opt ==
"--help") {
131 if (opt ==
"-v" || opt ==
"--verbose") {
137 "unrecognized command line argument '" + opt +
"'");
147 int main(
int argc,
const char* argv[])
152 std::cerr <<
"Usage: quartic [OPTION] <E> <alpha> <dim>\n" 153 <<
"Try 'quartic --help' for more information." 187 profiler.
solve(potential, false_min, true_min, barrier,
188 options.
dim, Shooting::Solver_options::Compute_action);
190 std::cout <<
"# E = " << options.
E 191 <<
", alpha = " << options.
alpha 192 <<
", dim = " << options.
dim 195 }
catch (
const Error& e) {
196 std::cerr <<
"Error: " << e.what() << std::endl;
197 exit_code = EXIT_FAILURE;
199 std::cerr <<
"Error: unrecognized error occurred." 201 exit_code = EXIT_FAILURE;
void set_shooting_rel_tol(double tol)
void parse_positional_args(const std::vector< std::string > &args, Fubini_options &options)
void set_max_iterations(int i)
Bubble_profiler_inputs parse_cmd_line_args(int argc, const char *argv[])
void solve(const std::function< double(double)> &potential_, const std::function< double(double)> &potential_first_, const std::function< double(double)> &potential_second_, double false_min_, double true_min_, double barrier_, int dim_=3, unsigned int options=(Solver_options::Compute_action|Solver_options::Compute_profile))
void set_bisect_lambda_max(double l)
double get_global_minimum_location() const
static Logging_manager & get_manager()
double get_euclidean_action() const
void set_f_y_max(double f)
int main(int argc, const char *argv[])
void set_action_rel_tol(double tol)
void set_minimum_log_level(Log_level level)
void set_f_y_min(double f)
double get_local_maximum_location() const
void set_action_arrived_rel(double tol)
void set_action_abs_tol(double tol)
void set_max_periods(double p)
void set_drho_frac(double frac)
double get_local_minimum_location() const
Solve the one-dimensional problem using the shooting method.
Exception indicating general setup error.
One-dimensional shooting method.
bool starts_with(const std::string &option, const std::string &prefix)
void set_shooting_abs_tol(double tol)
void set_bisection_precision_bits(int b)