Bridge++  Version 1.5.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 #ifdef USE_FACTORY_AUTOREGISTER
17 namespace {
18  bool init = Smear_HYP_SF::register_factory();
19 }
20 #endif
21 
22 const std::string Smear_HYP_SF::class_name = "Smear_HYP_SF";
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  std::vector<double> phi, phipr;
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  err += params.fetch_double_vector("phi", phi);
40  err += params.fetch_double_vector("phipr", phipr);
41 
42  if (err) {
43  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
44  exit(EXIT_FAILURE);
45  }
46 
47  set_parameters(alpha1, alpha2, alpha3, &phi[0], &phipr[0]);
48 }
49 
50 
51 //====================================================================
52 void Smear_HYP_SF::set_parameters(const double alpha1, const double alpha2, const double alpha3,
53  double *phi, double *phipr)
54 {
55  //- print input parameters
56  vout.general(m_vl, "%s:\n", class_name.c_str());
57  vout.general(m_vl, " alpha1 = %10.6F\n", alpha1);
58  vout.general(m_vl, " alpha2 = %10.6F\n", alpha2);
59  vout.general(m_vl, " alpha3 = %10.6F\n", alpha3);
60 
61  vout.general(m_vl, " phi1 = %12.6f\n", phi[0]);
62  vout.general(m_vl, " phi2 = %12.6f\n", phi[1]);
63  vout.general(m_vl, " phi3 = %12.6f\n", phi[2]);
64  vout.general(m_vl, " phipr1= %12.6f\n", phipr[0]);
65  vout.general(m_vl, " phipr2= %12.6f\n", phipr[1]);
66  vout.general(m_vl, " phipr3= %12.6f\n", phipr[2]);
67 
68  //- range check
69  // NB. alpha1,alpha2,alpha3 == 0 is allowed.
70  // NB. phi,phipr == 0 is allowed.
71 
72  //- store values
73  m_alpha1 = alpha1;
74  m_alpha2 = alpha2;
75  m_alpha3 = alpha3;
76 
77  //- post-process
78  set_wk.set_parameters(phi, phipr);
79 }
80 
81 
82 //====================================================================
84 {
87 
88  m_U.resize(m_Ndim);
89  m_v1.resize(size_v1());
90  m_v2.resize(size_v2());
91 }
92 
93 
94 //====================================================================
95 void Smear_HYP_SF::smear(Field_G& Usmear, const Field_G& U)
96 {
97  assert(U.nvol() == m_Nvol);
98  assert(U.nex() == m_Ndim);
99 
100  assert(Usmear.nvol() == m_Nvol);
101  assert(Usmear.nex() == m_Ndim);
102 
103  for (int mu = 0; mu < m_Ndim; ++mu) {
104  m_U[mu].setpart_ex(0, U, mu);
105  if (mu != 3) set_wk.set_boundary_wk(m_U[mu]);
106  }
107 
108  step1();
109  // vout.general(m_vl,"level-1 step finished.\n");
110  step2();
111  // vout.general(m_vl,"level-2 step finished.\n");
112  step3(Usmear);
113  // vout.general(m_vl,"level-3 step finished.\n");
114 }
115 
116 
117 //====================================================================
119 {
120  for (int mu = 0; mu < m_Ndim; ++mu) {
121  for (int nu = 0; nu < m_Ndim; ++nu) {
122  if (nu == mu) continue;
123 
124  for (int rho = nu + 1; rho < m_Ndim; ++rho) {
125  if (rho == mu) continue;
126 
127  int sig = 6 - mu - nu - rho;
128 
129  Field_G c1;
130  staple(c1, m_U[mu], m_U[sig], mu, sig);
131  //c1 *= m_alpha3 / 2.0;
132  scal(c1, m_alpha3 * 0.5);
133  m_proj->project(m_v1[index_v1(mu, nu, rho)], m_alpha3, c1, m_U[mu]);
134 
135  if (mu != 3) set_wk.set_boundary_wk(m_v1[index_v1(mu, nu, rho)]);
136  }
137  }
138  }
139 }
140 
141 
142 //====================================================================
144 {
145  for (int mu = 0; mu < m_Ndim; ++mu) {
146  for (int nu = 0; nu < m_Ndim; ++nu) {
147  if (nu == mu) continue;
148 
149  Field_G c2;
150  c2.set(0.0);
151 
152  for (int rho = 0; rho < m_Ndim; ++rho) {
153  if ((rho != mu) && (rho != nu)) {
154  Field_G u_tmp;
155  staple(u_tmp, m_v1[index_v1(mu, nu, rho)],
156  m_v1[index_v1(rho, nu, mu)], mu, rho);
157  c2.addpart_ex(0, u_tmp, 0);
158  }
159  }
160 
161  //c2 *= m_alpha2 / 4.0;
162  scal(c2, m_alpha2 * 0.25);
163  m_proj->project(m_v2[index_v2(mu, nu)], m_alpha2, c2, m_U[mu]);
164 
165  if (mu != 3) set_wk.set_boundary_wk(m_v2[index_v2(mu, nu)]);
166  }
167  }
168 }
169 
170 
171 //====================================================================
173 {
174  for (int mu = 0; mu < m_Ndim; ++mu) {
175  Field_G c3;
176  c3.set(0.0);
177 
178  Field_G u_tmp;
179 
180  for (int nu = 0; nu < m_Ndim; ++nu) {
181  if (nu != mu) {
182  staple(u_tmp, m_v2[index_v2(mu, nu)],
183  m_v2[index_v2(nu, mu)], mu, nu);
184  c3.addpart_ex(0, u_tmp, 0);
185  }
186  }
187 
188  //c3 *= m_alpha1 / 6.0;
189  scal(c3, m_alpha1 / 6.0);
190  m_proj->project(u_tmp, m_alpha1, c3, m_U[mu]);
191 
192  if (mu != 3) set_wk.set_boundary_wk(u_tmp);
193 
194  v.setpart_ex(mu, u_tmp, 0);
195  }
196 }
197 
198 
199 //====================================================================
201  const Field_G& u_mu, const Field_G& u_nu,
202  const int mu, const int nu)
203 {
204  //- upper direction
205  Field_G v1;
206 
207  m_shift.backward(v1, u_mu, nu);
208  if (nu == 3) set_wk.set_boundary_wkpr(v1);
209 
210  Field_G v2;
211  mult_Field_Gnn(v2, 0, u_nu, 0, v1, 0);
212 
213  m_shift.backward(v1, u_nu, mu);
214  if (mu == 3) set_wk.set_boundary_wkpr(v1);
215  mult_Field_Gnd(c, 0, v2, 0, v1, 0);
216 
217  //- lower direction
218  m_shift.backward(v2, u_nu, mu);
219  if (mu == 3) set_wk.set_boundary_wkpr(v2);
220  mult_Field_Gnn(v1, 0, u_mu, 0, v2, 0);
221  mult_Field_Gdn(v2, 0, u_nu, 0, v1, 0);
222  m_shift.forward(v1, v2, nu);
223  c.addpart_ex(0, v1, 0);
224  // if(mu!=3) c.set_boundary_zero();
225 }
226 
227 
228 //====================================================================
229 //============================================================END=====
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:433
BridgeIO vout
Definition: bridgeIO.cpp:503
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:53
int fetch_double_vector(const string &key, vector< double > &value) const
Definition: parameters.cpp:410
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
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_SF.h:42
int nvol() const
Definition: field.h:127
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:42
Field_G_SF set_wk
Definition: smear_HYP_SF.h:49
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:204
void set_parameters(const Parameters &params)
double m_alpha3
Definition: smear_HYP_SF.h:42
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 step3(Field_G &)
std::vector< Field_G > m_v1
Definition: smear_HYP_SF.h:45
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:245
int index_v2(const int mu, int nu)
Definition: smear_HYP_SF.h:90
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:27
void backward(Field &, const Field &, const int mu)
int nex() const
Definition: field.h:128
ShiftField_lex m_shift
Definition: smear_HYP_SF.h:47
int index_v1(const int mu, const int nu, const int rho)
Definition: smear_HYP_SF.h:82
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:44
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
static const std::string class_name
Definition: smear_HYP_SF.h:38
void staple(Field_G &, const Field_G &, const Field_G &, const int mu, const int nu)
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
Bridge::VerboseLevel m_vl
Definition: smear.h:37
Projection * m_proj
Definition: smear_HYP_SF.h:43
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:46