-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
67 lines (55 loc) · 1.64 KB
/
main.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
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
67
#include <iostream>
#include <fstream>
#include <yaml-cpp/yaml.h>
#include "CSimulatedDiffusion.h"
int main(int argc, const char* argv[])
{
string entryStr;
CSimulatedDiffusion* simulation;
if (argc >= 2)
{
std::ifstream fin(argv[1]);
YAML::Parser parser(fin);
YAML::Node descriptionNode;
// Go through all simulations defined in the yaml file
while(parser.GetNextDocument(descriptionNode))
{
simulation = new CSimulatedDiffusion;
// Load the voronoi mesh
descriptionNode["voronoimesh"] >> entryStr;
if (strcmp(entryStr.c_str(), "none") != 0)
{
simulation->loadFile(entryStr);
}
else
{
cout << "No mesh" << endl;
}
cout << endl;
// Name of the result file
descriptionNode["resultfile"] >> entryStr;
simulation->outputFileStr = entryStr;
// pjump
descriptionNode["pjump"] >> entryStr;
simulation->pjump = atof(entryStr.c_str());
// Time
descriptionNode["Tmax"] >> entryStr;
simulation->Tmax = atof(entryStr.c_str());
// Write simulation parameters
cout << "Output file: \t" << simulation->outputFileStr << endl;
cout << "Pjump: \t\t" << simulation->pjump << endl;
cout << "Tmax: \t\t" << simulation->Tmax << " s" << endl;
// Start the simulation
cout << endl;
cout << "Simulating..." << endl << endl;
simulation->start();
cout << "Done!" << endl << endl;
cout << "-------------------------------" << endl << endl;
// Delete the simulation to free memory
delete simulation;
}
cout << "All simulations finished." << endl << endl;
cin >> argc;
}
return 0;
}