CHROMA
simple_gaugebc.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Simple gauge boundary conditions
3  */
4 
7 
8 
9 namespace Chroma {
10 
11  namespace SimpleGaugeBCEnv
12  {
13  //! Calllback function to register with the factory
14  GaugeBC< multi1d<LatticeColorMatrix>, multi1d<LatticeColorMatrix> >* createGaugeBC(XMLReader& xml,
15  const std::string& path)
16  {
17  QDPIO::cout << "Factory Callback: Creating SimpleGaugeBC " << std::endl;
18  return new SimpleGaugeBC<
19  multi1d<LatticeColorMatrix>,
20  multi1d<LatticeColorMatrix> >(SimpleGaugeBCParams(xml, path));
21  }
22 
23  GaugeBC< multi1d<LatticeColorMatrixF>, multi1d<LatticeColorMatrixF> >* createGaugeBCF(XMLReader& xml,
24  const std::string& path)
25  {
26  QDPIO::cout << "Factory Callback: Creating SimpleGaugeBC " << std::endl;
27  return new SimpleGaugeBC<
28  multi1d<LatticeColorMatrixF>,
29  multi1d<LatticeColorMatrixF> >(SimpleGaugeBCParams(xml, path));
30  }
31 
32  GaugeBC< multi1d<LatticeColorMatrixD>, multi1d<LatticeColorMatrixD> >* createGaugeBCD(XMLReader& xml,
33  const std::string& path)
34  {
35  QDPIO::cout << "Factory Callback: Creating SimpleGaugeBC " << std::endl;
36  return new SimpleGaugeBC<
37  multi1d<LatticeColorMatrixD>,
38  multi1d<LatticeColorMatrixD> >(SimpleGaugeBCParams(xml, path));
39  }
40 
41  const std::string name = "SIMPLE_GAUGEBC";
42 
43  //! Local registration flag
44  static bool registered = false;
45 
46  //! Register all the factories
47  bool registerAll()
48  {
49  bool success = true;
50  if (! registered)
51  {
52  success &= TheGaugeBCFactory::Instance().registerObject(name, createGaugeBC);
53  success &= TheGaugeBCFFactory::Instance().registerObject(name, createGaugeBCF);
54  success &= TheGaugeBCDFactory::Instance().registerObject(name, createGaugeBCD);
55  registered = true;
56  }
57  return success;
58  }
59  }
60 
62  const std::string& path) {
63 
64  XMLReader paramtop(xml, path);
65 
66  try {
67  read(paramtop, "./boundary", boundary);
68  }
69  catch( const std::string& e ) {
70  QDPIO::cerr << "Error reading XML: " << e << std::endl;
71  QDP_abort(1);
72  }
73 
74  QDPIO::cout << "Creating SimpleGaugeBCParams with boundary: ";
75  QDPIO::cout << "Boundary.size = " << boundary.size() << std::endl;
76  for(int i = 0; i < boundary.size();i++) {
77  QDPIO::cout << boundary[i] << std::endl;
78  }
79  QDPIO::cout << std::endl;
80  }
81 
82 
83 
84 
85  void read(XMLReader& xml, const std::string& path, SimpleGaugeBCParams& p) {
86  SimpleGaugeBCParams tmp(xml, path);
87  p=tmp;
88  }
89 
90  void write(XMLWriter& xml, const std::string& path, const SimpleGaugeBCParams& p) {
91  push(xml, path);
92  write(xml, "boundary", p.boundary);
93  pop(xml);
94  }
95 
96 } // End namespace Chroma
Base class for all gauge action boundary conditions.
Definition: gaugebc.h:30
Concrete class for gauge actions with simple boundary conditions.
static T & Instance()
Definition: singleton.h:432
Gauge boundary condition factories.
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.
GaugeBC< multi1d< LatticeColorMatrixD >, multi1d< LatticeColorMatrixD > > * createGaugeBCD(XMLReader &xml, const std::string &path)
GaugeBC< multi1d< LatticeColorMatrixF >, multi1d< LatticeColorMatrixF > > * createGaugeBCF(XMLReader &xml, const std::string &path)
GaugeBC< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createGaugeBC(XMLReader &xml, const std::string &path)
Calllback function to register with the factory.
const std::string name
static bool registered
Local registration flag.
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
int i
Definition: pbg5p_w.cc:55
pop(xml_out)
::std::string string
Definition: gtest.h:1979
Simple gauge boundary conditions.
multi1d< Complex > boundary