CHROMA
no_spin_insertion.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief No spin 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, NoSpinInsertionEnv::Params& param)
15  {
17  param = tmp;
18  }
19 
20  //! Parameters for running code
21  void write(XMLWriter& xml, const std::string& path, const NoSpinInsertionEnv::Params& param)
22  {
23  param.writeXML(xml, path);
24  }
25 
26 
27  //! Hooks to register the class
28  namespace NoSpinInsertionEnv
29  {
30  namespace
31  {
32  //! Callback function
33  SpinInsertion<LatticePropagator>* createProp(XMLReader& xml_in,
34  const std::string& path)
35  {
36  return new SpinInsert<LatticePropagator>(Params(xml_in, path));
37  }
38 
39  //! Callback function
40  SpinInsertion<LatticeFermion>* createFerm(XMLReader& xml_in,
41  const std::string& path)
42  {
43  return new SpinInsert<LatticeFermion>(Params(xml_in, path));
44  }
45 
46  //! Local registration flag
47  bool registered = false;
48  }
49 
50  //! Name to be used
51  const std::string name = "NONE";
52 
53  //! Register all the factories
54  bool registerAll()
55  {
56  bool success = true;
57  if (! registered)
58  {
59  success &= Chroma::ThePropSpinInsertionFactory::Instance().registerObject(name, createProp);
61  registered = true;
62  }
63  return success;
64  }
65 
66 
67  //! Parameters for running code
68  Params::Params(XMLReader& xml, const std::string& path)
69  {
70  }
71 
72 
73  //! Parameters for running code
74  void Params::writeXML(XMLWriter& xml, const std::string& path) const
75  {
76  push(xml, path);
77 
78  write(xml, "SpinInsertionType", name);
79 
80  pop(xml);
81  }
82 
83  } // end namespace
84 } // end namespace Chroma
85 
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.
CreateFermState< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createFerm(XMLReader &xml, const std::string &path)
const std::string name
Name to be used.
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
No spin insertion.
Factory for producing spin insertion objects.
Params for no spin insertion.
void writeXML(XMLWriter &in, const std::string &path) const
Parameters for running code.