Bridge++  Ver. 2.0.2
smear_APE_spatial.cpp
Go to the documentation of this file.
1 
14 #include "smear_APE_spatial.h"
15 
16 #ifdef USE_FACTORY_AUTOREGISTER
17 namespace {
18  bool init = Smear_APE_spatial::register_factory();
19 }
20 #endif
21 
22 const std::string Smear_APE_spatial::class_name = "Smear_APE_spatial";
23 
24 //====================================================================
26 {
27  std::string vlevel;
28  if (!params.fetch_string("verbose_level", vlevel)) {
29  m_vl = vout.set_verbose_level(vlevel);
30  }
31 
32  //- fetch and check input parameters
33  double rho;
34 
35  int err = 0;
36  err += params.fetch_double("rho", rho);
37 
38  if (err) {
39  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
40  exit(EXIT_FAILURE);
41  }
42 
43  set_parameters(rho);
44 }
45 
46 
47 //====================================================================
49 {
50  params.set_double("rho", m_rho);
51 
52  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
53 }
54 
55 
56 //====================================================================
57 void Smear_APE_spatial::set_parameters(const double rho)
58 {
59  //- print input parameters
60  vout.general(m_vl, "%s:\n", class_name.c_str());
61  vout.general(m_vl, " rho = %10.6F\n", rho);
62 
63  //- range check
64  // NB. rho == 0 is allowed.
65 
66  //- store values
67  m_rho = rho;
68 }
69 
70 
71 //====================================================================
72 void Smear_APE_spatial::smear(Field_G& Usmear, const Field_G& U)
73 {
74  const int Nvol = CommonParameters::Nvol();
75 
76  assert(U.nvol() == Nvol);
77  assert(U.nex() == m_Ndim);
78 
79  assert(Usmear.nvol() == Nvol);
80  assert(Usmear.nex() == m_Ndim);
81 
82  const int Ndim_spc = m_Ndim - 1;
83 
84  Staple_lex staple;
85 
86  double plaq = staple.plaq_s(U);
87  vout.general(m_vl, " plaq_s(org ) = %12.8f\n", plaq);
88 
89  plaq = staple.plaq_t(U);
90  vout.general(m_vl, " plaq_t(org ) = %12.8f\n", plaq);
91 
92  Usmear.set(0.0);
93 
94  for (int mu = 0; mu < Ndim_spc; ++mu) {
95  Field_G c_tmp;
96  c_tmp.set(0.0);
97 
98  Field_G u_tmp;
99  u_tmp.setpart_ex(0, U, mu);
100 
101  Field_G u_tmp2;
102 
103  for (int nu = 0; nu < Ndim_spc; ++nu) {
104  if (nu != mu) {
105  staple.upper(u_tmp2, U, mu, nu);
106  c_tmp.addpart_ex(0, u_tmp2, 0, m_rho);
107 
108  staple.lower(u_tmp2, U, mu, nu);
109  c_tmp.addpart_ex(0, u_tmp2, 0, m_rho);
110  }
111  }
112 
113  m_proj->project(u_tmp2, m_rho, c_tmp, u_tmp);
114  Usmear.setpart_ex(mu, u_tmp2, 0);
115  }
116 
117  const int mu = m_Ndim - 1; // temporal link: unsmeared.
118  Usmear.setpart_ex(mu, U, mu);
119 
120  plaq = staple.plaq_s(Usmear);
121  vout.general(m_vl, " plaq_s(smear) = %12.8f\n", plaq);
122 
123  plaq = staple.plaq_t(Usmear);
124  vout.general(m_vl, " plaq_t(smear) = %12.8f\n", plaq);
125 }
126 
127 
128 //====================================================================
129 //============================================================END=====
Field::setpart_ex
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:201
smear_APE_spatial.h
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
Staple_lex::plaq_t
double plaq_t(const Field_G &)
calculates temporal plaquette value.
Definition: staple_lex.cpp:132
Smear_APE_spatial::get_parameters
void get_parameters(Parameters &params) const
Getting parameters by Parameters object.
Definition: smear_APE_spatial.cpp:48
Field::set
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
Parameters
Class for parameters.
Definition: parameters.h:46
Parameters::set_double
void set_double(const string &key, const double value)
Definition: parameters.cpp:33
Field::nex
int nex() const
Definition: field.h:128
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Smear_APE_spatial::m_proj
Projection * m_proj
projector to group element.
Definition: smear_APE_spatial.h:50
Staple_lex::lower
void lower(Field_G &, const Field_G &, const int mu, const int nu)
constructs lower staple in mu-nu plane.
Definition: staple_lex.cpp:286
Smear_APE_spatial::m_vl
Bridge::VerboseLevel m_vl
Definition: smear_APE_spatial.h:46
Smear_APE_spatial::class_name
static const std::string class_name
Definition: smear_APE_spatial.h:43
Smear_APE_spatial::m_Ndim
int m_Ndim
spacetime dimension
Definition: smear_APE_spatial.h:48
Field::addpart_ex
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:208
Smear_APE_spatial::smear
void smear(Field_G &Usmear, const Field_G &U)
Smearing of a given gauge field.
Definition: smear_APE_spatial.cpp:72
Field::nvol
int nvol() const
Definition: field.h:127
Staple_lex::upper
void upper(Field_G &, const Field_G &, const int mu, const int nu)
constructs upper staple in mu-nu plane.
Definition: staple_lex.cpp:263
Staple_lex
Staple construction.
Definition: staple_lex.h:39
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
Smear_APE_spatial::set_parameters
void set_parameters(const Parameters &params)
Setting parameters with Parameters object.
Definition: smear_APE_spatial.cpp:25
Parameters::fetch_string
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
Parameters::fetch_double
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
Smear_APE_spatial::m_rho
double m_rho
smearing parameter
Definition: smear_APE_spatial.h:49
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
Staple_lex::plaq_s
double plaq_s(const Field_G &)
calculates spatial plaquette value.
Definition: staple_lex.cpp:115
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
Bridge::BridgeIO::get_verbose_level
static std::string get_verbose_level(const VerboseLevel vl)
Definition: bridgeIO.cpp:154
Projection::project
virtual void project(Field_G &v, const double alpha, const Field_G &C, const Field_G &U)=0
projection V = P[alpha, C, U]