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