CHROMA
szin_io.cc
Go to the documentation of this file.
1 
2 /*! \file
3  * \brief Reader/writers for szin headers
4  */
5 
6 #include "chromabase.h"
7 #include "chroma_config.h"
8 #include "io/szin_io.h"
9 #include <time.h>
10 
11 namespace Chroma
12 {
13 
14  // Initialize header with default values
16  {
17  cfg_version = 7;
18 
19  FermTypeP = 0;
20  Nd = QDP::Nd;
21  Nc = QDP::Nc;
22  BetaMC = 0;
23  BetaMD = 0;
24 
25  KappaMC = 0;
26  KappaMD = 0;
27  MassMC = 0;
28  MassMD = 0;
29  dt = 0;
30  MesTrj = 0;
31  TotalCG = 0;
32  TotalTrj = 0;
33  spec_acc = 1;
34 
35  NOver = 0;
36  TotalTry = 0;
37  TotalFail = 0;
38  Nf = 0;
39  Npf = 0;
40  RefMomTrj = 0;
41  RefFnoiseTrj = 0;
42  LamPl = 0;
43  LamMi = 0;
44  AlpLog = 0;
45  AlpExp = 0;
46 
47  nrow = Layout::lattSize();
49 
51  banner += ", ";
52  banner += QDP_PACKAGE_STRING;
53 
54  {
55  time_t now;
56 
57  if(time(&now)==-1)
58  {
59  QDPIO::cerr<<"SzinGauge_t: cannot get the time.\n";
60  QDP_abort(1);
61  }
62  tm *tp = localtime(&now);
63 
64  char date_tmp[64];
65  strftime(date_tmp, 63, "%d %b %y %X %Z", tp);
66  date = date_tmp;
67  }
68  }
69 
70 
71 
72  // Source header read
73  void read(XMLReader& xml, const std::string& path, SzinGauge_t& header)
74  {
75  XMLReader paramtop(xml, path);
76 
77  read(paramtop, "cfg_version", header.cfg_version);
78 
79  read(paramtop, "date", header.date);
80  read(paramtop, "banner", header.banner);
81 
82  read(paramtop, "FermTypeP", header.FermTypeP);
83  read(paramtop, "Nd", header.Nd);
84  read(paramtop, "Nc", header.Nc);
85  read(paramtop, "BetaMC", header.BetaMC);
86  read(paramtop, "BetaMD", header.BetaMD);
87 
88  read(paramtop, "KappaMC", header.KappaMC);
89  read(paramtop, "KappaMD", header.KappaMD);
90  read(paramtop, "MassMC", header.MassMC);
91  read(paramtop, "MassMD", header.MassMD);
92  read(paramtop, "dt", header.dt);
93  read(paramtop, "MesTrj", header.MesTrj);
94  read(paramtop, "TotalCG", header.TotalCG);
95  read(paramtop, "TotalTrj", header.TotalTrj);
96  read(paramtop, "spec_acc", header.spec_acc);
97 
98  read(paramtop, "NOver", header.NOver);
99  read(paramtop, "TotalTry", header.TotalTry);
100  read(paramtop, "TotalFail", header.TotalFail);
101  read(paramtop, "Nf", header.Nf);
102  read(paramtop, "Npf", header.Npf);
103  read(paramtop, "RefMomTrj", header.RefMomTrj);
104  read(paramtop, "RefFnoiseTrj", header.RefFnoiseTrj);
105  read(paramtop, "LamPl", header.LamPl);
106  read(paramtop, "LamMi", header.LamMi);
107  read(paramtop, "AlpLog", header.AlpLog);
108  read(paramtop, "AlpExp", header.AlpExp);
109 
110  read(paramtop, "nrow", header.nrow);
111  read(paramtop, "seed", header.seed);
112  }
113 
114 
115  //! Source header writer
116  void write(XMLWriter& xml, const std::string& path, const SzinGauge_t& header)
117  {
118  push(xml, path);
119 
120  write(xml, "cfg_version", header.cfg_version);
121 
122  write(xml, "date", header.date);
123  write(xml, "banner", header.banner);
124 
125  write(xml, "FermTypeP", header.FermTypeP);
126  write(xml, "Nd", header.Nd);
127  write(xml, "Nc", header.Nc);
128  write(xml, "BetaMC", header.BetaMC);
129  write(xml, "BetaMD", header.BetaMD);
130 
131  write(xml, "KappaMC", header.KappaMC);
132  write(xml, "KappaMD", header.KappaMD);
133  write(xml, "MassMC", header.MassMC);
134  write(xml, "MassMD", header.MassMD);
135  write(xml, "dt", header.dt);
136  write(xml, "MesTrj", header.MesTrj);
137  write(xml, "TotalCG", header.TotalCG);
138  write(xml, "TotalTrj", header.TotalTrj);
139  write(xml, "spec_acc", header.spec_acc);
140 
141  write(xml, "NOver", header.NOver);
142  write(xml, "TotalTry", header.TotalTry);
143  write(xml, "TotalFail", header.TotalFail);
144  write(xml, "Nf", header.Nf);
145  write(xml, "Npf", header.Npf);
146  write(xml, "RefMomTrj", header.RefMomTrj);
147  write(xml, "RefFnoiseTrj", header.RefFnoiseTrj);
148  write(xml, "LamPl", header.LamPl);
149  write(xml, "LamMi", header.LamMi);
150  write(xml, "AlpLog", header.AlpLog);
151  write(xml, "AlpExp", header.AlpExp);
152 
153  write(xml, "nrow", header.nrow);
154  write(xml, "seed", header.seed);
155 
156  pop(xml);
157  }
158 
159 } // end namespace Chroma
static const char *const CHROMA_PACKAGE_STRING(PACKAGE_STRING)
Primary include file for CHROMA library code.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
void savern(int iseed[4])
Definition: make_seeds.cc:46
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
push(xml_out,"Condensates")
pop(xml_out)
::std::string string
Definition: gtest.h:1979
Szin gauge field header.
Definition: szin_io.h:17
std::string date
Definition: szin_io.h:54
QDP::Seed seed
Definition: szin_io.h:49
std::string banner
Definition: szin_io.h:53
multi1d< int > nrow
Definition: szin_io.h:20
Routines associated with SZIN gauge field IO.