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