Bridge++  Ver. 1.2.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_Wilson_eo.cpp
Go to the documentation of this file.
1 
14 #include "fopr_Wilson_eo.h"
15 #include "fopr_Wilson_eo_impl.h"
16 
17 #ifdef USE_PARAMETERS_FACTORY
18 #include "parameters_factory.h"
19 #endif
20 
21 #include "threadManager_OpenMP.h"
22 
23 using std::valarray;
24 
25 //- parameter entries
26 namespace {
27  void append_entry(Parameters& param)
28  {
29  param.Register_string("gamma_matrix_type", "NULL");
30 
31  param.Register_double("hopping_parameter", 0.0);
32  param.Register_int_vector("boundary_condition", std::valarray<int>());
33 
34  param.Register_string("verbose_level", "NULL");
35  }
36 
37 
38 #ifdef USE_PARAMETERS_FACTORY
39  bool init_param = ParametersFactory::Register("Fopr.Wilson_eo", append_entry);
40 #endif
41 }
42 //- end
43 
44 const std::string Fopr_Wilson_eo::class_name = "Fopr_Wilson_eo";
45 
46 //====================================================================
48 {
53  m_Nvol2 = m_Nvol / 2;
54 
55  m_impl = new Fopr_Wilson_eo_impl("Dirac");
56 }
57 
58 //====================================================================
60 {
65  m_Nvol2 = m_Nvol / 2;
66 
67  m_impl = new Fopr_Wilson_eo_impl(repr);
68 }
69 
70 //====================================================================
72 { delete m_impl; }
73 
74 //====================================================================
76 {
77  const string str_vlevel = params.get_string("verbose_level");
78 
79  m_vl = vout.set_verbose_level(str_vlevel);
80 
81  //- fetch and check input parameters
82  double kappa;
83  valarray<int> bc;
84 
85  int err = 0;
86  err += params.fetch_double("hopping_parameter", kappa);
87  err += params.fetch_int_vector("boundary_condition", bc);
88 
89  if (err) {
90  vout.crucial(m_vl, "Fopr_Wilson_eo: fetch error, input parameter not found.\n");
91  abort();
92  }
93 
94  set_parameters(kappa, bc);
95 }
96 
97 //====================================================================
98 void Fopr_Wilson_eo::set_parameters(const double kappa, const std::valarray<int> bc)
99 { m_impl->set_parameters(kappa, bc); }
100 
101 //====================================================================
103 { m_impl->set_config(U); }
104 
105 //====================================================================
107 {
109 }
110 
111 //====================================================================
113 {
114  vout.crucial("%s: mode undefined.\n", class_name.c_str());
115  abort();
116 }
117 
118 //====================================================================
120 {
121  int Lvol = CommonParameters::Lvol();
122  double flop_eo = m_impl->flop_count(); // this is only for Meo.
123  double flop = 2.0 * flop_eo
124  + static_cast<double>(4 * m_Nc * m_Nd * Lvol / 2);
125 
126  if ((m_mode == "DdagD") || (m_mode == "DDdag")) flop *= 2.0;
127 
128  return flop;
129 }
130 
131 //====================================================================
132 void Fopr_Wilson_eo::D(Field& v, const Field& f)
133 { m_impl->D(v, f); }
134 
135 //====================================================================
136 void Fopr_Wilson_eo::Ddag(Field& v, const Field& f)
137 { m_impl->Ddag(v, f); }
138 
139 //====================================================================
141 { m_impl->DdagD(v, f); }
142 
143 //====================================================================
145 { m_impl->DDdag(v, f); }
146 
147 //====================================================================
148 void Fopr_Wilson_eo::H(Field& v, const Field& f)
149 { m_impl->H(v, f); }
150 
151 //====================================================================
153 {
155 
156  Field v(f.nin(), f.nvol(), f.nex());
157  m_impl->MeoMoe(v, f);
158 
159  return v;
160 }
161 
162 //====================================================================
164 {
166 
167  Field v(f.nin(), f.nvol(), f.nex());
168  m_impl->D(v, f);
169 
170  return v;
171 }
172 
173 //====================================================================
175 {
177 
178  Field v(f.nin(), f.nvol(), f.nex());
179  m_impl->Ddag(v, f);
180 
181  return v;
182 }
183 
184 //====================================================================
186 {
188 
189  Field v(f.nin(), f.nvol(), f.nex());
190  m_impl->DdagD(v, f);
191 
192  return v;
193 }
194 
195 //====================================================================
197 {
199 
200  Field v(f.nin(), f.nvol(), f.nex());
201  m_impl->DDdag(v, f);
202 
203  return v;
204 }
205 
206 //====================================================================
208 {
210 
211  Field v(f.nin(), f.nvol(), f.nex());
212  m_impl->H(v, f);
213 
214  return v;
215 }
216 
217 //====================================================================
219 {
221 
222  Field_F w(m_Nvol2, f.nex());
223  m_impl->mult_gm5(w, f);
224 
225  return w;
226 }
227 
228 //====================================================================
229 const Field_F Fopr_Wilson_eo::Meo(const Field_F& f, const int ieo)
230 {
232 
233  Field_F w(m_Nvol2, f.nex());
234  m_impl->Meo(w, f, ieo);
235 
236  return w;
237 }
238 
239 //====================================================================
240 const Field_F Fopr_Wilson_eo::Mdageo(const Field_F& f, const int ieo)
241 {
243 
244  Field_F w(m_Nvol2, f.nex());
245  m_impl->Mdageo(w, f, ieo);
246 
247  return w;
248 }
249 
250 //====================================================================
251 const Field_F Fopr_Wilson_eo::Meo_gm5(const Field_F& f, const int ieo)
252 {
254 
255  Field_F w(m_Nvol2, f.nex());
256  m_impl->Mdageo(w, f, ieo);
257 
258  return w;
259 }
260 
261 //====================================================================
262 const Field Fopr_Wilson_eo::gm5p(const int mu, const Field& f)
263 {
265 
266  Field_F w(m_Nvol2, f.nex());
267  m_impl->gm5p(mu, w, f);
268 
269  return w;
270 }
271 
272 //====================================================================
273 void Fopr_Wilson_eo::prePropD(Field& Be, Field& bo, const Field& b)
274 { m_impl->prePropD(Be, bo, b); }
275 
276 //====================================================================
277 void Fopr_Wilson_eo::postPropD(Field& x, const Field& xe, const Field& bo)
278 { m_impl->postPropD(x, xe, bo); }
279 
280 //====================================================================
281 void Fopr_Wilson_eo::prePropDag(Field& Be, Field& bo, const Field& b)
282 { m_impl->prePropDag(Be, bo, b); }
283 
284 //====================================================================
285 void Fopr_Wilson_eo::postPropDag(Field& x, const Field& xe, const Field& bo)
286 { m_impl->postPropDag(x, xe, bo); }
287 
288 //====================================================================
290 { m_impl->mult_gm5(v, f); }
291 
292 //====================================================================
293 void Fopr_Wilson_eo::Meo(Field& w, const Field& f, const int ieo)
294 { m_impl->Meo(w, f, ieo); }
295 
296 //====================================================================
298  Field_F& w, const Field_F& f,
299  const int ieo)
300 { m_impl->mult_p(mu, w, f, ieo); }
301 
302 //=====================================================================
304  Field_F& w, const Field_F& f,
305  const int ieo)
306 { m_impl->mult_m(mu, w, f, ieo); }
307 
308 //====================================================================
309 //============================================================END=====
const Field_F Meo(const Field_F &, const int ieo)
void prePropD(Field &, Field &, const Field &)
BridgeIO vout
Definition: bridgeIO.cpp:207
void prePropDag(Field &, Field &, const Field &)
void Register_string(const string &, const string &)
Definition: parameters.cpp:352
void MeoMoe(Field &, const Field &)
void H(Field &v, const Field &f)
void mult_gm5(Field &v, const Field &f)
const Field_F Mdageo(const Field_F &, const int ieo)
void D(Field &v, const Field &f)
Implementation of even-odd Wilson fermion operator.
void set_parameters(const double kappa, const std::valarray< int > bc)
Container of Field-type object.
Definition: field.h:37
const Field MeoMoe(const Field &f)
void DdagD(Field &v, const Field &f)
void set_parameters(const Parameters &params)
int nvol() const
Definition: field.h:101
Fopr_Wilson_eo_impl * m_impl
Class for parameters.
Definition: parameters.h:40
static int Lvol()
int fetch_int_vector(const string &key, std::valarray< int > &val) const
Definition: parameters.cpp:176
std::string m_mode
void mult_gm5(Field &, const Field &)
void postPropDag(Field &, const Field &, const Field &)
Wilson-type fermion field.
Definition: field_F.h:37
void mult_m(int mu, Field_F &, const Field_F &, const int ieo)
void mult_p(int mu, Field_F &, const Field_F &, const int ieo)
double flop_count()
this returns the number of floating point number operations.
int nin() const
Definition: field.h:100
void Meo(Field &, const Field &, const int ieo)
void DdagD(Field &v, const Field &f)
void postPropD(Field &, const Field &, const Field &)
void DDdag(Field &v, const Field &f)
Bridge::VerboseLevel m_vl
Definition: fopr.h:99
void set_config(Field *U)
setting pointer to the gauge configuration.
void Ddag(Field &v, const Field &f)
void postPropDag(Field &, const Field &, const Field &)
Base class of fermion operator family.
Definition: fopr_eo.h:33
void Mdageo(Field &, const Field &, const int ieo)
int nex() const
Definition: field.h:102
void DDdag(Field &v, const Field &f)
void crucial(const char *format,...)
Definition: bridgeIO.cpp:26
const Field gm5p(const int mu, const Field &v)
gamma_5 (1 - gamma_mu) v(x + mu)
void H(Field &v, const Field &f)
void D(Field &v, const Field &f)
static bool Register(const std::string &realm, const creator_callback &cb)
void mult_undef(Field &, const Field &)
void Ddag(Field &v, const Field &f)
void Register_double(const string &, const double)
Definition: parameters.cpp:324
void postPropD(Field &, const Field &, const Field &)
void mult_m(int mu, Field_F &, const Field_F &, const int ieo)
void Register_int_vector(const string &, const std::valarray< int > &)
Definition: parameters.cpp:345
double flop_count()
this returns the number of floating point operations of Meo.
static const std::string class_name
void mult_p(int mu, Field_F &, const Field_F &, const int ieo)
void prePropD(Field &, Field &, const Field &)
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 assert_single_thread()
function returning Field instance must be called from single thread.
void prePropDag(Field &, Field &, const Field &)
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:191
void gm5p(const int mu, Field &, const Field &v)
gamma_5 (1 - gamma_mu) v(x + mu) used in force calculation.
static void assert_single_thread(const std::string &classname)
assert currently running on single thread.
const Field_F Meo_gm5(const Field_F &, const int ieo)