-
Notifications
You must be signed in to change notification settings - Fork 0
/
Input.cpp
40 lines (33 loc) · 1.37 KB
/
Input.cpp
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
#include <iostream>
#include <fstream>
#include "Input.h"
void Input::ReadInputFile(std::string dirName){
DirName = dirName;
std::cout << "ReadInputFile ... " << std::endl;
std::string fname = DirName + "/input/input.txt";
std::ifstream fin(fname);
if(!fin){
std::cout << "Error: cannot open input file." << std::endl;
exit(1);
}
std::string dummy;
fin >> dummy; fin >> SH_Type; std::cout << "SH_Type: " << SH_Type << std::endl;
fin >> dummy; fin >> Dt; std::cout << "Dt: " << Dt << std::endl;
fin >> dummy; fin >> Dx; std::cout << "Dx: " << Dx << std::endl;
fin >> dummy; fin >> Nx; std::cout << "Nx: " << Nx << std::endl;
fin >> dummy; fin >> Ny; std::cout << "Ny: " << Ny << std::endl;
fin >> dummy; fin >> NumIteration; std::cout << "NumIteration: " << NumIteration << std::endl;
fin >> dummy; fin >> OutputStep; std::cout << "OutputStep: " << OutputStep << std::endl;
fin >> dummy; fin >> NumThread; std::cout << "NumThread: " << NumThread << std::endl;
fin >> dummy; fin >> InputInitMode; std::cout << "InputInitMode: " << InputInitMode << std::endl;
fin >> dummy; fin >> InputInitFileName;
if(InputInitMode == 1) std::cout << "InputInitFileName: " << InputInitFileName << std::endl;
std::string check;
fin >> check;
if(check != "End"){
std::cout << "Error: invalid input file." << std::endl;
exit(1);
}
fin.close();
std::cout << "done." << std::endl;
}