Bridge++  Ver. 2.0.2
smear_HYP.cpp
Go to the documentation of this file.
1 
14 #include "smear_HYP.h"
15 
16 #ifdef USE_FACTORY_AUTOREGISTER
17 namespace {
18  bool init = Smear_HYP::register_factory();
19 }
20 #endif
21 
22 const std::string Smear_HYP::class_name = "Smear_HYP";
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 alpha1, alpha2, alpha3;
34 
35  int err = 0;
36  err += params.fetch_double("alpha1", alpha1);
37  err += params.fetch_double("alpha2", alpha2);
38  err += params.fetch_double("alpha3", alpha3);
39 
40  if (err) {
41  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
42  exit(EXIT_FAILURE);
43  }
44 
45  set_parameters(alpha1, alpha2, alpha3);
46 }
47 
48 
49 //====================================================================
51 {
52  params.set_double("alpha1", m_alpha1);
53  params.set_double("alpha2", m_alpha2);
54  params.set_double("alpha3", m_alpha3);
55 
56  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
57 }
58 
59 
60 //====================================================================
61 void Smear_HYP::set_parameters(const double alpha1, const double alpha2, const double alpha3)
62 {
63  //- print input parameters
64  vout.general(m_vl, "%s:\n", class_name.c_str());
65  vout.general(m_vl, " alpha1 = %10.6F\n", alpha1);
66  vout.general(m_vl, " alpha2 = %10.6F\n", alpha2);
67  vout.general(m_vl, " alpha3 = %10.6F\n", alpha3);
68 
69  //- range check
70  // NB. alpha1,alpha2,alpha3 == 0 is allowed.
71 
72  //- store values
73  m_alpha1 = alpha1;
74  m_alpha2 = alpha2;
75  m_alpha3 = alpha3;
76 }
77 
78 
79 //====================================================================
81 {
84 
85  m_U.resize(m_Ndim);
86  m_v1.resize(size_v1());
87  m_v2.resize(size_v2());
88 }
89 
90 
91 //====================================================================
92 void Smear_HYP::smear(Field_G& Usmear, const Field_G& U)
93 {
94  assert(U.nvol() == m_Nvol);
95  assert(U.nex() == m_Ndim);
96 
97  assert(Usmear.nvol() == m_Nvol);
98  assert(Usmear.nex() == m_Ndim);
99 
100  for (int mu = 0; mu < m_Ndim; ++mu) {
101  m_U[mu].setpart_ex(0, U, mu);
102  }
103 
104  step1();
105  // vout.general(m_vl, "level-1 step finished.\n");
106  step2();
107  // vout.general(m_vl, "level-2 step finished.\n");
108  step3(Usmear);
109  // vout.general(m_vl, "level-3 step finished.\n");
110 }
111 
112 
113 //====================================================================
115 {
116  for (int mu = 0; mu < m_Ndim; ++mu) {
117  for (int nu = 0; nu < m_Ndim; ++nu) {
118  if (nu == mu) continue;
119 
120  for (int rho = nu + 1; rho < m_Ndim; ++rho) {
121  if (rho == mu) continue;
122 
123  int sig = 6 - mu - nu - rho;
124 
125  Field_G c1;
126  staple(c1, m_U[mu], m_U[sig], mu, sig);
127  //c1 *= m_alpha3 / 2.0;
128  scal(c1, m_alpha3 * 0.5);
129  m_proj->project(m_v1[index_v1(mu, nu, rho)], m_alpha3, c1, m_U[mu]);
130  }
131  }
132  }
133 }
134 
135 
136 //====================================================================
138 {
139  for (int mu = 0; mu < m_Ndim; ++mu) {
140  for (int nu = 0; nu < m_Ndim; ++nu) {
141  if (nu == mu) continue;
142 
143  Field_G c2;
144  c2.set(0.0);
145 
146  for (int rho = 0; rho < m_Ndim; ++rho) {
147  if ((rho != mu) && (rho != nu)) {
148  Field_G u_tmp;
149  staple(u_tmp, m_v1[index_v1(mu, nu, rho)],
150  m_v1[index_v1(rho, nu, mu)], mu, rho);
151  c2.addpart_ex(0, u_tmp, 0);
152  }
153  }
154 
155  //c2 *= m_alpha2 / 4.0;
156  scal(c2, m_alpha2 * 0.25);
157  m_proj->project(m_v2[index_v2(mu, nu)], m_alpha2, c2, m_U[mu]);
158  }
159  }
160 }
161 
162 
163 //====================================================================
165 {
166  for (int mu = 0; mu < m_Ndim; ++mu) {
167  Field_G c3;
168  c3.set(0.0);
169 
170  Field_G u_tmp;
171 
172  for (int nu = 0; nu < m_Ndim; ++nu) {
173  if (nu != mu) {
174  staple(u_tmp, m_v2[index_v2(mu, nu)],
175  m_v2[index_v2(nu, mu)], mu, nu);
176  c3.addpart_ex(0, u_tmp, 0);
177  }
178  }
179 
180  //c3 *= m_alpha1 / 6.0;
181  scal(c3, m_alpha1 / 6.0);
182  m_proj->project(u_tmp, m_alpha1, c3, m_U[mu]);
183  v.setpart_ex(mu, u_tmp, 0);
184  }
185 }
186 
187 
188 //====================================================================
190  const Field_G& u_mu, const Field_G& u_nu,
191  const int mu, const int nu)
192 {
193  //- upper direction
194  Field_G v1;
195 
196  m_shift.backward(v1, u_mu, nu);
197 
198  Field_G v2;
199  mult_Field_Gnn(v2, 0, u_nu, 0, v1, 0);
200 
201  m_shift.backward(v1, u_nu, mu);
202  mult_Field_Gnd(c, 0, v2, 0, v1, 0);
203 
204  //- lower direction
205  m_shift.backward(v2, u_nu, mu);
206  mult_Field_Gnn(v1, 0, u_mu, 0, v2, 0);
207  mult_Field_Gdn(v2, 0, u_nu, 0, v1, 0);
208  m_shift.forward(v1, v2, nu);
209  c.addpart_ex(0, v1, 0);
210 }
211 
212 
213 //====================================================================
214 //============================================================END=====
Smear_HYP::m_v1
std::vector< Field_G > m_v1
Definition: smear_HYP.h:47
Field::setpart_ex
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:201
mult_Field_Gdn
void mult_Field_Gdn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:134
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
Smear_HYP::step1
void step1()
Definition: smear_HYP.cpp:114
ShiftField_lex::forward
void forward(Field &, const Field &, const int mu)
Definition: shiftField_lex.cpp:79
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
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
Smear_HYP::m_Nvol
int m_Nvol
Definition: smear_HYP.h:43
Smear_HYP::size_v2
int size_v2()
Definition: smear_HYP.h:103
Parameters::set_double
void set_double(const string &key, const double value)
Definition: parameters.cpp:33
Smear_HYP::m_alpha3
double m_alpha3
Definition: smear_HYP.h:44
Smear_HYP::m_alpha2
double m_alpha2
Definition: smear_HYP.h:44
Smear_HYP::index_v2
int index_v2(const int mu, int nu)
Definition: smear_HYP.h:92
Smear_HYP::staple
void staple(Field_G &, const Field_G &, const Field_G &, const int mu, const int nu)
Definition: smear_HYP.cpp:189
Smear_HYP::init
void init()
Definition: smear_HYP.cpp:80
Field::nex
int nex() const
Definition: field.h:128
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Smear_HYP::m_Ndim
int m_Ndim
Definition: smear_HYP.h:43
Smear_HYP::class_name
static const std::string class_name
Definition: smear_HYP.h:38
Smear_HYP::set_parameters
void set_parameters(const Parameters &params)
Definition: smear_HYP.cpp:25
Smear_HYP::size_v1
int size_v1()
Definition: smear_HYP.h:98
Smear_HYP::index_v1
int index_v1(const int mu, const int nu, const int rho)
Definition: smear_HYP.h:84
Smear_HYP::get_parameters
void get_parameters(Parameters &params) const
Definition: smear_HYP.cpp:50
Smear_HYP::m_vl
Bridge::VerboseLevel m_vl
Definition: smear_HYP.h:41
Field::addpart_ex
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:208
Smear_HYP::step3
void step3(Field_G &)
Definition: smear_HYP.cpp:164
Smear_HYP::m_U
std::vector< Field_G > m_U
Definition: smear_HYP.h:46
Field::nvol
int nvol() const
Definition: field.h:127
Smear_HYP::m_alpha1
double m_alpha1
Definition: smear_HYP.h:44
Smear_HYP::m_proj
Projection * m_proj
Definition: smear_HYP.h:45
Smear_HYP::smear
void smear(Field_G &Usmear, const Field_G &U)
Definition: smear_HYP.cpp:92
Smear_HYP::m_shift
ShiftField_lex m_shift
Definition: smear_HYP.h:49
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
mult_Field_Gnn
void mult_Field_Gnn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:95
ShiftField_lex::backward
void backward(Field &, const Field &, const int mu)
Definition: shiftField_lex.cpp:59
Smear_HYP::m_v2
std::vector< Field_G > m_v2
Definition: smear_HYP.h:48
scal
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:261
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_HYP.h
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
Smear_HYP::step2
void step2()
Definition: smear_HYP.cpp:137
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
mult_Field_Gnd
void mult_Field_Gnd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:173
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]