CHROMA
inline_polylp.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Inline polyakov loop
3  */
4 
7 #include "meas/glue/polylp.h"
9 
12 
13 namespace Chroma
14 {
15 
16  namespace InlinePolyakovLoopEnv
17  {
18  namespace
19  {
20  AbsInlineMeasurement* createMeasurement(XMLReader& xml_in,
21  const std::string& path)
22  {
23  Params p(xml_in, path);
24  return new InlineMeas(p);
25  }
26 
27  //! Local registration flag
28  bool registered = false;
29  }
30 
31  const std::string name = "POLYAKOV_LOOP";
32 
33  //! Register all the factories
34  bool registerAll()
35  {
36  bool success = true;
37  if (! registered)
38  {
40  success &= TheInlineMeasurementFactory::Instance().registerObject(name, createMeasurement);
41  registered = true;
42  }
43  return success;
44  }
45  }
46 
47 
48 
49  namespace InlinePolyakovLoopEnv
50  {
51  //! PolyakovLoop input
52  void read(XMLReader& xml, const std::string& path, Params::Param_t& param)
53  {
54  XMLReader paramtop(xml, path);
55 
56  int version;
57  read(paramtop, "version", version);
58 
59  switch (version)
60  {
61  case 2:
62  if (paramtop.count("GaugeState") != 0)
63  param.cgs = readXMLGroup(paramtop, "GaugeState", "Name");
64  else
66  break;
67 
68  default:
69  QDPIO::cerr << "InlinePolyakovLoopParams::Param_t: " << version
70  << " unsupported." << std::endl;
71  QDP_abort(1);
72  }
73  }
74 
75  //! PolyakovLoop output
76  void write(XMLWriter& xml, const std::string& path, const Params::Param_t& param)
77  {
78  push(xml, path);
79 
80  int version = 2;
81  write(xml, "version", version);
82  xml << param.cgs.xml;
83 
84  pop(xml);
85  }
86 
87 
88  //! PolyakovLoop input
89  void read(XMLReader& xml, const std::string& path, Params::NamedObject_t& input)
90  {
91  XMLReader inputtop(xml, path);
92 
93  read(inputtop, "gauge_id", input.gauge_id);
94  }
95 
96  //! PolyakovLoop output
97  void write(XMLWriter& xml, const std::string& path, const Params::NamedObject_t& input)
98  {
99  push(xml, path);
100 
101  write(xml, "gauge_id", input.gauge_id);
102 
103  pop(xml);
104  }
105 
106 
107  // Params
109  {
110  frequency = 0;
112  }
113 
114  Params::Params(XMLReader& xml_in, const std::string& path)
115  {
116  try
117  {
118  XMLReader paramtop(xml_in, path);
119 
120  if (paramtop.count("Frequency") == 1)
121  read(paramtop, "Frequency", frequency);
122  else
123  frequency = 1;
124 
125  // Params
126  read(paramtop, "Param", param);
127 
128  // Ids
129  read(paramtop, "NamedObject", named_obj);
130  }
131  catch(const std::string& e)
132  {
133  QDPIO::cerr << "Caught Exception reading XML: " << e << std::endl;
134  QDP_abort(1);
135  }
136  }
137 
138 
139  void
140  InlineMeas::operator()(unsigned long update_no,
141  XMLWriter& xml_out)
142  {
143  START_CODE();
144 
145  // Grab the object
146  multi1d<LatticeColorMatrix> u =
147  TheNamedObjMap::Instance().getData< multi1d<LatticeColorMatrix> >(params.named_obj.gauge_id);
148 
149  push(xml_out, "PolyakovLoop");
150  write(xml_out, "update_no", update_no);
151 
152  multi1d<DComplex> polyloop;
153  polylp(u, polyloop);
154 
155  write(xml_out, "poly_loop", polyloop);
156 
157  pop(xml_out); // pop("PolyakovLoop");
158 
159  END_CODE();
160  }
161 
162  }
163 
164 }
Inline measurement factory.
void operator()(unsigned long update_no, XMLWriter &xml_out)
Do the measurement.
static T & Instance()
Definition: singleton.h:432
All gauge create-state method.
Gauge create state factory.
void polylp(const multi1d< LatticeColorMatrixF3 > &u, DComplex &poly_loop, int mu)
Compute Polyakov loop.
Definition: polylp.cc:40
GroupXML_t readXMLGroup(XMLReader &xml_in, const std::string &path, const std::string &type_name)
Read group and return as a std::string.
Inline polyakov loop.
Named object function std::map.
static bool registered
Local registration flag.
bool registerAll()
Register all the factories.
GroupXML_t nullXMLGroup()
Returns a simple createstate group.
bool registerAll()
Register all the factories.
void write(XMLWriter &xml, const std::string &path, const Params::Param_t &param)
PolyakovLoop output.
void read(XMLReader &xml, const std::string &path, Params::Param_t &param)
PolyakovLoop input.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
push(xml_out,"Condensates")
pop(xml_out)
START_CODE()
::std::string string
Definition: gtest.h:1979
Calculate the global normalized sum of the Polyakov loop.
struct Chroma::InlinePolyakovLoopEnv::Params::Param_t param
struct Chroma::InlinePolyakovLoopEnv::Params::NamedObject_t named_obj