19 {
20 argparse::ArgumentParser program("mps");
21
22 program.add_argument("-s", "--setting")
23 .required()
24 .help("path to setting file")
25 .action([](const std::string& value) {
26 if (!fs::exists(value)) {
27 cout << "ERROR: The setting file " << value << " does not exist" << endl;
28 cerr << "ERROR: The setting file " << value << " does not exist" << endl;
29 exit(-1);
30 }
31 cout << "Setting file: " << value << endl;
32 return value;
33 });
34
35 program.add_argument("-o", "--output")
36 .required()
37 .help("path to output directory")
38 .action([](const std::string& value) {
39 if (!fs::exists(value)) {
40 cout << "ERROR: The output directory " << value << " does not exist" << endl;
41 cerr << "ERROR: The output directory " << value << " does not exist" << endl;
42 exit(-1);
43 }
44 cout << "Output directory: " << value << endl;
45 fs::create_directories(value);
46 return value;
47 });
48
49
50
51
52 try {
53 program.parse_args(argc, argv);
54 } catch (const std::exception& err) {
55 cout << err.what() << endl;
56 cerr << err.what() << endl;
57 cerr << program;
58 exit(-1);
59 }
60
61
62 auto settingPath = fs::path(program.get<std::string>("--setting"));
63 auto outputDirectory = fs::path(program.get<std::string>("--output"));
64 Simulation simulation(settingPath, outputDirectory);
65 simulation.run();
66
67 return 0;
68}