Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
smear_APE.cpp
Go to the documentation of this file.
1 
14 #include "smear_APE.h"
15 
16 
17 #ifdef USE_FACTORY
18 namespace {
19  Smear *create_object(Projection *proj)
20  {
21  return new Smear_APE(proj);
22  }
23 
24 
25  bool init = Smear::Factory::Register("APE", create_object);
26 }
27 #endif
28 
29 
30 
31 const std::string Smear_APE::class_name = "Smear_APE";
32 
33 //====================================================================
35 {
36  const string str_vlevel = params.get_string("verbose_level");
37 
38  m_vl = vout.set_verbose_level(str_vlevel);
39 
40  //- fetch and check input parameters
41  double rho1;
42 
43  int err = 0;
44  err += params.fetch_double("rho_uniform", rho1);
45 
46  if (err) {
47  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
48  exit(EXIT_FAILURE);
49  }
50 
51  set_parameters(rho1);
52 }
53 
54 
55 //====================================================================
56 void Smear_APE::set_parameters(const double rho1)
57 {
58  //- print input parameters
59  vout.general(m_vl, "%s:\n", class_name.c_str());
60  vout.general(m_vl, " rho = %8.4f\n", rho1);
61 
62  //- range check
63  // NB. rho == 0 is allowed.
64 
65  //- store values
66  // m_rho.resize(m_Ndim * m_Ndim); // already resized in init.
67  for (int mu = 0; mu < m_Ndim; ++mu) {
68  for (int nu = 0; nu < m_Ndim; ++nu) {
69  m_rho[mu + nu * m_Ndim] = rho1;
70  }
71  }
72 }
73 
74 
75 //====================================================================
76 void Smear_APE::set_parameters(const std::vector<double>& rho)
77 {
78  //- print input parameters
79  vout.general(m_vl, "%s:\n", class_name.c_str());
80  for (int mu = 0; mu < m_Ndim; ++mu) {
81  vout.general(m_vl, " rho[%d] = %8.4f\n", mu, rho[mu]);
82  }
83 
84  // range check
85  // NB. rho == 0 is allowed.
86  assert(rho.size() == m_Ndim * m_Ndim);
87 
88  //- store values
89  // m_rho.resize(m_Ndim * m_Ndim); // already resized in init.
90  for (int mu = 0; mu < m_Ndim; ++mu) {
91  for (int nu = 0; nu < m_Ndim; ++nu) {
92  m_rho[mu + nu * m_Ndim] = rho[mu + nu * m_Ndim];
93  }
94  }
95 }
96 
97 
98 //====================================================================
99 void Smear_APE::smear(Field_G& Usmear, const Field_G& U)
100 {
101  int Nvol = CommonParameters::Nvol();
102 
103  assert(U.nvol() == Nvol);
104  assert(U.nex() == m_Ndim);
105  assert(Usmear.nvol() == Nvol);
106  assert(Usmear.nex() == m_Ndim);
107 
108  Field_G c_tmp(Nvol, 1), u_tmp(Nvol, 1), u_tmp2(Nvol, 1);
109 
111 
112  Usmear.set(0.0);
113 
114  for (int mu = 0; mu < m_Ndim; ++mu) {
115  c_tmp.set(0.0);
116  u_tmp.setpart_ex(0, U, mu);
117 
118  for (int nu = 0; nu < m_Ndim; ++nu) {
119  if (nu != mu) {
120  double rho = m_rho[mu + m_Ndim * nu];
121  staple.upper(u_tmp2, U, mu, nu);
122  c_tmp.addpart_ex(0, u_tmp2, 0, rho);
123 
124  staple.lower(u_tmp2, U, mu, nu);
125  c_tmp.addpart_ex(0, u_tmp2, 0, rho);
126  }
127  }
128 
129  double rho0 = m_rho[mu + m_Ndim * mu];
130  m_proj->project(u_tmp2, rho0, c_tmp, u_tmp);
131  Usmear.setpart_ex(mu, u_tmp2, 0);
132  }
133 }
134 
135 
136 //====================================================================
137 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:495
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:164
void general(const char *format,...)
Definition: bridgeIO.cpp:195
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:211
int nvol() const
Definition: field.h:116
Class for parameters.
Definition: parameters.h:46
void lower(Field_G &, const Field_G &, const int mu, const int nu)
constructs lower staple in mu-nu plane.
Definition: staple_lex.cpp:180
void set_parameters(const Parameters &params)
Setting parameters with Parameters object.
Definition: smear_APE.cpp:34
void smear(Field_G &Usmear, const Field_G &U)
Smearing of a given gauge field.
Definition: smear_APE.cpp:99
Projection * m_proj
projector to group element.
Definition: smear_APE.h:51
Staple construction.
Definition: staple_lex.h:39
SU(N) gauge field.
Definition: field_G.h:38
APE type smearing of link variables.
Definition: smear_APE.h:43
static const std::string class_name
Definition: smear_APE.h:46
int nex() const
Definition: field.h:117
void upper(Field_G &, const Field_G &, const int mu, const int nu)
constructs upper staple in mu-nu plane.
Definition: staple_lex.cpp:156
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
base class for projection operator into gauge group.
Definition: projection.h:31
std::valarray< double > m_rho
smearing parameter
Definition: smear_APE.h:50
int m_Ndim
spacetime dimension
Definition: smear_APE.h:49
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:186
string get_string(const string &key) const
Definition: parameters.cpp:116
void staple(Field_G &, const Field_G &, const Field_G &, int mu, int nu)
Staple construction.
Bridge::VerboseLevel m_vl
Definition: smear.h:39
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131