CHROMA
simple_spin_insertion_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Gamma insertion
3  */
4 
5 #include "chromabase.h"
6 
9 
10 namespace Chroma
11 {
12 
13  // Read parameters
14  void read(XMLReader& xml, const std::string& path, SimpleSpinInsertionEnv::Params& param)
15  {
17  param = tmp;
18  }
19 
20  //! Parameters for running code
21  void write(XMLWriter& xml, const std::string& path, const SimpleSpinInsertionEnv::Params& param)
22  {
23  param.writeXML(xml, path);
24  }
25 
26 
27  //! Hooks to register the class
28  namespace SimpleSpinInsertionEnv
29  {
30  namespace
31  {
32  //! Callback function
33  SpinInsertion<LatticePropagator>* leftSpinProp(XMLReader& xml_in,
34  const std::string& path)
35  {
36  return new LeftSpinInsert<LatticePropagator>(Params(xml_in, path));
37  }
38 
39  //! Callback function
40  SpinInsertion<LatticeFermion>* leftSpinFerm(XMLReader& xml_in,
41  const std::string& path)
42  {
43  return new LeftSpinInsert<LatticeFermion>(Params(xml_in, path));
44  }
45 
46  //! Callback function
47  SpinInsertion<LatticePropagator>* rightSpinProp(XMLReader& xml_in,
48  const std::string& path)
49  {
50  return new RightSpinInsert<LatticePropagator>(Params(xml_in, path));
51  }
52 
53 
54  //! Local registration flag
55  bool registered = false;
56  }
57 
58  //! Register all the factories
59  bool registerAll()
60  {
61  bool success = true;
62  if (! registered)
63  {
64  success &= Chroma::ThePropSpinInsertionFactory::Instance().registerObject("LEFT_GAMMA_INSERTION",
65  leftSpinProp);
66  success &= Chroma::ThePropSpinInsertionFactory::Instance().registerObject("RIGHT_GAMMA_INSERTION",
67  rightSpinProp);
68  success &= Chroma::TheFermSpinInsertionFactory::Instance().registerObject("GAMMA_INSERTION",
69  leftSpinFerm);
70  registered = true;
71  }
72  return success;
73  }
74 
75 
76  //! Parameters for running code
77  Params::Params(XMLReader& xml, const std::string& path)
78  {
79  XMLReader paramtop(xml, path);
80 
81  read(paramtop, "gamma", gamma);
82  }
83 
84 
85  //! Parameters for running code
86  void Params::writeXML(XMLWriter& xml, const std::string& path) const
87  {
88  push(xml, path);
89 
90  write(xml, "gamma", gamma);
91 
92  pop(xml);
93  }
94 
95  } // end namespace
96 } // end namespace Chroma
97 
Primary include file for CHROMA library code.
static T & Instance()
Definition: singleton.h:432
Base class for spin insertion.
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.
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")
pop(xml_out)
::std::string string
Definition: gtest.h:1979
Gamma insertions.
Factory for producing spin insertion objects.
Params for simple spin insertion.
void writeXML(XMLWriter &in, const std::string &path) const
Parameters for running code.