CHROMA
inline_fuzwilp.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Inline fuzzed Wilson loops
3  */
4 
5 #include "chromabase.h"
7 #include "meas/glue/fuzwilp.h"
10 
11 
12 using namespace QDP;
13 
14 namespace Chroma
15 {
16  namespace InlineFuzzedWilsonLoopEnv
17  {
18  namespace
19  {
20  AbsInlineMeasurement* createMeasurement(XMLReader& xml_in,
21  const std::string& path)
22  {
23  return new InlineFuzzedWilsonLoop(InlineFuzzedWilsonLoopParams(xml_in, path));
24  }
25 
26  //! Local registration flag
27  bool registered = false;
28  }
29 
30  const std::string name = "FUZZED_WILSON_LOOP";
31 
32  //! Register all the factories
33  bool registerAll()
34  {
35  bool success = true;
36  if (! registered)
37  {
38  success &= TheInlineMeasurementFactory::Instance().registerObject(name, createMeasurement);
39  registered = true;
40  }
41  return success;
42  }
43  }
44 
45 
46  //! FuzzedWilsonLoop input
47  void read(XMLReader& xml, const std::string& path, InlineFuzzedWilsonLoopParams::Param_t& input)
48  {
49  XMLReader inputtop(xml, path);
50 
51  read(inputtop, "j_decay", input.j_decay);
52  read(inputtop, "tmax", input.tmax);
53  read(inputtop, "n_smear", input.n_smear);
54  read(inputtop, "sm_fact", input.sm_fact);
55  read(inputtop, "BlkMax", input.BlkMax);
56  read(inputtop, "BlkAccu", input.BlkAccu);
57  }
58 
59  //! FuzzedWilsonLoop output
60  void write(XMLWriter& xml, const std::string& path, const InlineFuzzedWilsonLoopParams::Param_t& input)
61  {
62  push(xml, path);
63 
64  write(xml, "j_decay", input.j_decay);
65  write(xml, "tmax", input.tmax);
66  write(xml, "n_smear", input.n_smear);
67  write(xml, "sm_fact", input.sm_fact);
68  write(xml, "BlkMax", input.BlkMax);
69  write(xml, "BlkAccu", input.BlkAccu);
70 
71  pop(xml);
72  }
73 
74 
75  //! FuzzedWilsonLoop input
76  void read(XMLReader& xml, const std::string& path, InlineFuzzedWilsonLoopParams::NamedObject_t& input)
77  {
78  XMLReader inputtop(xml, path);
79 
80  read(inputtop, "gauge_id", input.gauge_id);
81  }
82 
83  //! FuzzedWilsonLoop output
84  void write(XMLWriter& xml, const std::string& path, const InlineFuzzedWilsonLoopParams::NamedObject_t& input)
85  {
86  push(xml, path);
87 
88  write(xml, "gauge_id", input.gauge_id);
89 
90  pop(xml);
91  }
92 
93 
94  // Params
95  InlineFuzzedWilsonLoopParams::InlineFuzzedWilsonLoopParams()
96  {
97  frequency = 0;
98  }
99 
100  InlineFuzzedWilsonLoopParams::InlineFuzzedWilsonLoopParams(XMLReader& xml_in, const std::string& path)
101  {
102  try
103  {
104  XMLReader paramtop(xml_in, path);
105 
106  if (paramtop.count("Frequency") == 1)
107  read(paramtop, "Frequency", frequency);
108  else
109  frequency = 1;
110 
111  // params
112  read(paramtop, "Param", param);
113 
114  // Ids
115  read(paramtop, "NamedObject", named_obj);
116  }
117  catch(const std::string& e)
118  {
119  QDPIO::cerr << "Caught Exception reading XML: " << e << std::endl;
120  QDP_abort(1);
121  }
122  }
123 
124  void
125  InlineFuzzedWilsonLoop::operator()(unsigned long update_no,
126  XMLWriter& xml_out)
127  {
128  START_CODE();
129 
130  QDP::StopWatch snoop;
131  snoop.reset();
132  snoop.start();
133 
134  // Grab the gauge field
135  XMLBufferWriter gauge_xml;
136  multi1d<LatticeColorMatrix> u =
137  TheNamedObjMap::Instance().getData< multi1d<LatticeColorMatrix> >(params.named_obj.gauge_id);
138  TheNamedObjMap::Instance().get(params.named_obj.gauge_id).getRecordXML(gauge_xml);
139 
140  push(xml_out, "APE_Smeared_Wilsonloop");
141  write(xml_out, "update_no", update_no);
142 
143  QDPIO::cout << "APE_Smeared_Wilsonloop" << std::endl;
144 
145  fuzwilp(u,
146  params.param.j_decay,
147  params.param.tmax,
148  params.param.n_smear,
149  params.param.sm_fact,
150  params.param.BlkAccu,
151  params.param.BlkMax,
152  xml_out,
153  "fuzwilp");
154 
155  pop(xml_out);
156 
157  snoop.stop();
158  QDPIO::cout << InlineFuzzedWilsonLoopEnv::name << ": total time = "
159  << snoop.getTimeInSeconds()
160  << " secs" << std::endl;
161 
162  QDPIO::cout << InlineFuzzedWilsonLoopEnv::name << ": ran successfully" << std::endl;
163 
164  END_CODE();
165  }
166 }
Inline measurement factory.
Primary include file for CHROMA library code.
#define END_CODE()
Definition: chromabase.h:65
#define START_CODE()
Definition: chromabase.h:64
Inline measurement of fuzzed Wilson loops.
Calculate ape-fuzzed Wilson loops.
void fuzwilp(const multi1d< LatticeColorMatrix > &u, int j_decay, int tmax, int n_smear, const Real &sm_fact, const Real &BlkAccu, int BlkMax, XMLWriter &xml, const std::string &xml_group)
Calculate ape-fuzzed Wilson loops.
Definition: fuzwilp.cc:38
Inline fuzzed Wilson loops.
Params params
Named object function std::map.
static bool registered
Local registration flag.
bool registerAll()
Register all the factories.
multi1d< Hadron2PtContraction_t > operator()(const multi1d< LatticeColorMatrix > &u)
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
void read(XMLReader &xml, const std::string &path, InlineFuzzedWilsonLoopParams::NamedObject_t &input)
FuzzedWilsonLoop input.
void write(XMLWriter &xml, const std::string &path, const InlineFuzzedWilsonLoopParams::NamedObject_t &input)
FuzzedWilsonLoop output.
::std::string string
Definition: gtest.h:1979
push(xml_out,"Cooled_Topology")
pop(xml_out)