CHROMA
vector_quark_smearing.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Gaussian smearing of color std::vector
3  */
4 
5 #include "chromabase.h"
6 
11 
12 namespace Chroma
13 {
14 
15  // Read parameters
16  void read(XMLReader& xml, const std::string& path, VectorQuarkSmearingEnv::Params& param)
17  {
19  param = tmp;
20  }
21 
22  //! Parameters for running code
23  void write(XMLWriter& xml, const std::string& path, const VectorQuarkSmearingEnv::Params& param)
24  {
25  param.writeXML(xml, path);
26  }
27 
28 
29  //! Hooks to register the class
30  namespace VectorQuarkSmearingEnv
31  {
32 
33  namespace
34  {
35  //! Callback function
36  QuarkSmearing<LatticePropagator>* createProp(XMLReader& xml_in,
37  const std::string& path)
38  {
39  return new QuarkSmear<LatticePropagator>(Params(xml_in, path));
40  }
41 
42  //! Callback function
43  QuarkSmearing<LatticeStaggeredPropagator>* createStagProp(XMLReader& xml_in,
44  const std::string& path)
45  {
46  return new QuarkSmear<LatticeStaggeredPropagator>(Params(xml_in, path));
47  }
48 
49  //! Callback function
50  QuarkSmearing<LatticeFermion>* createFerm(XMLReader& xml_in,
51  const std::string& path)
52  {
53  return new QuarkSmear<LatticeFermion>(Params(xml_in, path));
54  }
55 
56  //! Callback function
57  QuarkSmearing<LatticeColorVector>* createColorVec(XMLReader& xml_in,
58  const std::string& path)
59  {
60  return new QuarkSmear<LatticeColorVector>(Params(xml_in, path));
61  }
62 
63  //! Local registration flag
64  bool registered = false;
65 
66  //! Name to be used
67  const std::string name = "VECTOR_SMEAR";
68  }
69 
70  //! Return the name
71  std::string getName() {return name;}
72 
73  //! Register all the factories
74  bool registerAll()
75  {
76  bool success = true;
77  if (! registered)
78  {
79  success &= Chroma::ThePropSmearingFactory::Instance().registerObject(name, createProp);
80  success &= Chroma::TheStagPropSmearingFactory::Instance().registerObject(name, createStagProp);
81  success &= Chroma::TheFermSmearingFactory::Instance().registerObject(name, createFerm);
82  success &= Chroma::TheColorVecSmearingFactory::Instance().registerObject(name, createColorVec);
83  registered = true;
84  }
85  return success;
86  }
87 
88 
89  //! Parameters for running code
90  Params::Params(XMLReader& xml, const std::string& path)
91  {
92  XMLReader paramtop(xml, path);
93 
94  read(paramtop, "subset_vecs_id", vecs_id);
95  read(paramtop, "sigma", sigma);
96  read(paramtop, "no_smear_dir", no_smear_dir);
97  }
98 
99 
100  //! Parameters for running code
101  void Params::writeXML(XMLWriter& xml, const std::string& path) const
102  {
103  push(xml, path);
104 
105  write(xml, "wvf_kind", VectorQuarkSmearingEnv::name);
106  write(xml, "subset_vecs_id", vecs_id);
107  write(xml, "sigma", sigma);
108  write(xml, "no_smear_dir", no_smear_dir);
109 
110  pop(xml);
111  }
112 
113  //! Smear the quark
114  template<>
115  void
117  const multi1d<LatticeColorMatrix>& u) const
118  {
119  vectorSmear(quark, *vecs, params.sigma, params.no_smear_dir);
120  }
121 
122  //! Smear the quark
123  template<>
124  void
125  QuarkSmear<LatticeStaggeredPropagator>::operator()(LatticeStaggeredPropagator& quark,
126  const multi1d<LatticeColorMatrix>& u) const
127  {
128  vectorSmear(quark, *vecs, params.sigma, params.no_smear_dir);
129  }
130 
131  //! Smear the quark
132  template<>
133  void
135  const multi1d<LatticeColorMatrix>& u) const
136  {
137  vectorSmear(quark, *vecs, params.sigma, params.no_smear_dir);
138  }
139 
140  //! Smear the color-std::vector
141  template<>
142  void
144  const multi1d<LatticeColorMatrix>& u) const
145  {
146  vectorSmear(quark, *vecs, params.sigma, params.no_smear_dir);
147  }
148 
149  } // end namespace
150 } // end namespace Chroma
151 
Primary include file for CHROMA library code.
Base class for quark smearing.
static T & Instance()
Definition: singleton.h:432
void operator()(T &quark, const multi1d< LatticeColorMatrix > &u) const
Smear the quark.
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 vectorSmear(LatticeColorVector &chi, const MapObject< int, EVPair< LatticeColorVector > > &vecs, const Real &sigma, const int &j_decay)
Do a std::vector smearing of a lattice colorstd::vector field.
Definition: vector_smear.cc:22
Params params
Named object function std::map.
static bool registered
Local registration flag.
const std::string name
Name to be used.
CreateFermState< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createFerm(XMLReader &xml, const std::string &path)
bool registerAll()
Register all the factories.
std::string getName()
Return the name.
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
Factory for producing quark smearing objects.
void writeXML(XMLWriter &in, const std::string &path) const
Parameters for running code.
Vector Smearing: Use an outerproduct of vectors as the smearing scheme.
std::vector smearing of color std::vector