LatticeYangMills
jsoninput.cpp
1 #include <iostream>
2 #include <fstream>
3 #include "Utils/clusterspecifier.h"
4 #ifdef LACONIA
5 #include <mpi.h>
6 #else
7 #include <mpi/mpi.h>
8 #endif
9 
10 #include "lqcd.h"
11 
12 namespace LatticeIO {
13  namespace JsonInput {
14 
15  nlohmann::json jsonFile;
16 
17  // Validate inputfile
18  void parseInput(int argn, char* argv[]){
19  if(argn != 2){
20  std::cerr << "LatticeQCD Error: wrong numper of "
21  "command line arguments provided.\n";
22  exit(1);
23  }
24 
25  // read JSON file
26  std::ifstream inputFile(argv[1]);
27  inputFile >> jsonFile;
28 
29  // Validate app type, app and instantiate class
30  validateAppType();
31 
32  // Validate lattice, sublattice and initialize Parallel geometry
33  validateLatticeInput();
34  validateSubLatticeInput();
35 
36  // Validate action (if needed) and instantiate
37  validateAction();
38 
39  // Validate observables list and instantiate
40  validateObservables();
41 
42  // Validate directories and register
43  validateDirectories();
44  }
45 
46  void initApp(App*& app){
47  registerApp(app);
48  registerAction(app);
49  registerObservables(app);
50  registerDirectories();
51  }
52 
53  } // end JsonInput
54 } // end LatticeIO
Main include file for all headers.
Prototype for the App class group.
Definition: app.h:59