CHROMA
key_hadron_2pt_corr.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Hadron 2pt correlators
3  */
4 
6 
7 namespace Chroma
8 {
9 #if 0
10  namespace
11  {
12  //! Error output
13  std::ostream& operator<<(std::ostream& os, const Array<int>& d)
14  {
15  if (d.size() > 0)
16  {
17  os << d[0];
18 
19  for(int i=1; i < d.size(); ++i)
20  os << " " << d[i];
21  }
22 
23  return os;
24  }
25 
26  //! Error output
27  std::ostream& operator<<(std::ostream& os, const Array<ComplexD>& d)
28  {
29  if (d.size() > 0)
30  {
31  for(int i=0; i < d.size(); ++i)
32  {
33  if (i > 0)
34  os << " ";
35 
36  os << "(" << real(d[i]) << "," << imag(d[i]) << ")";
37  }
38  }
39 
40  return os;
41  }
42 
43  //! Error output
44  template<typename T>
45  std::ostream& operator<<(std::ostream& os, const std::vector<T>& d)
46  {
47  if (d.size() > 0)
48  {
49  os << d[0];
50 
51  for(int i=1; i < d.size(); ++i)
52  os << " " << d[i];
53  }
54 
55  return os;
56  }
57  }
58 
59 
60  //----------------------------------------------------------------------------
61  //! Used for error output
62  std::ostream& operator<<(std::ostream& os, const KeyHadron2PtCorr_t& d)
63  {
64  os << "KeyHadron2PtCorr_t:"
65  << " src_name= " << d.src_name
66  << " src_smear= " << d.src_smear
67  << " src_lorentz= " << d.src_lorentz
68  << " src_spin= " << d.src_spin
69  << " snk_name= " << d.snk_name
70  << " snk_smear= " << d.snk_smear
71  << " snk_lorentz= " << d.snk_lorentz
72  << " snk_spin= " << d.snk_spin
73  << " mass= " << d.mass
74  << " mom= " << d.mom
75  << " ensemble= " << d.ensemble
76  << " num_vecs= " << d.num_vecs
77  << std::endl;
78 
79  return os;
80  }
81 #endif
82 
83 
84  //----------------------------------------------------------------------------
85  // Read a key
86  void read(XMLReader& xml, const std::string& path, KeyHadron2PtCorr_t& param)
87  {
88  XMLReader paramtop(xml, path);
89 
90  read(paramtop, "num_vecs", param.num_vecs);
91  read(paramtop, "src_name", param.src_name);
92  read(paramtop, "src_smear", param.src_smear);
93  read(paramtop, "src_lorentz", param.src_lorentz);
94  read(paramtop, "src_spin", param.src_spin);
95  read(paramtop, "snk_name", param.snk_name);
96  read(paramtop, "snk_smear", param.snk_smear);
97  read(paramtop, "snk_lorentz", param.snk_lorentz);
98  read(paramtop, "snk_spin", param.snk_spin);
99  read(paramtop, "mom", param.mom);
100  read(paramtop, "mass", param.mass);
101  read(paramtop, "ensemble", param.ensemble);
102  }
103 
104  //! KeyHadron2PtCorr writer
105  void write(XMLWriter& xml, const std::string& path, const KeyHadron2PtCorr_t& param)
106  {
107  push(xml, path);
108 
109  write(xml, "num_vecs", param.num_vecs);
110  write(xml, "src_name", param.src_name);
111  write(xml, "src_smear", param.src_smear);
112  write(xml, "src_lorentz", param.src_lorentz);
113  write(xml, "src_spin", param.src_spin);
114  write(xml, "snk_name", param.snk_name);
115  write(xml, "snk_smear", param.snk_smear);
116  write(xml, "snk_lorentz", param.snk_lorentz);
117  write(xml, "snk_spin", param.snk_spin);
118  write(xml, "mom", param.mom);
119  write(xml, "mass", param.mass);
120  write(xml, "ensemble", param.ensemble);
121 
122  pop(xml);
123  }
124 
125 
126  //----------------------------------------------------------------------------
127  //! KeyHadron2PtCorr reader
128  void read(BinaryReader& bin, KeyHadron2PtCorr_t& param)
129  {
130  read(bin, param.src_name, 128);
131  read(bin, param.src_smear, 128);
132  read(bin, param.src_lorentz);
133  read(bin, param.src_spin);
134  read(bin, param.snk_name, 128);
135  read(bin, param.snk_smear, 128);
136  read(bin, param.snk_lorentz);
137  read(bin, param.snk_spin);
138  read(bin, param.mom);
139  read(bin, param.num_vecs);
140  read(bin, param.mass, 128);
141  read(bin, param.ensemble, 1024);
142  }
143 
144  //! Hadron2PtCorr write
145  void write(BinaryWriter& bin, const KeyHadron2PtCorr_t& param)
146  {
147  write(bin, param.src_name);
148  write(bin, param.src_smear);
149  write(bin, param.src_lorentz);
150  write(bin, param.src_spin);
151  write(bin, param.snk_name);
152  write(bin, param.snk_smear);
153  write(bin, param.snk_lorentz);
154  write(bin, param.snk_spin);
155  write(bin, param.mom);
156  write(bin, param.num_vecs);
157  write(bin, param.mass);
158  write(bin, param.ensemble);
159  }
160 
161 } // namespace Chroma
162 
163 
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.
Hadron 2pt correlators.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
QDP::StandardOutputStream & operator<<(QDP::StandardOutputStream &s, const multi1d< int > &d)
Definition: npr_vertex_w.cc:12
push(xml_out,"Condensates")
int i
Definition: pbg5p_w.cc:55
pop(xml_out)
DComplex d
Definition: invbicg.cc:99
::std::string string
Definition: gtest.h:1979
Key for Hadron 2pt corr.