Skip to content

Commit 4a9c804

Browse files
committed
Allow more failures
1 parent cf3089b commit 4a9c804

File tree

1 file changed

+50
-52
lines changed

1 file changed

+50
-52
lines changed

src/read_input_file.cpp

Lines changed: 50 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -31,74 +31,72 @@ bool Inputs::read_inputs_json(Times &time) {
3131
isOk = set_verbose(settings);
3232

3333
try {
34-
3534
// Then read in user perturbations on those defaults:
3635
user_inputs = read_json("aether.json");
37-
isOk = set_verbose(user_inputs);
38-
39-
// Read in a restart file also if user specified it.
40-
// - Here we merge the restart inputs with the defaults inputs
41-
// - This is BEFORE the user inputs are merged!!!
42-
43-
if (user_inputs.contains("Restart")) {
44-
if (user_inputs["Restart"].contains("do")) {
45-
if (user_inputs["Restart"]["do"]) {
46-
std::string restart_file = get_setting_str("Restart", "InDir");
47-
restart_file = restart_file + "/settings.json";
48-
json restart_inputs;
49-
restart_inputs = read_json(restart_file);
50-
// This forces the logfile to append. User can override
51-
// if they really want:
52-
restart_inputs["Logfile"]["append"] = true;
53-
settings.merge_patch(restart_inputs);
54-
}
36+
} catch (...) {
37+
report.error("Error in reading inputs!");
38+
isOk = false;
39+
}
40+
41+
isOk = set_verbose(user_inputs);
42+
43+
// Read in a restart file also if user specified it.
44+
// - Here we merge the restart inputs with the defaults inputs
45+
// - This is BEFORE the user inputs are merged!!!
46+
if (user_inputs.contains("Restart")) {
47+
if (user_inputs["Restart"].contains("do")) {
48+
if (user_inputs["Restart"]["do"]) {
49+
std::string restart_file = get_setting_str("Restart", "InDir");
50+
restart_file = restart_file + "/settings.json";
51+
json restart_inputs;
52+
restart_inputs = read_json(restart_file);
53+
// This forces the logfile to append. User can override
54+
// if they really want:
55+
restart_inputs["Logfile"]["append"] = true;
56+
settings.merge_patch(restart_inputs);
5557
}
5658
}
59+
}
5760

58-
// Merge the defaults/restart settings with the user provided
59-
// settings, with the default/restart settings being the default:
60-
settings.merge_patch(user_inputs);
61-
62-
//change planet file to the one specified on aether.json:
63-
if (isOk)
64-
settings["PlanetSpeciesFile"] = get_setting_str("Planet", "file");
61+
// Merge the defaults/restart settings with the user provided
62+
// settings, with the default/restart settings being the default:
63+
settings.merge_patch(user_inputs);
6564

66-
std::string planet_filename = get_setting_str("PlanetSpeciesFile");
67-
report.print(1, "Using planet file : " + planet_filename);
65+
//change planet file to the one specified on aether.json:
66+
if (isOk)
67+
settings["PlanetSpeciesFile"] = get_setting_str("Planet", "file");
6868

69-
// Debug Stuff:
70-
if (isOk)
71-
report.set_verbose(get_setting_int("Debug", "iVerbose"));
69+
std::string planet_filename = get_setting_str("PlanetSpeciesFile");
70+
report.print(1, "Using planet file : " + planet_filename);
7271

73-
if (isOk)
74-
report.set_DefaultVerbose(get_setting_int("Debug", "iVerbose"));
72+
// Debug Stuff:
73+
if (isOk)
74+
report.set_verbose(get_setting_int("Debug", "iVerbose"));
7575

76-
if (isOk)
77-
report.set_doInheritVerbose(get_setting_bool("Debug", "doInheritVerbose"));
76+
if (isOk)
77+
report.set_DefaultVerbose(get_setting_int("Debug", "iVerbose"));
7878

79-
if (isOk)
80-
report.set_timing_depth(get_setting_int("Debug", "iTimingDepth"));
79+
if (isOk)
80+
report.set_doInheritVerbose(get_setting_bool("Debug", "doInheritVerbose"));
8181

82-
if (isOk)
83-
report.set_timing_percent(get_setting_float("Debug", "TimingPercent"));
82+
if (isOk)
83+
report.set_timing_depth(get_setting_int("Debug", "iTimingDepth"));
8484

85-
if (isOk)
86-
report.set_iProc(get_setting_int("Debug", "iProc"));
85+
if (isOk)
86+
report.set_timing_percent(get_setting_float("Debug", "TimingPercent"));
8787

88-
for (auto &item : settings["Debug"]["iFunctionVerbose"].items())
89-
report.set_FunctionVerbose(item.key(), item.value());
88+
if (isOk)
89+
report.set_iProc(get_setting_int("Debug", "iProc"));
9090

91-
// Capture time information:
92-
if (isOk)
93-
time.set_times(get_setting_timearr("StartTime"));
91+
for (auto &item : settings["Debug"]["iFunctionVerbose"].items())
92+
report.set_FunctionVerbose(item.key(), item.value());
9493

95-
if (isOk)
96-
time.set_end_time(get_setting_timearr("EndTime"));
94+
// Capture time information:
95+
if (isOk)
96+
time.set_times(get_setting_timearr("StartTime"));
9797

98-
} catch (...) {
99-
report.error("Error in reading inputs!");
100-
isOk = false;
101-
}
98+
if (isOk)
99+
time.set_end_time(get_setting_timearr("EndTime"));
102100

103101
return isOk;
104102
}

0 commit comments

Comments
 (0)