Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
smear_HYP_SF.cpp
Go to the documentation of this file.
1 
14 #include "smear_HYP_SF.h"
15 
16 
17 
18 #ifdef USE_FACTORY
19 namespace {
20  Smear *create_object(Projection *proj)
21  {
22  return new Smear_HYP_SF(proj);
23  }
24 
25 
26  bool init = Smear::Factory::Register("HYP_SF", create_object);
27 }
28 #endif
29 
30 
31 
32 const std::string Smear_HYP_SF::class_name = "Smear_HYP_SF";
33 
34 //====================================================================
36 {
37  const string str_vlevel = params.get_string("verbose_level");
38 
39  m_vl = vout.set_verbose_level(str_vlevel);
40 
41  //- fetch and check input parameters
42  double alpha1, alpha2, alpha3;
43  std::vector<double> phi, phipr;
44 
45  int err = 0;
46  err += params.fetch_double("alpha1", alpha1);
47  err += params.fetch_double("alpha2", alpha2);
48  err += params.fetch_double("alpha3", alpha3);
49  err += params.fetch_double_vector("phi", phi);
50  err += params.fetch_double_vector("phipr", phipr);
51 
52  if (err) {
53  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
54  exit(EXIT_FAILURE);
55  }
56 
57  set_parameters(alpha1, alpha2, alpha3, &phi[0], &phipr[0]);
58 }
59 
60 
61 //====================================================================
62 void Smear_HYP_SF::set_parameters(double alpha1, double alpha2, double alpha3,
63  double *phi, double *phipr)
64 {
65  //- print input parameters
66  vout.general(m_vl, "%s:\n", class_name.c_str());
67  vout.general(m_vl, " alpha1 = %10.6F\n", alpha1);
68  vout.general(m_vl, " alpha2 = %10.6F\n", alpha2);
69  vout.general(m_vl, " alpha3 = %10.6F\n", alpha3);
70 
71  vout.general(m_vl, " phi1 = %12.6f\n", phi[0]);
72  vout.general(m_vl, " phi2 = %12.6f\n", phi[1]);
73  vout.general(m_vl, " phi3 = %12.6f\n", phi[2]);
74  vout.general(m_vl, " phipr1= %12.6f\n", phipr[0]);
75  vout.general(m_vl, " phipr2= %12.6f\n", phipr[1]);
76  vout.general(m_vl, " phipr3= %12.6f\n", phipr[2]);
77 
78  //- range check
79  // NB. alpha1,alpha2,alpha3 == 0 is allowed.
80  // NB. phi,phipr == 0 is allowed.
81 
82  //- store values
83  m_alpha1 = alpha1;
84  m_alpha2 = alpha2;
85  m_alpha3 = alpha3;
86 
87  //- post-process
88  set_wk.set_parameters(phi, phipr);
89 }
90 
91 
92 //====================================================================
94 {
97 
98  m_U.resize(m_Ndim);
99  m_v1.resize(size_v1());
100  m_v2.resize(size_v2());
101 }
102 
103 
104 //====================================================================
105 void Smear_HYP_SF::smear(Field_G& Usmear, const Field_G& U)
106 {
107  assert(U.nvol() == m_Nvol);
108  assert(U.nex() == m_Ndim);
109 
110  assert(Usmear.nvol() == m_Nvol);
111  assert(Usmear.nex() == m_Ndim);
112 
113  for (int mu = 0; mu < m_Ndim; ++mu) {
114  m_U[mu].setpart_ex(0, U, mu);
115  if (mu != 3) set_wk.set_boundary_wk(m_U[mu]);
116  }
117 
118  step1();
119  // vout.general(m_vl,"level-1 step finished.\n");
120  step2();
121  // vout.general(m_vl,"level-2 step finished.\n");
122  step3(Usmear);
123  // vout.general(m_vl,"level-3 step finished.\n");
124 }
125 
126 
127 //====================================================================
129 {
130  Field_G c1(m_Nvol, 1);
131 
132  for (int mu = 0; mu < m_Ndim; ++mu) {
133  for (int nu = 0; nu < m_Ndim; ++nu) {
134  if (nu == mu) continue;
135 
136  for (int rho = nu + 1; rho < m_Ndim; ++rho) {
137  if (rho == mu) continue;
138  int sig = 6 - mu - nu - rho;
139  staple(c1, m_U[mu], m_U[sig], mu, sig);
140  //c1 *= m_alpha3 / 2.0;
141  scal(c1, m_alpha3 * 0.5);
142  m_proj->project(m_v1[index_v1(mu, nu, rho)], m_alpha3, c1, m_U[mu]);
143 
144  if (mu != 3) set_wk.set_boundary_wk(m_v1[index_v1(mu, nu, rho)]);
145  }
146  }
147  }
148 }
149 
150 
151 //====================================================================
153 {
154  Field_G c2(m_Nvol, 1), u_tmp(m_Nvol, 1);
155 
156  for (int mu = 0; mu < m_Ndim; ++mu) {
157  for (int nu = 0; nu < m_Ndim; ++nu) {
158  if (nu == mu) continue;
159  c2.set(0.0);
160 
161  for (int rho = 0; rho < m_Ndim; ++rho) {
162  if ((rho != mu) && (rho != nu)) {
163  staple(u_tmp, m_v1[index_v1(mu, nu, rho)],
164  m_v1[index_v1(rho, nu, mu)], mu, rho);
165  c2.addpart_ex(0, u_tmp, 0);
166  }
167  }
168 
169  //c2 *= m_alpha2 / 4.0;
170  scal(c2, m_alpha2 * 0.25);
171  m_proj->project(m_v2[index_v2(mu, nu)], m_alpha2, c2, m_U[mu]);
172 
173  if (mu != 3) set_wk.set_boundary_wk(m_v2[index_v2(mu, nu)]);
174  }
175  }
176 }
177 
178 
179 //====================================================================
181 {
182  Field_G c3(m_Nvol, 1), u_tmp(m_Nvol, 1);
183 
184  for (int mu = 0; mu < m_Ndim; ++mu) {
185  c3.set(0.0);
186 
187  for (int nu = 0; nu < m_Ndim; ++nu) {
188  if (nu != mu) {
189  staple(u_tmp, m_v2[index_v2(mu, nu)],
190  m_v2[index_v2(nu, mu)], mu, nu);
191  c3.addpart_ex(0, u_tmp, 0);
192  }
193  }
194 
195  //c3 *= m_alpha1 / 6.0;
196  scal(c3, m_alpha1 / 6.0);
197  m_proj->project(u_tmp, m_alpha1, c3, m_U[mu]);
198 
199  if (mu != 3) set_wk.set_boundary_wk(u_tmp);
200 
201  v.setpart_ex(mu, u_tmp, 0);
202  }
203 }
204 
205 
206 //====================================================================
208  const Field_G& u_mu, const Field_G& u_nu,
209  int mu, int nu)
210 {
211  Field_G v1(m_Nvol, 1), v2(m_Nvol, 1);
212 
213  //- upper direction
214  m_shift.backward(v1, u_mu, nu);
215  if (nu == 3) set_wk.set_boundary_wkpr(v1);
216  mult_Field_Gnn(v2, 0, u_nu, 0, v1, 0);
217 
218  m_shift.backward(v1, u_nu, mu);
219  if (mu == 3) set_wk.set_boundary_wkpr(v1);
220  mult_Field_Gnd(c, 0, v2, 0, v1, 0);
221 
222  //- lower direction
223  m_shift.backward(v2, u_nu, mu);
224  if (mu == 3) set_wk.set_boundary_wkpr(v2);
225  mult_Field_Gnn(v1, 0, u_mu, 0, v2, 0);
226  mult_Field_Gdn(v2, 0, u_nu, 0, v1, 0);
227  m_shift.forward(v1, v2, nu);
228  c.addpart_ex(0, v1, 0);
229  // if(mu!=3) c.set_boundary_zero();
230 }
231 
232 
233 //====================================================================
234 //============================================================END=====
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:282
BridgeIO vout
Definition: bridgeIO.cpp:495
void staple(Field_G &, const Field_G &, const Field_G &, int mu, int nu)
void set_boundary_wkpr(const Mat_SU_N &U)
Set the boundary spatial link at t=Nt-1 for SF bc.
Definition: field_G_SF.cpp:55
int index_v2(int mu, int nu)
Definition: smear_HYP_SF.h:88
int fetch_double_vector(const string &key, vector< double > &value) const
Definition: parameters.cpp:275
int index_v1(int mu, int nu, int rho)
Definition: smear_HYP_SF.h:80
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_SF.h:41
int nvol() const
Definition: field.h:116
void smear(Field_G &Usmear, const Field_G &U)
void mult_Field_Gdn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Class for parameters.
Definition: parameters.h:46
double m_alpha1
Definition: smear_HYP_SF.h:41
Field_G_SF set_wk
Definition: smear_HYP_SF.h:48
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:193
void set_parameters(const Parameters &params)
double m_alpha3
Definition: smear_HYP_SF.h:41
SU(N) gauge field.
Definition: field_G.h:38
void step3(Field_G &)
std::vector< Field_G > m_v1
Definition: smear_HYP_SF.h:44
void set_parameters(const std::vector< double > &phi, const std::vector< double > &phipr)
Set the parameter by giving vector objects.
Definition: field_G_SF.cpp:247
void set_boundary_wk(const Mat_SU_N &U)
Set the boundary spatial link at t=0 for SF bc.
Definition: field_G_SF.cpp:29
void backward(Field &, const Field &, const int mu)
int nex() const
Definition: field.h:117
HYP smearing of link variables with SF BC.
Definition: smear_HYP_SF.h:34
ShiftField_lex m_shift
Definition: smear_HYP_SF.h:46
void mult_Field_Gnn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
std::vector< Field_G > m_U
Definition: smear_HYP_SF.h:43
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
base class for projection operator into gauge group.
Definition: projection.h:31
static const std::string class_name
Definition: smear_HYP_SF.h:37
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
Bridge::VerboseLevel m_vl
Definition: smear.h:39
Projection * m_proj
Definition: smear_HYP_SF.h:42
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)
std::vector< Field_G > m_v2
Definition: smear_HYP_SF.h:45