CHROMA
unit_gauge_init.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Create a unit config
3  */
4 
7 
9 
10 namespace Chroma
11 {
12 
13  //! Hooks to register the class
14  namespace UnitGaugeInitEnv
15  {
16  //! Callback function
17  GaugeInit* createSource(XMLReader& xml_in,
18  const std::string& path)
19  {
20  return new GaugeIniter(Params(xml_in, path));
21  }
22 
23  //! Name to be used
24  const std::string name = "UNIT";
25 
26  //! Local registration flag
27  static bool registered = false;
28 
29  //! Register all the factories
30  bool registerAll()
31  {
32  bool success = true;
33  if (! registered)
34  {
35  success &= Chroma::TheGaugeInitFactory::Instance().registerObject(name, createSource);
36  registered = true;
37  }
38  return success;
39  }
40 
41 
42  // Parameters for running code
43  Params::Params(XMLReader& xml, const std::string& path)
44  {
45  XMLReader paramtop(xml, path);
46  }
47 
48 
49  //! Parameters for running code
50  void Params::writeXML(XMLWriter& xml, const std::string& path) const
51  {
52  push(xml, path);
53 
54  int version = 1;
55  write(xml, "cfg_type", UnitGaugeInitEnv::name);
56 
57  pop(xml);
58  }
59 
60 
61  // Initialize the gauge field
62  void
63  GaugeIniter::operator()(XMLReader& gauge_file_xml,
64  XMLReader& gauge_xml,
65  multi1d<LatticeColorMatrix>& u) const
66  {
67  QDPIO::cout << "Starting up unit gauge (free) config" << std::endl;
68  u.resize(Nd);
69  u = 1;
70 
71  XMLBufferWriter file_xml, record_xml;
72  push(file_xml, "gauge");
73  write(file_xml, "id", int(0));
74  pop(file_xml);
75  push(record_xml, "unit");
76  pop(record_xml);
77 
78  gauge_file_xml.open(file_xml);
79  gauge_xml.open(record_xml);
80  }
81  }
82 }
Base class for gauge initialization.
Definition: gauge_init.h:19
static T & Instance()
Definition: singleton.h:432
void operator()(XMLReader &gauge_file_xml, XMLReader &gauge_xml, multi1d< LatticeColorMatrix > &u) const
Initialize the gauge field.
All gauge field initializers.
Factory for producing gauge initializer objects.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
Nd
Definition: meslate.cc:74
GaugeInit * createSource(XMLReader &xml_in, const std::string &path)
Callback function.
static bool registered
Local registration flag.
bool registerAll()
Register all the factories.
const std::string name
Name to be used.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
push(xml_out,"Condensates")
pop(xml_out)
::std::string string
Definition: gtest.h:1979
Params for initializing config.
void writeXML(XMLWriter &in, const std::string &path) const
Parameters for running code.
Create a unit config.