Skip to content

Commit e4fe7de

Browse files
committed
STY: astyle
1 parent e744ce0 commit e4fe7de

File tree

3 files changed

+71
-7
lines changed

3 files changed

+71
-7
lines changed

src/inputs.cpp

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,21 @@ Inputs::Inputs(Times &time) {
7474

7575
bool Inputs::write_restart() {
7676
bool didWork = true;
77+
7778
if (iProc == 0) {
7879
std::string filename = get_setting_str("Restart", "OutDir");
7980
filename = filename + "/settings.json";
8081
didWork = write_json(filename, settings);
8182
}
83+
8284
didWork = sync_across_all_procs(didWork);
8385
return didWork;
8486
}
8587

8688

8789
// -----------------------------------------------------------------------
8890
// General check functions to see if keys exist:
89-
// check settings and throw invalid_argument error
91+
// check settings and throw invalid_argument error
9092
// if the setting doesn't exist
9193
// -----------------------------------------------------------------------
9294

@@ -104,6 +106,7 @@ bool Inputs::check_settings(std::string key1,
104106
std::cout << "checking setting : "
105107
<< key1 << " and "
106108
<< key2 << "\n";
109+
107110
//try to find the keys first
108111
if (settings.find(key1) != settings.end()) {
109112
if (settings.at(key1).find(key2) != settings.at(key1).end())
@@ -116,6 +119,7 @@ bool Inputs::check_settings(std::string key1,
116119
report.error("Error in setting : " + key1 + " : " + key2);
117120
std::cout << "Missing setting called! [" << key1 << ", " << key2 << "]\n";
118121
}
122+
119123
return isOk;
120124
}
121125

@@ -125,6 +129,7 @@ bool Inputs::check_settings(std::string key1,
125129
bool Inputs::check_settings(std::string key1) {
126130
if (report.test_verbose(1))
127131
std::cout << "checking setting : " << key1 << "\n";
132+
128133
// try to find the keys first
129134
if (settings.find(key1) != settings.end())
130135
isOk = true;
@@ -137,6 +142,7 @@ bool Inputs::check_settings(std::string key1) {
137142
report.error("Error in setting : " + key1);
138143
std::cout << "Missing setting called! [" << key1 << "]\n";
139144
}
145+
140146
return isOk;
141147
}
142148

@@ -149,13 +155,16 @@ bool Inputs::check_settings(std::string key1) {
149155

150156
std::vector<int> Inputs::get_setting_intarr(std::string key1) {
151157
std::vector<int> value;
158+
152159
if (check_settings(key1)) {
153160
int nPts = settings.at(key1).size();
154161
isOk = true;
162+
155163
for (int i = 0; i < nPts; i++)
156164
value.push_back(settings.at(key1).at(i));
157165
} else
158166
isOk = false;
167+
159168
return value;
160169
}
161170

@@ -166,13 +175,17 @@ std::vector<int> Inputs::get_setting_timearr(std::string key1) {
166175
int nPtsTime = 7;
167176
std::vector<int> outarr(nPtsTime, 0);
168177
std::vector<int> timearr = get_setting_intarr(key1);
178+
169179
if (isOk) {
170180
int nPts = timearr.size();
181+
171182
if (nPts > nPtsTime)
172183
nPts = nPtsTime;
184+
173185
for (int i = 0; i < nPts; i++)
174186
outarr[i] = timearr[i];
175187
}
188+
176189
return outarr;
177190
}
178191

@@ -181,8 +194,10 @@ std::vector<int> Inputs::get_setting_timearr(std::string key1) {
181194

182195
std::string Inputs::get_setting_str(std::string key1) {
183196
std::string value = "unknown";
197+
184198
if (check_settings(key1))
185199
value = settings.at(key1);
200+
186201
return value;
187202
}
188203

@@ -192,8 +207,10 @@ std::string Inputs::get_setting_str(std::string key1) {
192207
std::string Inputs::get_setting_str(std::string key1,
193208
std::string key2) {
194209
std::string value = "unknown";
210+
195211
if (check_settings(key1, key2))
196212
value = settings.at(key1).at(key2);
213+
197214
return value;
198215
}
199216

@@ -205,15 +222,18 @@ std::string Inputs::get_setting_str(std::string key1,
205222
std::string key3) {
206223
std::string value = "unknown";
207224
isOk = false;
225+
208226
if (settings.find(key1) != settings.end())
209227
if (settings.at(key1).find(key2) != settings.at(key1).end())
210-
if (settings.at(key1).at(key2).find(key3) !=
228+
if (settings.at(key1).at(key2).find(key3) !=
211229
settings.at(key1).at(key2).end()) {
212230
value = settings.at(key1).at(key2).at(key3);
213231
isOk = true;
214232
}
233+
215234
if (!isOk)
216235
report.error("Error in setting : " + key1 + " : " + key2 + " : " + key3);
236+
217237
return value;
218238
}
219239

@@ -222,8 +242,10 @@ std::string Inputs::get_setting_str(std::string key1,
222242

223243
int64_t Inputs::get_setting_int(std::string key1) {
224244
int64_t value = LONG_MIN;
245+
225246
if (check_settings(key1))
226247
value = settings.at(key1);
248+
227249
return value;
228250
}
229251

@@ -233,8 +255,10 @@ int64_t Inputs::get_setting_int(std::string key1) {
233255
int64_t Inputs::get_setting_int(std::string key1,
234256
std::string key2) {
235257
int64_t value = LONG_MIN;
258+
236259
if (check_settings(key1, key2))
237260
value = settings.at(key1).at(key2);
261+
238262
return value;
239263
}
240264

@@ -243,8 +267,10 @@ int64_t Inputs::get_setting_int(std::string key1,
243267

244268
bool Inputs::get_setting_bool(std::string key1) {
245269
bool value = false;
270+
246271
if (check_settings(key1))
247272
value = settings.at(key1);
273+
248274
return value;
249275
}
250276

@@ -254,8 +280,10 @@ bool Inputs::get_setting_bool(std::string key1) {
254280
bool Inputs::get_setting_bool(std::string key1,
255281
std::string key2) {
256282
bool value = false;
283+
257284
if (check_settings(key1, key2))
258285
value = settings.at(key1).at(key2);
286+
259287
return value;
260288
}
261289

@@ -267,15 +295,18 @@ bool Inputs::get_setting_bool(std::string key1,
267295
std::string key3) {
268296
bool value = false;
269297
isOk = false;
298+
270299
if (settings.find(key1) != settings.end())
271300
if (settings.at(key1).find(key2) != settings.at(key1).end())
272-
if (settings.at(key1).at(key2).find(key3) !=
301+
if (settings.at(key1).at(key2).find(key3) !=
273302
settings.at(key1).at(key2).end()) {
274303
value = settings.at(key1).at(key2).at(key3);
275304
isOk = true;
276305
}
306+
277307
if (!isOk)
278308
report.error("Error in setting : " + key1 + " : " + key2 + " : " + key3);
309+
279310
return value;
280311
}
281312

@@ -284,8 +315,10 @@ bool Inputs::get_setting_bool(std::string key1,
284315

285316
precision_t Inputs::get_setting_float(std::string key1) {
286317
precision_t value = std::numeric_limits<precision_t>::lowest();
318+
287319
if (check_settings(key1))
288320
value = settings.at(key1);
321+
289322
return value;
290323
}
291324

@@ -295,8 +328,10 @@ precision_t Inputs::get_setting_float(std::string key1) {
295328
precision_t Inputs::get_setting_float(std::string key1,
296329
std::string key2) {
297330
precision_t value = std::numeric_limits<precision_t>::lowest();
331+
298332
if (check_settings(key1, key2))
299-
value = settings.at(key1).at(key2);
333+
value = settings.at(key1).at(key2);
334+
300335
return value;
301336
}
302337

@@ -305,12 +340,14 @@ precision_t Inputs::get_setting_float(std::string key1,
305340

306341
json Inputs::get_setting_json(std::string key1) {
307342
json value;
343+
308344
if (settings.find(key1) != settings.end())
309345
value = settings.at(key1);
310346
else {
311347
isOk = false;
312348
report.error("Error in setting : " + key1);
313349
}
350+
314351
return value;
315352
}
316353

@@ -320,17 +357,18 @@ json Inputs::get_setting_json(std::string key1) {
320357
json Inputs::get_setting_json(std::string key1,
321358
std::string key2) {
322359
json value;
360+
323361
if (settings.find(key1) != settings.end())
324362
if (settings.at(key1).find(key2) != settings.at(key1).end())
325363
value = settings.at(key1).at(key2);
326364
else {
327365
isOk = false;
328366
report.error("Error in setting : " + key1 + " : " + key2);
329-
}
330-
else {
367+
} else {
331368
isOk = false;
332369
report.error("Error in setting : " + key1);
333370
}
371+
334372
return value;
335373
}
336374

@@ -341,6 +379,7 @@ std::string Inputs::check_settings_str(std::string key1,
341379
std::string key2) {
342380
if (check_settings(key1, key2))
343381
return settings.at(key1).at(key2);
382+
344383
return dummy_string;
345384
}
346385

@@ -352,6 +391,7 @@ std::string Inputs::check_settings_str(std::string key) {
352391
isOk = false;
353392
return dummy_string;
354393
}
394+
355395
return settings[key];
356396
}
357397

@@ -362,6 +402,7 @@ precision_t Inputs::check_settings_pt(std::string key1,
362402
std::string key2) {
363403
if (check_settings(key1, key2))
364404
return settings.at(key1).at(key2);
405+
365406
isOk = false;
366407
return dummy_float;
367408
}
@@ -414,10 +455,12 @@ Inputs::grid_input_struct Inputs::get_grid_inputs() {
414455
bool Inputs::set_verbose(json in) {
415456
bool didWork = true;
416457
int iVerbose = -1;
458+
417459
// Want to set verbose level ASAP:
418460
if (in.contains("Debug")) {
419461
if (in.at("Debug").contains("iVerbose")) {
420462
iVerbose = in.at("Debug").at("iVerbose");
463+
421464
if (in.at("Debug").contains("iProc")) {
422465
if (iProc != in.at("Debug").at("iProc"))
423466
iVerbose = -1;
@@ -426,10 +469,12 @@ bool Inputs::set_verbose(json in) {
426469
didWork = false;
427470
} else
428471
didWork = false;
472+
429473
if (iVerbose > 0) {
430474
std::cout << "Setting iVerbose : " << iVerbose << "\n";
431475
report.set_verbose(iVerbose);
432476
}
477+
433478
return didWork;
434479
}
435480

@@ -440,6 +485,7 @@ bool Inputs::set_verbose(json in) {
440485
int Inputs::get_number_of_omniweb_files() {
441486
if (settings.find("OmniwebFiles") != settings.end())
442487
return settings.at("OmniwebFiles").size();
488+
443489
isOk = false;
444490
return dummy_int;
445491
}
@@ -451,8 +497,10 @@ int Inputs::get_number_of_omniweb_files() {
451497
std::vector<std::string> Inputs::get_omniweb_files() {
452498
std::vector<std::string> omniweb_files;
453499
int nFiles = get_number_of_omniweb_files();
500+
454501
for (int i = 0; i < nFiles; i++)
455502
omniweb_files.push_back(settings.at("OmniwebFiles").at(i));
503+
456504
return omniweb_files;
457505
}
458506

@@ -509,8 +557,10 @@ int Inputs::get_updated_seed() {
509557

510558
std::string Inputs::get_logfile() {
511559
std::string logfile = get_setting_str("Logfile", "name");
560+
512561
if (nMembers > 1)
513562
logfile = add_cmember(logfile);
563+
514564
return logfile;
515565
}
516566

@@ -521,8 +571,10 @@ std::string Inputs::get_logfile() {
521571
std::vector<std::string> Inputs::get_species_vector() {
522572
std::vector<std::string> species;
523573
const json &json_species = get_setting_json("Logfile", "species");
574+
524575
for (size_t iOutput = 0; iOutput < json_species.size(); iOutput++)
525576
species.push_back(json_species.at(iOutput));
577+
526578
return species;
527579
}
528580

@@ -533,8 +585,10 @@ std::vector<std::string> Inputs::get_species_vector() {
533585
std::vector<std::string> Inputs::get_satellite_files() {
534586
std::vector<std::string> files;
535587
const json &json_files = get_setting_json("Satellites", "files");
588+
536589
for (size_t i = 0; i < json_files.size(); ++i)
537590
files.push_back(json_files.at(i));
591+
538592
return files;
539593
}
540594

@@ -545,8 +599,10 @@ std::vector<std::string> Inputs::get_satellite_files() {
545599
std::vector<std::string> Inputs::get_satellite_names() {
546600
std::vector<std::string> names;
547601
const json &json_names = get_setting_json("Satellites", "names");
602+
548603
for (size_t i = 0; i < json_names.size(); ++i)
549604
names.push_back(json_names.at(i));
605+
550606
return names;
551607
}
552608

@@ -557,8 +613,10 @@ std::vector<std::string> Inputs::get_satellite_names() {
557613
std::vector<precision_t> Inputs::get_satellite_dts() {
558614
std::vector<precision_t> dts;
559615
const json &json_dts = get_setting_json("Satellites", "dts");
616+
560617
for (size_t i = 0; i < json_dts.size(); ++i)
561618
dts.push_back(json_dts.at(i));
619+
562620
return dts;
563621
}
564622

src/output.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ bool output(const Neutrals &neutrals,
157157
type_output == "states")
158158
for (int iSpecies = 0; iSpecies <= ions.nSpecies; iSpecies++)
159159
AllOutputContainers[iOutput].
160-
store_variable(ions.temperature_name + "_" +
160+
store_variable(ions.temperature_name + "_" +
161161
ions.species[iSpecies].cName,
162162
ions.temperature_unit,
163163
ions.species[iSpecies].temperature_scgc);

0 commit comments

Comments
 (0)