]> git.treefish.org Git - phys/heatbath.git/blob - heatbath.cpp
...
[phys/heatbath.git] / heatbath.cpp
1 #include <complex>
2
3 #include "latlib/o815/o815.h"
4
5 #ifdef ALGORITHM_NOR
6 #define ALGORITHM "nor"
7 #include "sim-nor.hpp"
8 #elif ALGORITHM_R
9 #define ALGORITHM "r"
10 #include "sim-r.hpp"
11 #elif ALGORITHM_1MR
12 #define ALGORITHM "1mr"
13 #include "sim-1mr.hpp"
14 #else
15 #error NO UPDATE-ALGORITHM DEFINED!
16 #endif
17
18 o815 *O815;
19 sim *Sim;
20
21 const complex<double> _i_ = complex<double>(0.0,1.0);
22
23 #include "obs_phi2.hpp"
24 #include "obs_phi2_hist.hpp"
25 #include "obs_phip2_hist.hpp"
26
27 o815::comoption specOps[] = {
28   { "mass", required_argument, NULL, 'm', "set mass", "min:max:inc" },
29   { "", 0, NULL, 0, "", "" }
30 };
31
32 void parseSpecOps() 
33 {
34   for (int isopt = 0; isopt < O815->parsedSpecOps.size(); isopt++)
35     switch(O815->parsedSpecOps[isopt].first) {
36     case 'm':
37       O815->paraQ->addRange("mass", O815->parsedSpecOps[isopt].second);
38       break;
39     }
40 }
41
42 void helpHeader() 
43
44   cout << "Usage: ./heatbath-"ALGORITHM" [OPTIONS] [obs1] ... [obsN]" << endl << endl;
45 }
46
47 void parseLonelyArgs()
48 {
49   for (vector<char*>::iterator lonit = O815->lonelyArgs.begin(); lonit != O815->lonelyArgs.end(); ++lonit) {
50     if ( strcmp(*lonit, "phi2") == 0 ) {
51       *O815->out->log << "MASTER: registered observable: phi2" << endl << flush;
52       O815->observables.push_back(new obs_phi2(O815));
53     }
54     else if ( strcmp(*lonit, "phi2_hist") == 0 ) {
55       *O815->out->log << "MASTER: registered observable: phi2_hist" << endl << flush;
56       O815->observables.push_back(new obs_phi2_hist(O815));
57     }
58     else if ( strcmp(*lonit, "phip2_hist") == 0 ) {
59       *O815->out->log << "MASTER: registered observable: phip2_hist" << endl << flush;
60       O815->observables.push_back(new obs_phip2_hist(O815));
61     }
62   }
63 }
64
65 int main (int argc, char *argv[])
66 {
67   O815 = new o815(argc, argv, "heatbath-"ALGORITHM, specOps, &helpHeader);
68
69   O815->addPara("mass", 1);
70
71   parseSpecOps();
72
73   O815->postParaInit();
74
75   O815->Sim = new sim(O815);
76
77   parseLonelyArgs();
78   
79   O815->mainLoop();
80
81   delete O815;
82   return 0;
83 }