Bridge++  Ver. 2.0.2
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  std::string vlevel;
28  if (!params.fetch_string("verbose_level", vlevel)) {
29  m_vl = vout.set_verbose_level(vlevel);
30  }
31 
32  //- fetch and check input parameters
33  double alpha1, alpha2, alpha3;
34  std::vector<double> phi, phipr;
35 
36  int err = 0;
37  err += params.fetch_double("alpha1", alpha1);
38  err += params.fetch_double("alpha2", alpha2);
39  err += params.fetch_double("alpha3", alpha3);
40  err += params.fetch_double_vector("phi", phi);
41  err += params.fetch_double_vector("phipr", phipr);
42 
43  if (err) {
44  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
45  exit(EXIT_FAILURE);
46  }
47 
48  set_parameters(alpha1, alpha2, alpha3, phi, phipr);
49 }
50 
51 
52 //====================================================================
54 {
55  params.set_double("alpha1", m_alpha1);
56  params.set_double("alpha2", m_alpha2);
57  params.set_double("alpha3", m_alpha3);
58  params.set_double_vector("phi", m_phi);
59  params.set_double_vector("phipr", m_phipr);
60 
61  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
62 }
63 
64 
65 //====================================================================
66 void Smear_HYP_SF::set_parameters(const double alpha1,
67  const double alpha2,
68  const double alpha3,
69  const std::vector<double>& phi,
70  const std::vector<double>& phipr)
71 {
72  //- print input parameters
73  vout.general(m_vl, "%s:\n", class_name.c_str());
74  vout.general(m_vl, " alpha1 = %10.6F\n", alpha1);
75  vout.general(m_vl, " alpha2 = %10.6F\n", alpha2);
76  vout.general(m_vl, " alpha3 = %10.6F\n", alpha3);
77 
78  vout.general(m_vl, " phi1 = %12.6f\n", phi[0]);
79  vout.general(m_vl, " phi2 = %12.6f\n", phi[1]);
80  vout.general(m_vl, " phi3 = %12.6f\n", phi[2]);
81  vout.general(m_vl, " phipr1= %12.6f\n", phipr[0]);
82  vout.general(m_vl, " phipr2= %12.6f\n", phipr[1]);
83  vout.general(m_vl, " phipr3= %12.6f\n", phipr[2]);
84 
85  //- range check
86  // NB. alpha1,alpha2,alpha3 == 0 is allowed.
87  // NB. phi,phipr == 0 is allowed.
88 
89  //- store values
90  m_alpha1 = alpha1;
91  m_alpha2 = alpha2;
92  m_alpha3 = alpha3;
93 
94  m_phi.resize(3);
95  m_phipr.resize(3);
96  for (int i = 0; i < 3; ++i) {
97  m_phi[i] = phi[i];
98  m_phipr[i] = phipr[i];
99  }
100 
103 }
104 
105 
106 //====================================================================
108 {
111 
112  m_U.resize(m_Ndim);
113  m_v1.resize(size_v1());
114  m_v2.resize(size_v2());
115 }
116 
117 
118 //====================================================================
119 void Smear_HYP_SF::smear(Field_G& Usmear, const Field_G& U)
120 {
121  assert(U.nvol() == m_Nvol);
122  assert(U.nex() == m_Ndim);
123 
124  assert(Usmear.nvol() == m_Nvol);
125  assert(Usmear.nex() == m_Ndim);
126 
127  for (int mu = 0; mu < m_Ndim; ++mu) {
128  copy(m_U[mu], 0, U, mu);
129  if (mu != 3) Field_SF::set_boundary_wk(m_U[mu], m_wk);
130  }
131 
132  step1();
133  // vout.general(m_vl,"level-1 step finished.\n");
134  step2();
135  // vout.general(m_vl,"level-2 step finished.\n");
136  step3(Usmear);
137  // vout.general(m_vl,"level-3 step finished.\n");
138 }
139 
140 
141 //====================================================================
143 {
144  for (int mu = 0; mu < m_Ndim; ++mu) {
145  for (int nu = 0; nu < m_Ndim; ++nu) {
146  if (nu == mu) continue;
147 
148  for (int rho = nu + 1; rho < m_Ndim; ++rho) {
149  if (rho == mu) continue;
150 
151  int sig = 6 - mu - nu - rho;
152 
153  Field_G c1;
154  staple(c1, m_U[mu], m_U[sig], mu, sig);
155  //c1 *= m_alpha3 / 2.0;
156  scal(c1, m_alpha3 * 0.5);
157  m_proj->project(m_v1[index_v1(mu, nu, rho)], m_alpha3, c1, m_U[mu]);
158 
159  if (mu != 3) Field_SF::set_boundary_wk(
160  m_v1[index_v1(mu, nu, rho)], m_wk);
161  }
162  }
163  }
164 }
165 
166 
167 //====================================================================
169 {
170  for (int mu = 0; mu < m_Ndim; ++mu) {
171  for (int nu = 0; nu < m_Ndim; ++nu) {
172  if (nu == mu) continue;
173 
174  Field_G c2;
175  c2.set(0.0);
176 
177  for (int rho = 0; rho < m_Ndim; ++rho) {
178  if ((rho != mu) && (rho != nu)) {
179  Field_G u_tmp;
180  staple(u_tmp, m_v1[index_v1(mu, nu, rho)],
181  m_v1[index_v1(rho, nu, mu)], mu, rho);
182  axpy(c2, 0, 1.0, u_tmp, 0);
183  }
184  }
185 
186  //c2 *= m_alpha2 / 4.0;
187  scal(c2, m_alpha2 * 0.25);
188  m_proj->project(m_v2[index_v2(mu, nu)], m_alpha2, c2, m_U[mu]);
189 
190  if (mu != 3) Field_SF::set_boundary_wk(m_v2[index_v2(mu, nu)], m_wk);
191  }
192  }
193 }
194 
195 
196 //====================================================================
198 {
199  for (int mu = 0; mu < m_Ndim; ++mu) {
200  Field_G c3;
201  c3.set(0.0);
202 
203  Field_G u_tmp;
204 
205  for (int nu = 0; nu < m_Ndim; ++nu) {
206  if (nu != mu) {
207  staple(u_tmp, m_v2[index_v2(mu, nu)],
208  m_v2[index_v2(nu, mu)], mu, nu);
209  axpy(c3, 0, 1.0, u_tmp, 0);
210  }
211  }
212 
213  //c3 *= m_alpha1 / 6.0;
214  scal(c3, m_alpha1 / 6.0);
215  m_proj->project(u_tmp, m_alpha1, c3, m_U[mu]);
216 
217  if (mu != 3) Field_SF::set_boundary_wk(u_tmp, m_wk);
218 
219  copy(v, mu, u_tmp, 0);
220  }
221 }
222 
223 
224 //====================================================================
226  const Field_G& u_mu, const Field_G& u_nu,
227  const int mu, const int nu)
228 {
229  //- upper direction
230  Field_G v1;
231 
232  m_shift.backward(v1, u_mu, nu);
233  if (nu == 3) Field_SF::set_boundary_wkpr(v1, m_wkpr);
234 
235  Field_G v2;
236  mult_Field_Gnn(v2, 0, u_nu, 0, v1, 0);
237 
238  m_shift.backward(v1, u_nu, mu);
239  if (mu == 3) Field_SF::set_boundary_wkpr(v1, m_wkpr);
240  mult_Field_Gnd(c, 0, v2, 0, v1, 0);
241 
242  //- lower direction
243  m_shift.backward(v2, u_nu, mu);
244  if (mu == 3) Field_SF::set_boundary_wkpr(v2, m_wkpr);
245  mult_Field_Gnn(v1, 0, u_mu, 0, v2, 0);
246  mult_Field_Gdn(v2, 0, u_nu, 0, v1, 0);
247  m_shift.forward(v1, v2, nu);
248  axpy(c, 0, 1.0, v1, 0);
249 }
250 
251 
252 //============================================================END=====
Smear_HYP_SF::m_proj
Projection * m_proj
Definition: smear_HYP_SF.h:47
Field_SF::set_boundary_wkpr
void set_boundary_wkpr(Field_G &u, const Mat_SU_N &wkpr)
Definition: field_SF.cpp:63
Smear_HYP_SF::m_alpha2
double m_alpha2
Definition: smear_HYP_SF.h:44
mult_Field_Gdn
void mult_Field_Gdn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:134
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
ShiftField_lex::forward
void forward(Field &, const Field &, const int mu)
Definition: shiftField_lex.cpp:79
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
Smear_HYP_SF::m_alpha3
double m_alpha3
Definition: smear_HYP_SF.h:44
Field::set
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
Parameters
Class for parameters.
Definition: parameters.h:46
Parameters::set_double
void set_double(const string &key, const double value)
Definition: parameters.cpp:33
Smear_HYP_SF::step1
void step1()
Definition: smear_HYP_SF.cpp:142
Field::nex
int nex() const
Definition: field.h:128
Smear_HYP_SF::staple
void staple(Field_G &, const Field_G &, const Field_G &, const int mu, const int nu)
Definition: smear_HYP_SF.cpp:225
Smear_HYP_SF::smear
void smear(Field_G &Usmear, const Field_G &U)
Definition: smear_HYP_SF.cpp:119
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Smear_HYP_SF::m_Ndim
int m_Ndim
Definition: smear_HYP_SF.h:43
Field_SF::set_boundary_wk
void set_boundary_wk(Field_G &u, const Mat_SU_N &wk)
Definition: field_SF.cpp:32
axpy
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:380
Smear_HYP_SF::m_U
std::vector< Field_G > m_U
Definition: smear_HYP_SF.h:48
Parameters::set_double_vector
void set_double_vector(const string &key, const vector< double > &value)
Definition: parameters.cpp:42
Smear_HYP_SF::init
void init()
Definition: smear_HYP_SF.cpp:107
Smear_HYP_SF::m_phipr
std::vector< double > m_phipr
Definition: smear_HYP_SF.h:45
copy
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:212
Smear_HYP_SF::m_alpha1
double m_alpha1
Definition: smear_HYP_SF.h:44
Smear_HYP_SF::m_wk
Mat_SU_N m_wk
SF boundary condition at t=0.
Definition: smear_HYP_SF.h:54
Smear_HYP_SF::m_v2
std::vector< Field_G > m_v2
Definition: smear_HYP_SF.h:50
Smear_HYP_SF::step3
void step3(Field_G &)
Definition: smear_HYP_SF.cpp:197
Smear_HYP_SF::m_vl
Bridge::VerboseLevel m_vl
Definition: smear_HYP_SF.h:41
Smear_HYP_SF::get_parameters
void get_parameters(Parameters &params) const
Definition: smear_HYP_SF.cpp:53
Smear_HYP_SF::size_v1
int size_v1()
Definition: smear_HYP_SF.h:110
Field::nvol
int nvol() const
Definition: field.h:127
Smear_HYP_SF::index_v2
int index_v2(const int mu, int nu)
Definition: smear_HYP_SF.h:104
Smear_HYP_SF::size_v2
int size_v2()
Definition: smear_HYP_SF.h:115
Smear_HYP_SF::step2
void step2()
Definition: smear_HYP_SF.cpp:168
Field_SF::set_boundary_matrix
void set_boundary_matrix(Mat_SU_N &wk, const std::vector< double > &phi)
Definition: field_SF.cpp:216
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
mult_Field_Gnn
void mult_Field_Gnn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:95
ShiftField_lex::backward
void backward(Field &, const Field &, const int mu)
Definition: shiftField_lex.cpp:59
Smear_HYP_SF::class_name
static const std::string class_name
Definition: smear_HYP_SF.h:38
Smear_HYP_SF::m_v1
std::vector< Field_G > m_v1
Definition: smear_HYP_SF.h:49
scal
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:261
Parameters::fetch_string
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
Smear_HYP_SF::m_wkpr
Mat_SU_N m_wkpr
SF boundary condition at t=Nt.
Definition: smear_HYP_SF.h:55
Parameters::fetch_double
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
Smear_HYP_SF::m_Nvol
int m_Nvol
Definition: smear_HYP_SF.h:43
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
Smear_HYP_SF::index_v1
int index_v1(const int mu, const int nu, const int rho)
Definition: smear_HYP_SF.h:96
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Smear_HYP_SF::m_shift
ShiftField_lex m_shift
Definition: smear_HYP_SF.h:51
Parameters::fetch_double_vector
int fetch_double_vector(const string &key, vector< double > &value) const
Definition: parameters.cpp:410
Smear_HYP_SF::m_phi
std::vector< double > m_phi
Definition: smear_HYP_SF.h:45
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
Smear_HYP_SF::set_parameters
void set_parameters(const Parameters &params)
Definition: smear_HYP_SF.cpp:25
mult_Field_Gnd
void mult_Field_Gnd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:173
smear_HYP_SF.h
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
Bridge::BridgeIO::get_verbose_level
static std::string get_verbose_level(const VerboseLevel vl)
Definition: bridgeIO.cpp:154
Projection::project
virtual void project(Field_G &v, const double alpha, const Field_G &C, const Field_G &U)=0
projection V = P[alpha, C, U]