Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_CloverGeneral.cpp
Go to the documentation of this file.
1 
14 #include "fopr_CloverGeneral.h"
15 
16 #ifdef USE_FACTORY_AUTOREGISTER
17 namespace {
18  bool init = Fopr_CloverGeneral::register_factory();
19 }
20 #endif
21 
22 const std::string Fopr_CloverGeneral::class_name = "Fopr_CloverGeneral";
23 
24 //====================================================================
25 void Fopr_CloverGeneral::init(const std::string repr)
26 {
31  m_NinF = 2 * m_Nc * m_Nd;
32 
33  m_boundary.resize(m_Ndim);
34 
35  m_U = 0;
36 
37  m_repr = repr;
38 
39  m_fopr_w = new Fopr_WilsonGeneral(repr);
41 
42  m_v1.reset(m_NinF, m_Nvol, 1);
43  m_v2.reset(m_NinF, m_Nvol, 1);
44 }
45 
46 
47 //====================================================================
49 {
50  delete m_fopr_w;
51  delete m_fopr_csw;
52 }
53 
54 
55 //====================================================================
57 {
58  const std::string str_vlevel = params.get_string("verbose_level");
59 
60  m_vl = vout.set_verbose_level(str_vlevel);
61 
62  //- fetch and check input parameters
63  double kappa_s, kappa_t;
64  double nu_s, r_s;
65  double cSW_s, cSW_t;
66  std::vector<int> bc;
67 
68  int err = 0;
69  err += params.fetch_double("hopping_parameter_spatial", kappa_s);
70  err += params.fetch_double("hopping_parameter_temporal", kappa_t);
71  err += params.fetch_double("dispersion_parameter_spatial", nu_s);
72  err += params.fetch_double("Wilson_parameter_spatial", r_s);
73  err += params.fetch_double("clover_coefficient_spatial", cSW_s);
74  err += params.fetch_double("clover_coefficient_temporal", cSW_t);
75 
76  err += params.fetch_int_vector("boundary_condition", bc);
77 
78  if (err) {
79  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
80  exit(EXIT_FAILURE);
81  }
82 
83  set_parameters(kappa_s, kappa_t, nu_s, r_s, cSW_s, cSW_t, bc);
84 }
85 
86 
87 //====================================================================
88 void Fopr_CloverGeneral::set_parameters(const double kappa_s, const double kappa_t,
89  const double nu_s, const double r_s,
90  const double cSW_s, const double cSW_t,
91  const std::vector<int> bc)
92 {
93  //- print input parameters
94  vout.general(m_vl, "%s:\n", class_name.c_str());
95  vout.general(m_vl, " kappa_s = %12.8f\n", kappa_s);
96  vout.general(m_vl, " kappa_t = %12.8f\n", kappa_t);
97  vout.general(m_vl, " nu_s = %12.8f\n", nu_s);
98  vout.general(m_vl, " r_s = %12.8f\n", r_s);
99  vout.general(m_vl, " cSW_s = %12.8f\n", cSW_s);
100  vout.general(m_vl, " cSW_t = %12.8f\n", cSW_t);
101  for (int mu = 0; mu < m_Ndim; ++mu) {
102  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
103  }
104 
105  //- range check
106  // NB. kappa,cSW == 0 is allowed.
107  assert(bc.size() == m_Ndim);
108 
109  //- store values
110  m_kappa_s = kappa_s;
111  m_kappa_t = kappa_t;
112  m_nu_s = nu_s;
113  m_r_s = r_s;
114  m_cSW_s = cSW_s;
115  m_cSW_t = cSW_t;
116 
117  // m_boundary.resize(m_Ndim); // NB. already resized in init.
118  m_boundary = bc;
119 
120  //- propagate parameters to components
123 }
124 
125 
126 //====================================================================
128 {
129  assert(f.nex() == 1);
130 
131  m_fopr_w->D(w, f);
133  axpy(w, -1.0, m_v1); // w -= m_v1;
134 
135 #pragma omp barrier
136 }
137 
138 
139 //====================================================================
141 {
142  mult_gm5(w, f);
143  D(m_v2, w);
144  mult_gm5(w, m_v2);
145 }
146 
147 
148 //====================================================================
150 {
151  D(m_v2, f);
152  mult_gm5(w, m_v2);
153  D(m_v2, w);
154  mult_gm5(w, m_v2);
155 }
156 
157 
158 //====================================================================
160 {
161  mult_gm5(m_v2, f);
162  D(w, m_v2);
163  mult_gm5(m_v2, w);
164  D(w, m_v2);
165 }
166 
167 
168 //====================================================================
170 {
171  D(m_v2, f);
172  mult_gm5(w, m_v2);
173 }
174 
175 
176 //====================================================================
178  const int mu, const int nu)
179 {
180  m_fopr_csw->mult_isigma(v, w, mu, nu);
181 }
182 
183 
184 //====================================================================
186 {
187  // Counting of floating point operations in giga unit.
188  // defined only for D, Dag, H, DDdag, DdagD which can be called
189  // from the solver algorithms.
190  // Since the flop_count() of Fopr_Wilson_eo defines flop of
191  // (1 - Meo*Moe), flop of clover term is twice added together with
192  // contribution of addition.
193 
194  const int Nvol = CommonParameters::Nvol();
195  const int NPE = CommonParameters::NPE();
196 
197  const double gflop_w = 2 * m_fopr_w->flop_count();
198 
199  double gflop_csw = m_fopr_csw->flop_count();
200 
201  gflop_csw += 2 * m_Nc * m_Nd / Nvol / NPE / 1.0e+9;
202 
203  double gflop = gflop_w + gflop_csw;
204 
205  // Additional twice mult of clover term
206  if ((m_mode == "DdagD") || (m_mode == "DDdag")) gflop += gflop_csw;
207 
208  return gflop;
209 }
210 
211 
212 //====================================================================
213 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:503
Org::Fopr_CloverTerm_General Fopr_CloverTerm_General
std::string m_repr
gamma matrix representation
void general(const char *format,...)
Definition: bridgeIO.cpp:197
double m_r_s
spatial Wilson parameter
void H(Field &, const Field &)
std::vector< int > m_boundary
boundary conditions
std::string m_mode
mode of multiplication
Container of Field-type object.
Definition: field.h:45
void set_parameters(const Parameters &params)
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
double m_cSW_s
spatial clover coefficient
void D(Field &, const Field &)
static const std::string class_name
double m_kappa_t
temporal hopping parameter
void Ddag(Field &, const Field &)
double m_kappa_s
spatial hopping parameter
Class for parameters.
Definition: parameters.h:46
double m_cSW_t
temporal clover coefficient
Fopr_CloverTerm_General * m_fopr_csw
Clover term operator.
void set_parameters(const Parameters &params)
Wilson-type fermion field.
Definition: field_F.h:37
double flop_count()
this returns the number of floating point operations.
void init(const std::string repr)
Field m_v2
working field.
Bridge::VerboseLevel m_vl
Definition: fopr.h:127
void mult_isigma(Field_F &, const Field_F &, const int mu, const int nu)
void mult_sigmaF(Field &, const Field &)
double flop_count()
this returns the number of floating point operations.
Fopr_WilsonGeneral * m_fopr_w
Wilson fermion kernel.
double m_nu_s
spatial anisotopy parameter
int nex() const
Definition: field.h:128
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
Definition: field.h:95
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:319
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void set_parameters(const Parameters &params)
void mult_isigma(Field_F &, const Field_F &, const int mu, const int nu)
void DDdag(Field &, const Field &)
double flop_count()
this returns the number of floating point operations.
void DdagD(Field &, const Field &)
void D(Field &v, const Field &f)
string get_string(const string &key) const
Definition: parameters.cpp:221
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:429
Org::Fopr_WilsonGeneral Fopr_WilsonGeneral
const Field_G * m_U
gauge configuration (pointer)
int m_NinF
internal parameters
void mult_gm5(Field &v, const Field &w)
gamma_5 multiplication. [31 Mar 2017 H.Matsufuru]
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131