-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
63 lines (52 loc) · 1.76 KB
/
main.cpp
File metadata and controls
63 lines (52 loc) · 1.76 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
#include <Hadrons/Application.hpp>
#include <Hadrons/Modules.hpp>
#include <Modules.hpp>
using namespace Grid;
using namespace Hadrons;
int main(int argc, char *argv[]) {
if (argc < 2) {
std::cerr << "usage: " << argv[0] << " [parameter file] [Grid options]"
<< std::endl;
std::exit(EXIT_FAILURE);
}
// initialization //////////////////////////////////////////////////////////
Grid_init(&argc, &argv);
HadronsLogError.Active(GridLogError.isActive());
HadronsLogWarning.Active(GridLogWarning.isActive());
HadronsLogMessage.Active(GridLogMessage.isActive());
HadronsLogIterative.Active(GridLogIterative.isActive());
HadronsLogDebug.Active(GridLogDebug.isActive());
LOG(Message) << "Grid initialized" << std::endl;
// run setup ///////////////////////////////////////////////////////////////
Application app;
Application::GlobalPar par;
Application::ObjectId id;
std::string vecDesc, paramFile;
paramFile = argv[1];
XmlReader reader(paramFile, false, HADRONS_XML_TOPLEV);
read(reader, "parameters", par);
app.setPar(par);
if (!push(reader, "modules")) {
HADRONS_ERROR(Parsing, "Cannot open node 'modules' in parameter file '" +
paramFile + "'");
}
if (!push(reader, "module")) {
HADRONS_ERROR(Parsing,
"Cannot open node 'modules/module' in parameter file '" +
paramFile + "'");
}
do {
read(reader, "id", id);
// if (!myCreateModule(app, id.name, id.type, reader)) {
app.createModule(id.name, id.type, reader);
// }
} while (reader.nextElement("module"));
pop(reader);
pop(reader);
// execution
app.run();
// epilogue
LOG(Message) << "Grid is finalizing now" << std::endl;
Grid_finalize();
return EXIT_SUCCESS;
}