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