Now config file handles most parameters (but not external potential)

This commit is contained in:
Yohai Meiron 2020-03-17 12:24:53 -04:00
parent bb9a343763
commit 9296db0609
6 changed files with 188 additions and 165 deletions

33
config.h Normal file
View file

@ -0,0 +1,33 @@
#pragma once
#include <string>
#include <unordered_map>
class Config {
public:
Config(std::string file_name);
double eps;
double t_end;
double dt_disk;
double dt_contr;
double dt_bh;
double eta;
std::string input_file_name;
bool dt_min_warning;
int live_smbh_count;
double live_smbh_custom_eps;
bool live_smbh_output;
bool live_smbh_neighbor_output;
int live_smbh_neighbor_number;
bool binary_smbh_pn;
bool binary_smbh_influence_sphere_output;
double binary_smbh_influence_radius_factor;
private:
using Dictionary = std::unordered_map<std::string,std::string>;
Dictionary read_config_file(const std::string file_name);
std::string strip(const std::string str);
template<typename T> T string_cast(const std::string str);
template<typename T> T get_parameter(Dictionary dictionary, std::string name);
template<typename T> T get_parameter(Dictionary dictionary, std::string name, T default_value);
void error_checking();
};