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