-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.cpp
More file actions
66 lines (62 loc) · 2.2 KB
/
Copy pathinit.cpp
File metadata and controls
66 lines (62 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "init.hpp"
#include "datastructures.hpp"
#include "solver.hpp"
#include <fstream>
#ifdef gpp9
// gcc Version >= 9
#include "filesystem"
namespace filesystem = std::filesystem;
#else
// gcc Version < 9
#include "experimental/filesystem"
namespace filesystem = std::experimental::filesystem;
#endif // DEBUG
int read_parameters(filesystem::path filepath, Config& conf) {
std::ifstream file(filepath);
if (!file.is_open()) return -1;
std::string var;
std::string solver;
while (!file.eof() && file.good()) {
file >> var;
if (var[0] == '#') { /* ignore comment line*/
file.ignore(MAX_LINE_LENGTH, '\n');
}
else {
if (var == "xlength") file >> conf.xlength;
if (var == "ylength") file >> conf.ylength;
if (var == "Re") file >> conf.Re;
if (var == "t_end") file >> conf.t_end;
if (var == "dt") file >> conf.dt;
if (var == "omg") file >> conf.omg;
if (var == "eps") file >> conf.eps;
if (var == "tau") file >> conf.tau;
if (var == "alpha") file >> conf.alpha;
if (var == "dt_value") file >> conf.dt_value;
if (var == "UI") file >> conf.UI;
if (var == "VI") file >> conf.VI;
if (var == "GX") file >> conf.GX;
if (var == "GY") file >> conf.GY;
if (var == "PI") file >> conf.PI;
if (var == "itermax") file >> conf.itermax;
if (var == "imax") file >> conf.imax;
if (var == "jmax") file >> conf.jmax;
if (var == "problem") file >> conf.problem;
if (var == "geometry") file >> conf.geometry;
if (var == "PR") file >> conf.PR;
if (var == "TI") file >> conf.TI;
if (var == "T_h") file >> conf.T_h;
if (var == "T_c") file >> conf.T_c;
if (var == "beta") file >> conf.beta;
if (var == "calcTemp" ) file >> conf.calcTemp;
if (var == "iproc") file >> conf.iproc;
if (var == "jproc") file >> conf.jproc;
if (var == "levels") file >> conf.levels;
if (var == "solver") file >> solver;
}
}
if (!file.good() && !file.eof()) return -1;
conf.solver = Solver::string2type(solver);
conf.dx = conf.xlength / (double)(conf.imax);
conf.dy = conf.ylength / (double)(conf.jmax);
return 1;
}