cpp/main.cpp

48 lines
1013 B
C++
Raw Permalink Normal View History

2024-11-10 14:52:54 +00:00
2024-11-11 10:03:02 +00:00
#include "utils/io.h"
#include "simulation/sims.h"
#include "motions/base.h"
2024-08-16 17:55:27 +00:00
#include "times/delta.h"
2024-09-16 17:52:51 +00:00
#include "times/lognormal.h"
2024-08-16 17:55:27 +00:00
2024-11-10 14:52:54 +00:00
#include <iostream>
#include <unordered_map>
#include <random>
2024-08-20 15:51:49 +00:00
int main (const int argc, char *argv[]) {
Arguments args;
try {
args = parse_args(argc, argv);
2024-11-10 14:52:54 +00:00
} catch (std::invalid_argument& error) {
2024-08-20 15:51:49 +00:00
std::cerr << error.what() << std::endl;
2024-08-18 11:21:27 +00:00
return 1;
}
2024-08-20 15:51:49 +00:00
std::unordered_map parameter { read_parameter(args.parameter_file) };
2024-08-16 17:55:27 +00:00
2024-11-11 13:07:21 +00:00
for (const auto& [key, value]: args.optional) {
parameter[key] = value;
}
2024-08-16 17:55:27 +00:00
std::random_device rd;
std::mt19937_64 rng(rd());
Motion *motion = Motion::createFromInput(args.motion_type, rng);
2024-09-16 17:52:51 +00:00
2024-11-04 17:09:25 +00:00
auto dist = DeltaDistribution(rng);
2024-11-04 18:39:53 +00:00
// auto dist = LogNormalDistribution(1, 2, rng); // arguments: tau_max, sigma
2024-08-16 17:55:27 +00:00
2024-08-20 15:51:49 +00:00
if (args.spectrum) {
run_spectrum(parameter, *motion, dist);
2024-08-20 15:51:49 +00:00
}
if (args.ste) {
run_ste(parameter, *motion, dist);
2024-08-20 15:51:49 +00:00
}
2024-11-10 14:52:54 +00:00
return 0;
2024-08-16 17:55:27 +00:00
}