CHROMA
wupp_gauge_init.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Read an expanded BMW config
3  */
4 
7 
9 #include "io/readwupp.h"
10 
11 namespace Chroma
12 {
13 
14  // Read parameters
15  void read(XMLReader& xml, const std::string& path, WUPPGaugeInitEnv::Params& param)
16  {
17  WUPPGaugeInitEnv::Params tmp(xml, path);
18  param = tmp;
19  }
20 
21  //! Parameters for running code
22  void write(XMLWriter& xml, const std::string& path, const WUPPGaugeInitEnv::Params& param)
23  {
24  param.writeXML(xml, path);
25  }
26 
27 
28  //! Hooks to register the class
29  namespace WUPPGaugeInitEnv
30  {
31  //! Callback function
32  GaugeInit* createSource(XMLReader& xml_in,
33  const std::string& path)
34  {
35  return new GaugeIniter(Params(xml_in, path));
36  }
37 
38  //! Name to be used
39  const std::string name = "WUPP";
40 
41  //! Local registration flag
42  static bool registered = false;
43 
44  //! Register all the factories
45  bool registerAll()
46  {
47  bool success = true;
48  if (! registered)
49  {
50  success &= Chroma::TheGaugeInitFactory::Instance().registerObject(name, createSource);
51  registered = true;
52  }
53  return success;
54  }
55 
56 
57  // Parameters for running code
58  Params::Params(XMLReader& xml, const std::string& path)
59  {
60  XMLReader paramtop(xml, path);
61 
62  read(paramtop, "cfg_file", cfg_file);
63  }
64 
65 
66  //! Parameters for running code
67  void Params::writeXML(XMLWriter& xml, const std::string& path) const
68  {
69  push(xml, path);
70 
71  int version = 1;
72  write(xml, "cfg_type", WUPPGaugeInitEnv::name);
73  write(xml, "cfg_file", cfg_file);
74 
75  pop(xml);
76  }
77 
78 
79  // Initialize the gauge field
80  void
81  GaugeIniter::operator()(XMLReader& gauge_file_xml,
82  XMLReader& gauge_xml,
83  multi1d<LatticeColorMatrix>& u) const
84  {
85  readWupp(gauge_xml, u, params.cfg_file);
86  }
87  }
88 }
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 read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
void readWupp(multi1d< LatticeColorMatrix > &u, const std::string &cfg_file)
Read a WUPP configuration file.
Definition: readwupp.cc:27
bool registerAll()
Register all the factories.
GaugeInit * createSource(XMLReader &xml_in, const std::string &path)
Callback function.
const std::string name
Name to be used.
static bool registered
Local registration flag.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
pop(xml_out)
::std::string string
Definition: gtest.h:1979
Read in a configuration written by Wupp up to configuration version 7.
Params for initializing config.
void writeXML(XMLWriter &in, const std::string &path) const
Parameters for running code.
Read an expanded BMW config.