Bridge++  Ver. 1.3.x
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 #ifdef USE_FACTORY
24 namespace {
25  Fopr *create_object()
26  {
27  return new Fopr_Wilson_eo();
28  }
29 
30 
31  Fopr *create_object_with_repr(const std::string& repr)
32  {
33  return new Fopr_Wilson_eo(repr);
34  }
35 
36 
37  bool init1 = Fopr::Factory_noarg::Register("Wilson_eo", create_object);
38  bool init2 = Fopr::Factory_string::Register("Wilson_eo", create_object_with_repr);
39 }
40 #endif
41 
42 //- parameter entries
43 namespace {
44  void append_entry(Parameters& param)
45  {
46  param.Register_string("gamma_matrix_type", "NULL");
47 
48  param.Register_double("hopping_parameter", 0.0);
49  param.Register_int_vector("boundary_condition", std::vector<int>());
50 
51  param.Register_string("verbose_level", "NULL");
52  }
53 
54 
55 #ifdef USE_PARAMETERS_FACTORY
56  bool init_param = ParametersFactory::Register("Fopr.Wilson_eo", append_entry);
57 #endif
58 }
59 //- end
60 
61 const std::string Fopr_Wilson_eo::class_name = "Fopr_Wilson_eo";
62 
63 //====================================================================
65 {
70  m_Nvol2 = m_Nvol / 2;
71 
72  m_impl = new Fopr_Wilson_eo_impl("Dirac");
73 }
74 
75 
76 //====================================================================
78 {
83  m_Nvol2 = m_Nvol / 2;
84 
85  m_impl = new Fopr_Wilson_eo_impl(repr);
86 }
87 
88 
89 //====================================================================
91 { delete m_impl; }
92 
93 //====================================================================
95 {
96  const string str_vlevel = params.get_string("verbose_level");
97 
98  m_vl = vout.set_verbose_level(str_vlevel);
99 
100  //- fetch and check input parameters
101  double kappa;
102  std::vector<int> bc;
103 
104  int err = 0;
105  err += params.fetch_double("hopping_parameter", kappa);
106  err += params.fetch_int_vector("boundary_condition", bc);
107 
108  if (err) {
109  vout.crucial(m_vl, "Fopr_Wilson_eo: fetch error, input parameter not found.\n");
110  exit(EXIT_FAILURE);
111  }
112 
113  set_parameters(kappa, bc);
114 }
115 
116 
117 //====================================================================
118 void Fopr_Wilson_eo::set_parameters(const double kappa, const std::vector<int> bc)
119 { m_impl->set_parameters(kappa, bc); }
120 
121 //====================================================================
123 { m_impl->set_config(U); }
124 
125 //====================================================================
127 {
128  vout.crucial("%s: mode undefined.\n", class_name.c_str());
129  exit(EXIT_FAILURE);
130 }
131 
132 
133 //====================================================================
135 {
136  int Lvol = CommonParameters::Lvol();
137  double flop_eo = m_impl->flop_count(); // this is only for Meo.
138  double flop = 2.0 * flop_eo
139  + static_cast<double>(4 * m_Nc * m_Nd * Lvol / 2);
140 
141  if ((m_mode == "DdagD") || (m_mode == "DDdag")) flop *= 2.0;
142 
143  return flop;
144 }
145 
146 
147 //====================================================================
149 { m_impl->MeoMoe(v, f); }
150 //====================================================================
151 
152 void Fopr_Wilson_eo::D(Field& v, const Field& f)
153 { m_impl->D(v, f); }
154 
155 //====================================================================
156 void Fopr_Wilson_eo::Ddag(Field& v, const Field& f)
157 { m_impl->Ddag(v, f); }
158 
159 //====================================================================
161 { m_impl->DdagD(v, f); }
162 
163 //====================================================================
165 { m_impl->DDdag(v, f); }
166 
167 //====================================================================
168 void Fopr_Wilson_eo::H(Field& v, const Field& f)
169 { m_impl->H(v, f); }
170 
171 //====================================================================
172 void Fopr_Wilson_eo::Meo(Field& v, const Field& f, const int ieo)
173 { m_impl->Meo(v, f, ieo); }
174 
175 //====================================================================
176 void Fopr_Wilson_eo::Mdageo(Field& v, const Field& f, const int ieo)
177 { m_impl->Mdageo(v, f, ieo); }
178 
179 //===================================================================
180 void Fopr_Wilson_eo::Meo_gm5(Field& v, const Field& f, const int ieo)
181 {
182  assert(f.nvol() == m_Nvol2);
183  m_impl->Meo_gm5(v, f, ieo);
184 }
185 
186 
187 //====================================================================
188 void Fopr_Wilson_eo::gm5p(const int mu, Field& w, const Field& f)
189 { m_impl->gm5p(mu, w, f); }
190 
191 //====================================================================
192 void Fopr_Wilson_eo::prePropD(Field& Be, Field& bo, const Field& b)
193 { m_impl->prePropD(Be, bo, b); }
194 
195 //====================================================================
196 void Fopr_Wilson_eo::postPropD(Field& x, const Field& xe, const Field& bo)
197 { m_impl->postPropD(x, xe, bo); }
198 
199 //====================================================================
200 void Fopr_Wilson_eo::prePropDag(Field& Be, Field& bo, const Field& b)
201 { m_impl->prePropDag(Be, bo, b); }
202 
203 //====================================================================
204 void Fopr_Wilson_eo::postPropDag(Field& x, const Field& xe, const Field& bo)
205 { m_impl->postPropDag(x, xe, bo); }
206 
207 //====================================================================
209 { m_impl->mult_gm5(v, f); }
210 
211 //====================================================================
213  Field_F& w, const Field_F& f,
214  const int ieo)
215 { m_impl->mult_p(mu, w, f, ieo); }
216 
217 //=====================================================================
219  Field_F& w, const Field_F& f,
220  const int ieo)
221 { m_impl->mult_m(mu, w, f, ieo); }
222 
223 //====================================================================
224 //============================================================END=====
void Register_int_vector(const string &, const std::vector< int > &)
Definition: parameters.cpp:344
void prePropD(Field &, Field &, const Field &)
BridgeIO vout
Definition: bridgeIO.cpp:278
void prePropDag(Field &, Field &, const Field &)
void Register_string(const string &, const string &)
Definition: parameters.cpp:351
void MeoMoe(Field &, const Field &)
void H(Field &v, const Field &f)
void mult_gm5(Field &v, const Field &f)
void D(Field &v, const Field &f)
Implementation of even-odd Wilson fermion operator.
void Meo_gm5(Field &, const Field &, const int ieo)
Container of Field-type object.
Definition: field.h:39
void DdagD(Field &v, const Field &f)
void set_parameters(const Parameters &params)
int nvol() const
Definition: field.h:116
Fopr_Wilson_eo_impl * m_impl
Class for parameters.
Definition: parameters.h:38
static int Lvol()
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.
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)
void gm5p(const int mu, Field &w, const Field &v)
gamma_5 (1 - gamma_mu) v(x + mu)
Bridge::VerboseLevel m_vl
Definition: fopr.h:113
void set_config(Field *U)
setting pointer to the gauge configuration.
void Ddag(Field &v, const Field &f)
void Meo_gm5(Field &, const Field &, const int ieo)
void postPropDag(Field &, const Field &, const Field &)
Base class of fermion operator family.
Definition: fopr_eo.h:34
void Mdageo(Field &, const Field &, const int ieo)
void DDdag(Field &v, const Field &f)
void set_parameters(const double kappa, const std::vector< int > bc)
void crucial(const char *format,...)
Definition: bridgeIO.cpp:48
Even-odd Wilson fermion operator.
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 Meo(Field &, const Field &, const int ieo)
even-odd operatior: ieo=0: even <– odd, ieo=1: odd <– even
void mult_undef(Field &, const Field &)
void Ddag(Field &v, const Field &f)
void Register_double(const string &, const double)
Definition: parameters.cpp:323
void postPropD(Field &, const Field &, const Field &)
void mult_m(int mu, Field_F &, const Field_F &, const int ieo)
void Mdageo(Field &, const Field &, const int ieo)
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 &)
Base class of fermion operator family.
Definition: fopr.h:49
int fetch_double(const string &key, double &val) const
Definition: parameters.cpp:124
string get_string(const string &key) const
Definition: parameters.cpp:87
void prePropDag(Field &, Field &, const Field &)
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:28
void gm5p(const int mu, Field &, const Field &v)
gamma_5 (1 - gamma_mu) v(x + mu) used in force calculation.
void MeoMoe(Field &, const Field &)
int fetch_int_vector(const string &key, std::vector< int > &val) const
Definition: parameters.cpp:176