Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  const string str_vlevel = params.get_string("verbose_level");
28 
29  m_vl = vout.set_verbose_level(str_vlevel);
30 
31  //- fetch and check input parameters
32  double alpha1, alpha2, alpha3;
33 
34  int err = 0;
35  err += params.fetch_double("alpha1", alpha1);
36  err += params.fetch_double("alpha2", alpha2);
37  err += params.fetch_double("alpha3", alpha3);
38 
39  if (err) {
40  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
41  exit(EXIT_FAILURE);
42  }
43 
44  set_parameters(alpha1, alpha2, alpha3);
45 }
46 
47 
48 //====================================================================
49 void Smear_HYP::set_parameters(const double alpha1, const double alpha2, const double alpha3)
50 {
51  //- print input parameters
52  vout.general(m_vl, "%s:\n", class_name.c_str());
53  vout.general(m_vl, " alpha1 = %10.6F\n", alpha1);
54  vout.general(m_vl, " alpha2 = %10.6F\n", alpha2);
55  vout.general(m_vl, " alpha3 = %10.6F\n", alpha3);
56 
57  //- range check
58  // NB. alpha1,alpha2,alpha3 == 0 is allowed.
59 
60  //- store values
61  m_alpha1 = alpha1;
62  m_alpha2 = alpha2;
63  m_alpha3 = alpha3;
64 }
65 
66 
67 //====================================================================
69 {
72 
73  m_U.resize(m_Ndim);
74  m_v1.resize(size_v1());
75  m_v2.resize(size_v2());
76 }
77 
78 
79 //====================================================================
80 void Smear_HYP::smear(Field_G& Usmear, const Field_G& U)
81 {
82  assert(U.nvol() == m_Nvol);
83  assert(U.nex() == m_Ndim);
84 
85  assert(Usmear.nvol() == m_Nvol);
86  assert(Usmear.nex() == m_Ndim);
87 
88  for (int mu = 0; mu < m_Ndim; ++mu) {
89  m_U[mu].setpart_ex(0, U, mu);
90  }
91 
92  step1();
93  // vout.general(m_vl, "level-1 step finished.\n");
94  step2();
95  // vout.general(m_vl, "level-2 step finished.\n");
96  step3(Usmear);
97  // vout.general(m_vl, "level-3 step finished.\n");
98 }
99 
100 
101 //====================================================================
103 {
104  for (int mu = 0; mu < m_Ndim; ++mu) {
105  for (int nu = 0; nu < m_Ndim; ++nu) {
106  if (nu == mu) continue;
107 
108  for (int rho = nu + 1; rho < m_Ndim; ++rho) {
109  if (rho == mu) continue;
110 
111  int sig = 6 - mu - nu - rho;
112 
113  Field_G c1;
114  staple(c1, m_U[mu], m_U[sig], mu, sig);
115  //c1 *= m_alpha3 / 2.0;
116  scal(c1, m_alpha3 * 0.5);
117  m_proj->project(m_v1[index_v1(mu, nu, rho)], m_alpha3, c1, m_U[mu]);
118  }
119  }
120  }
121 }
122 
123 
124 //====================================================================
126 {
127  for (int mu = 0; mu < m_Ndim; ++mu) {
128  for (int nu = 0; nu < m_Ndim; ++nu) {
129  if (nu == mu) continue;
130 
131  Field_G c2;
132  c2.set(0.0);
133 
134  for (int rho = 0; rho < m_Ndim; ++rho) {
135  if ((rho != mu) && (rho != nu)) {
136  Field_G u_tmp;
137  staple(u_tmp, m_v1[index_v1(mu, nu, rho)],
138  m_v1[index_v1(rho, nu, mu)], mu, rho);
139  c2.addpart_ex(0, u_tmp, 0);
140  }
141  }
142 
143  //c2 *= m_alpha2 / 4.0;
144  scal(c2, m_alpha2 * 0.25);
145  m_proj->project(m_v2[index_v2(mu, nu)], m_alpha2, c2, m_U[mu]);
146  }
147  }
148 }
149 
150 
151 //====================================================================
153 {
154  for (int mu = 0; mu < m_Ndim; ++mu) {
155  Field_G c3;
156  c3.set(0.0);
157 
158  Field_G u_tmp;
159 
160  for (int nu = 0; nu < m_Ndim; ++nu) {
161  if (nu != mu) {
162  staple(u_tmp, m_v2[index_v2(mu, nu)],
163  m_v2[index_v2(nu, mu)], mu, nu);
164  c3.addpart_ex(0, u_tmp, 0);
165  }
166  }
167 
168  //c3 *= m_alpha1 / 6.0;
169  scal(c3, m_alpha1 / 6.0);
170  m_proj->project(u_tmp, m_alpha1, c3, m_U[mu]);
171  v.setpart_ex(mu, u_tmp, 0);
172  }
173 }
174 
175 
176 //====================================================================
178  const Field_G& u_mu, const Field_G& u_nu,
179  const int mu, const int nu)
180 {
181  //- upper direction
182  Field_G v1;
183 
184  m_shift.backward(v1, u_mu, nu);
185 
186  Field_G v2;
187  mult_Field_Gnn(v2, 0, u_nu, 0, v1, 0);
188 
189  m_shift.backward(v1, u_nu, mu);
190  mult_Field_Gnd(c, 0, v2, 0, v1, 0);
191 
192  //- lower direction
193  m_shift.backward(v2, u_nu, mu);
194  mult_Field_Gnn(v1, 0, u_mu, 0, v2, 0);
195  mult_Field_Gdn(v2, 0, u_nu, 0, v1, 0);
196  m_shift.forward(v1, v2, nu);
197  c.addpart_ex(0, v1, 0);
198 }
199 
200 
201 //====================================================================
202 //============================================================END=====
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:433
BridgeIO vout
Definition: bridgeIO.cpp:503
int index_v2(const int mu, int nu)
Definition: smear_HYP.h:87
std::vector< Field_G > m_v2
Definition: smear_HYP.h:46
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
void init()
Definition: smear_HYP.cpp:68
void general(const char *format,...)
Definition: bridgeIO.cpp:197
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
double m_alpha2
Definition: smear_HYP.h:42
int nvol() const
Definition: field.h:127
void mult_Field_Gdn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
int m_Nvol
Definition: smear_HYP.h:41
void set_parameters(const Parameters &params)
Definition: smear_HYP.cpp:25
Class for parameters.
Definition: parameters.h:46
void step3(Field_G &)
Definition: smear_HYP.cpp:152
void staple(Field_G &, const Field_G &, const Field_G &, const int mu, const int nu)
Definition: smear_HYP.cpp:177
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:204
static const std::string class_name
Definition: smear_HYP.h:38
int size_v1()
Definition: smear_HYP.h:93
Projection * m_proj
Definition: smear_HYP.h:43
int size_v2()
Definition: smear_HYP.h:98
virtual void project(Field_G &v, const double alpha, const Field_G &C, const Field_G &U)=0
projection V = P[alpha, C, U]
SU(N) gauge field.
Definition: field_G.h:38
void step1()
Definition: smear_HYP.cpp:102
std::vector< Field_G > m_U
Definition: smear_HYP.h:44
void backward(Field &, const Field &, const int mu)
int nex() const
Definition: field.h:128
ShiftField_lex m_shift
Definition: smear_HYP.h:47
double m_alpha1
Definition: smear_HYP.h:42
void mult_Field_Gnn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
int index_v1(const int mu, const int nu, const int rho)
Definition: smear_HYP.h:79
void step2()
Definition: smear_HYP.cpp:125
void smear(Field_G &Usmear, const Field_G &U)
Definition: smear_HYP.cpp:80
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:197
string get_string(const string &key) const
Definition: parameters.cpp:221
double m_alpha3
Definition: smear_HYP.h:42
std::vector< Field_G > m_v1
Definition: smear_HYP.h:45
Bridge::VerboseLevel m_vl
Definition: smear.h:37
int m_Ndim
Definition: smear_HYP.h:41
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
void forward(Field &, const Field &, const int mu)
void mult_Field_Gnd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)