Bridge++  Ver. 1.2.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
smear_APE_spatial.cpp
Go to the documentation of this file.
1 
14 #include "smear_APE_spatial.h"
15 
16 #ifdef USE_PARAMETERS_FACTORY
17 #include "parameters_factory.h"
18 #endif
19 
20 #ifdef USE_FACTORY
21 namespace {
22  Smear *create_object(Projection *proj)
23  {
24  return new Smear_APE_spatial(proj);
25  }
26 
27 
28  bool init = Smear::Factory::Register("APE_spatial", create_object);
29 }
30 #endif
31 
32 //- parameter entries
33 namespace {
34  void append_entry(Parameters& param)
35  {
36  param.Register_double("rho", 0.0);
37 
38  param.Register_string("verbose_level", "NULL");
39  }
40 
41 
42 #ifdef USE_PARAMETERS_FACTORY
43  bool init_param = ParametersFactory::Register("Smear.APE_Spatial", append_entry);
44 #endif
45 }
46 //- end
47 
48 //- parameters class
50 //- end
51 
52 const std::string Smear_APE_spatial::class_name = "Smear_APE_spatial";
53 
54 //====================================================================
56 {
57  const string str_vlevel = params.get_string("verbose_level");
58 
59  m_vl = vout.set_verbose_level(str_vlevel);
60 
61  //- fetch and check input parameters
62  double rho;
63 
64  int err = 0;
65  err += params.fetch_double("rho", rho);
66 
67  if (err) {
68  vout.crucial(m_vl, "%s: fetch error, input parameter not found.\n", class_name.c_str());
69  abort();
70  }
71 
72 
73  set_parameters(rho);
74 }
75 
76 
77 //====================================================================
78 void Smear_APE_spatial::set_parameters(const double rho)
79 {
80  //- print input parameters
81  vout.general(m_vl, "Parameters of %s:\n", class_name.c_str());
82  vout.general(m_vl, " rho = %10.6F\n", rho);
83 
84  //- range check
85  // NB. rho == 0 is allowed.
86 
87  //- store values
88  m_rho = rho;
89 }
90 
91 
92 //====================================================================
93 void Smear_APE_spatial::smear(Field_G& Usmear, const Field_G& U)
94 {
95  int Nvol = CommonParameters::Nvol();
96 
97  assert(U.nvol() == Nvol);
98  assert(U.nex() == m_Ndim);
99 
100  assert(Usmear.nvol() == Nvol);
101  assert(Usmear.nex() == m_Ndim);
102 
103  int Ndim_spc = m_Ndim - 1;
104 
105  Field_G c_tmp(Nvol, 1), u_tmp(Nvol, 1), u_tmp2(Nvol, 1);
106 
107  Staples staple;
108 
109  double plaq = staple.plaq_s(U);
110  vout.general(m_vl, " plaq_s(org ) = %12.8f\n", plaq);
111  plaq = staple.plaq_t(U);
112  vout.general(m_vl, " plaq_t(org ) = %12.8f\n", plaq);
113 
114  Usmear = 0.0;
115 
116  for (int mu = 0; mu < Ndim_spc; ++mu) {
117  c_tmp = 0.0;
118  u_tmp.setpart_ex(0, U, mu);
119 
120  for (int nu = 0; nu < Ndim_spc; ++nu) {
121  if (nu != mu) {
122  u_tmp2 = staple.upper(U, mu, nu);
123  c_tmp.addpart_ex(0, u_tmp2, 0, m_rho);
124 
125  u_tmp2 = staple.lower(U, mu, nu);
126  c_tmp.addpart_ex(0, u_tmp2, 0, m_rho);
127  }
128  }
129 
130  m_proj->project(u_tmp2, m_rho, c_tmp, u_tmp);
131  Usmear.setpart_ex(mu, u_tmp2, 0);
132  }
133 
134  int mu = m_Ndim - 1; // temporal link: unsmeared.
135  Usmear.setpart_ex(mu, U, mu);
136 
137  plaq = staple.plaq_s(Usmear);
138  vout.general(m_vl, " plaq_s(smear) = %12.8f\n", plaq);
139  plaq = staple.plaq_t(Usmear);
140  vout.general(m_vl, " plaq_t(smear) = %12.8f\n", plaq);
141 }
142 
143 
144 //====================================================================
145 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:207
Projection * m_proj
projector to group element.
APE type smearing of spatial link variables.
void Register_string(const string &, const string &)
Definition: parameters.cpp:352
Staple construction.
Definition: staples.h:40
Field_G upper(const Field_G &, const int mu, const int nu)
constructs upper staple in mu-nu plane (wrapping void version).
Definition: staples.cpp:118
void general(const char *format,...)
Definition: bridgeIO.cpp:38
int nvol() const
Definition: field.h:101
void smear(Field_G &Usmear, const Field_G &U)
Smearing of a given gauge field.
Class for parameters.
Definition: parameters.h:40
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:162
double plaq_t(const Field_G &)
calculates temporal plaquette value.
Definition: staples.cpp:70
static const std::string class_name
SU(N) gauge field.
Definition: field_G.h:36
void set_parameters(const Parameters &params)
Setting parameters with Parameters object.
void staple(Field_G &, const Field_G &, const Field_G &, int mu, int nu)
Staple construction.
int nex() const
Definition: field.h:102
void crucial(const char *format,...)
Definition: bridgeIO.cpp:26
base class for projection operator into gauge group.
Definition: projection.h:33
double m_rho
smearing parameter
static bool Register(const std::string &realm, const creator_callback &cb)
Field_G lower(const Field_G &, const int mu, const int nu)
constructs lower staple in mu-nu plane (wrapping void version).
Definition: staples.cpp:128
void Register_double(const string &, const double)
Definition: parameters.cpp:324
base class for smearing of link variables.
Definition: smear.h:36
virtual void project(Field_G &v, double alpha, const Field_G &C, const Field_G &U)=0
projection V = P[alpha, C, U]
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:150
int fetch_double(const string &key, double &val) const
Definition: parameters.cpp:124
string get_string(const string &key) const
Definition: parameters.cpp:85
Bridge::VerboseLevel m_vl
Definition: smear.h:39
int m_Ndim
spacetime dimension
double plaq_s(const Field_G &)
calculates spatial plaquette value.
Definition: staples.cpp:38
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:191