CHROMA
key_peram_distillution.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Key for propagator distillution matrix elements
4  */
5 
7 
8 namespace Chroma
9 {
10  //----------------------------------------------------------------------------
11  //! Diagnostics
12  StandardOutputStream& operator<<(StandardOutputStream& os, const KeyPeramDistillution_t& param)
13  {
14  os << "KeyPeramDistillution_t:";
15  os << " quark_line= " << param.quark_line;
16  os << " annihP= " << param.annihP;
17  os << " t_slice= " << param.t_slice;
18  os << " t_source= " << param.t_source;
19  os << " spin_snk= " << param.spin_snk;
20  os << " spin_src= " << param.spin_src;
21  os << " mass= " << param.mass;
22  os << std::endl;
23 
24  return os;
25  }
26 
27  //----------------------------------------------------------------------------
28  //! PeramDist reader
29  void read(BinaryReader& bin, KeyPeramDistillution_t& param)
30  {
31  read(bin, param.quark_line);
32  read(bin, param.annihP);
33  read(bin, param.t_slice);
34  read(bin, param.t_source);
35  read(bin, param.spin_src);
36  read(bin, param.spin_snk);
37  readDesc(bin, param.mass);
38  }
39 
40  //! PeramDist write
41  void write(BinaryWriter& bin, const KeyPeramDistillution_t& param)
42  {
43  write(bin, param.quark_line);
44  write(bin, param.annihP);
45  write(bin, param.t_slice);
46  write(bin, param.t_source);
47  write(bin, param.spin_src);
48  write(bin, param.spin_snk);
49  writeDesc(bin, param.mass);
50  }
51 
52  //! PeramDist reader
53  void read(XMLReader& xml, const std::string& path, KeyPeramDistillution_t& param)
54  {
55  XMLReader paramtop(xml, path);
56 
57  read(paramtop, "quark_line", param.quark_line);
58  read(paramtop, "annihP", param.annihP);
59  read(paramtop, "t_slice", param.t_slice);
60  read(paramtop, "t_source", param.t_source);
61  read(paramtop, "spin_src", param.spin_src);
62  read(paramtop, "spin_snk", param.spin_snk);
63  read(paramtop, "mass", param.mass);
64  }
65 
66  //! PeramDist writer
67  void write(XMLWriter& xml, const std::string& path, const KeyPeramDistillution_t& param)
68  {
69  push(xml, path);
70 
71  write(xml, "quark_line", param.quark_line);
72  write(xml, "annihP", param.annihP);
73  write(xml, "t_slice", param.t_slice);
74  write(xml, "t_source", param.t_source);
75  write(xml, "spin_src", param.spin_src);
76  write(xml, "spin_snk", param.spin_snk);
77  write(xml, "mass", param.mass);
78 
79  pop(xml);
80  }
81 
82 
83  //----------------------------------------------------------------------------
84  //! PeramDist reader
85  void read(BinaryReader& bin, ValPeramDistillution_t& param)
86  {
87  int nrows;
88  int ncols;
89  read(bin, nrows); // the size is always written, even if 0
90  read(bin, ncols); // the size is always written, even if 0
91  param.mat.resize(nrows,ncols);
92 
93  for(int j=0; j < param.mat.nrows(); ++j)
94  {
95  for(int i=0; i < param.mat.ncols(); ++i)
96  {
97  read(bin, param.mat(j,i));
98  }
99  }
100  }
101 
102  //! PeramDist write
103  void write(BinaryWriter& bin, const ValPeramDistillution_t& param)
104  {
105  write(bin, param.mat.nrows()); // always write the size
106  write(bin, param.mat.ncols()); // always write the size
107 
108  for(int j=0; j < param.mat.nrows(); ++j)
109  {
110  for(int i=0; i < param.mat.ncols(); ++i)
111  {
112  write(bin, param.mat(j,i));
113  }
114  }
115  }
116 
117 } // namespace Chroma
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.
Key for propagator distillution matrix elements.
unsigned j
Definition: ldumul_w.cc:35
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)
::std::string string
Definition: gtest.h:1979