Bridge++  Ver. 2.0.2
afopr_Domainwall.h
Go to the documentation of this file.
1 
9 #ifndef AFOPR_DOMAINWALL_INCLUDED
10 #define AFOPR_DOMAINWALL_INCLUDED
11 
12 #include <vector>
13 #include <string>
14 
15 #include "lib/Fopr/afopr.h"
17 #include "lib/IO/bridgeIO.h"
18 using Bridge::vout;
19 
20 class Field;
21 class Field_G;
22 
24 
37 template<typename AFIELD>
38 class AFopr_Domainwall : public AFopr<AFIELD>
39 {
40  public:
42  typedef typename AFIELD::real_t real_t;
43  static const std::string class_name;
44 
45  private:
46  // parameters common to overlap fermion
49  int m_Ns;
50  std::vector<int> m_boundary;
51  std::vector<real_t> m_b;
52  std::vector<real_t> m_c;
54  std::string m_repr;
55 
56  std::string m_mode;
57 
59 
61  std::string m_kernel_type;
63 
66 
67  // for convert and reverse
70 
71  // for preconditioning
72  std::vector<real_t> m_dp;
73  std::vector<real_t> m_dm;
74  std::vector<real_t> m_e;
75  std::vector<real_t> m_f;
77 
78  public:
80  AFopr_Domainwall(AFOPR *fopr) { init(fopr); }
81 
82  AFopr_Domainwall(const Parameters& params) { init(params); }
83 
85  AFopr_Domainwall(AFOPR *fopr, const Parameters& params)
86  { init(fopr, params); }
87 
90 
91  void set_parameters(const Parameters& params);
92 
94  void set_parameters(const real_t mq, const real_t M0,
95  const int Ns, const std::vector<int> bc,
96  const real_t b, const real_t c);
97 
99  void set_parameters(const real_t mq, const real_t M0,
100  const int Ns, const std::vector<int> bc,
101  const std::vector<real_t> vec_b,
102  const std::vector<real_t> vec_c);
103 
104  void get_parameters(Parameters& params) const;
105 
107  void set_kernel_parameters(const Parameters& params);
108 
110  void set_precond_parameters();
111 
113  void set_coefficients(const std::vector<real_t> b,
114  const std::vector<real_t> c);
115 
117  bool needs_convert() { return m_foprw->needs_convert(); }
118 
120  void convert(AFIELD&, const Field&);
121 
123  void reverse(Field&, const AFIELD&);
124 
125  void set_config(Field *U) { m_foprw->set_config(U); }
126 
127  void set_config(unique_ptr<Field_G>& U)
128  { m_foprw->set_config(U.get()); }
129 
130  void set_mode(std::string mode);
131 
132  std::string get_mode() const { return m_mode; }
133 
134  void mult(AFIELD& v, const AFIELD& w);
135 
136  void mult_dag(AFIELD& v, const AFIELD& w);
137 
141  void mult(AFIELD& v, const AFIELD& w, std::string mode);
142 
144  void mult_dag(AFIELD& v, const AFIELD& w, std::string mode);
145 
146  void mult_gm5(AFIELD&, const AFIELD&);
147 
148  void mult_chproj_4d(AFIELD&, const AFIELD&, const int ipm);
149 
150  int field_nin() { return m_NinF; }
151  int field_nvol() { return m_Nvol; }
152  int field_nex() { return m_Ns; }
153 
155  double flop_count() { return flop_count(m_mode); }
156 
158  double flop_count(std::string mode);
159 
160  void DdagD(AFIELD&, const AFIELD&);
161  void DDdag(AFIELD&, const AFIELD&);
162  void D(AFIELD&, const AFIELD&);
163  void Ddag(AFIELD&, const AFIELD&);
164  void H(AFIELD&, const AFIELD&);
165  void Hdag(AFIELD&, const AFIELD&);
166  void mult_gm5R(AFIELD&, const AFIELD&);
167  void mult_R(AFIELD&, const AFIELD&);
168 
169  // preconditioner
170  void DdagD_prec(AFIELD&, const AFIELD&);
171  void D_prec(AFIELD&, const AFIELD&);
172  void Ddag_prec(AFIELD&, const AFIELD&);
173  void Prec(AFIELD&, const AFIELD&);
174  void Precdag(AFIELD&, const AFIELD&);
175 
176  private:
177 
179  void init(const Parameters& params);
180 
181  void init(AFOPR *fopr, const Parameters& params);
182 
183  void init(AFOPR *fopr);
184 
186  void tidyup();
187 
188 
189  void L_inv(AFIELD&, const AFIELD&);
190  void U_inv(AFIELD&, const AFIELD&);
191  void Ldag_inv(AFIELD&, const AFIELD&);
192  void Udag_inv(AFIELD&, const AFIELD&);
193 
194  void mult_gm5_4d(AFIELD&, const AFIELD&);
195 
196 #ifdef USE_FACTORY
197  private:
198  static AFopr<AFIELD> *create_object_with_params(const Parameters& params)
199  { return new AFopr_Domainwall<AFIELD>(params); }
200 
201  static AFopr<AFIELD> *create_object(AFOPR *fopr)
202  { return new AFopr_Domainwall<AFIELD>(fopr); }
203 
204  static AFopr<AFIELD> *create_object_with_params2(AFOPR *fopr,
205  const Parameters& params)
206  { return new AFopr_Domainwall<AFIELD>(fopr, params); }
207 
208  public:
209  static bool register_factory()
210  {
211  bool init = true;
212  init &= AFOPR::Factory_params::Register(
213  "Domainwall", create_object_with_params);
214 
215  init &= AFOPR::Factory_fopr::Register(
216  "Domainwall", create_object);
217 
218  init &= AFOPR::Factory_fopr_params::Register(
219  "Domainwall", create_object_with_params2);
220 
221  return init;
222  }
223 #endif
224 };
225 
226 #endif
AFopr_Domainwall::Precdag
void Precdag(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:758
AFopr_Domainwall::m_dp
std::vector< real_t > m_dp
Definition: afopr_Domainwall.h:72
AFopr_Domainwall::m_v1
AFIELD m_v1
Definition: afopr_Domainwall.h:65
bridgeIO.h
AFopr_Domainwall::mult_gm5
void mult_gm5(AFIELD &, const AFIELD &)
multiplies gamma_5 matrix.
Definition: afopr_Domainwall-tmpl.h:642
AFopr_Domainwall::DDdag
void DDdag(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:705
AFopr_Domainwall::m_w4
AFIELD m_w4
Definition: afopr_Domainwall.h:64
AFopr_Domainwall::m_c
std::vector< real_t > m_c
coefficient c (array)
Definition: afopr_Domainwall.h:52
AFopr
Definition: afopr.h:48
AFopr_Domainwall::m_v4
AFIELD m_v4
Definition: afopr_Domainwall.h:64
AFopr_Domainwall::m_mode
std::string m_mode
Definition: afopr_Domainwall.h:56
AFopr_Domainwall::U_inv
void U_inv(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:938
AFopr_Domainwall::m_foprw
AFOPR * m_foprw
Definition: afopr_Domainwall.h:60
AFopr_Domainwall::AFopr_Domainwall
AFopr_Domainwall(const Parameters &params)
Definition: afopr_Domainwall.h:82
Parameters
Class for parameters.
Definition: parameters.h:46
AFopr_Domainwall::m_w1
AFIELD m_w1
Definition: afopr_Domainwall.h:65
AFopr_Domainwall::m_vl
Bridge::VerboseLevel m_vl
verbose level
Definition: afopr_Domainwall.h:53
AFopr_Domainwall::AFopr_Domainwall
AFopr_Domainwall(AFOPR *fopr, const Parameters &params)
constructor.
Definition: afopr_Domainwall.h:85
AFopr_Domainwall::m_repr
std::string m_repr
Definition: afopr_Domainwall.h:54
AFopr_Domainwall::m_Ndim
int m_Ndim
Definition: afopr_Domainwall.h:58
AFopr_Domainwall::Udag_inv
void Udag_inv(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:975
AFopr_Domainwall::DdagD
void DdagD(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:693
AFopr_Domainwall::reverse
void reverse(Field &, const AFIELD &)
reverse AField to Field.
Definition: afopr_Domainwall-tmpl.h:477
AFopr_Domainwall::needs_convert
bool needs_convert()
this class needs convert of fermion field.
Definition: afopr_Domainwall.h:117
AFopr_Domainwall::m_v4lex
AFIELD m_v4lex
Definition: afopr_Domainwall.h:69
AFopr_Domainwall::m_f
std::vector< real_t > m_f
Definition: afopr_Domainwall.h:75
AFopr_Domainwall::m_kernel_created
bool m_kernel_created
whether kernel is created in this object
Definition: afopr_Domainwall.h:62
AFopr_Domainwall::m_v2
AFIELD m_v2
working 5d vectors.
Definition: afopr_Domainwall.h:65
AFopr_Domainwall
Domain-wall fermion operator.
Definition: afopr_Domainwall.h:38
AFopr_Domainwall::m_t4
AFIELD m_t4
Definition: afopr_Domainwall.h:64
AFopr_Domainwall::set_config
void set_config(unique_ptr< Field_G > &U)
Definition: afopr_Domainwall.h:127
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
AFopr_Domainwall::tidyup
void tidyup()
final tidyup.
Definition: afopr_Domainwall-tmpl.h:195
AFopr_Domainwall::mult
void mult(AFIELD &v, const AFIELD &w)
multiplies fermion operator to a given field.
Definition: afopr_Domainwall-tmpl.h:513
AFopr_Domainwall::Prec
void Prec(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:749
AFopr_Domainwall::DdagD_prec
void DdagD_prec(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:717
AFopr_Domainwall::m_boundary
std::vector< int > m_boundary
boundary conditions
Definition: afopr_Domainwall.h:50
Field::real_t
double real_t
Definition: field.h:51
AFopr_Domainwall::Ddag_prec
void Ddag_prec(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:739
AFopr_Domainwall::flop_count
double flop_count()
this returns the number of floating point number operations.
Definition: afopr_Domainwall.h:155
AFopr::set_config
virtual void set_config(Field *)=0
sets the gauge configuration.
AFopr_Domainwall::set_kernel_parameters
void set_kernel_parameters(const Parameters &params)
set parameters of kernel operaotr.
Definition: afopr_Domainwall-tmpl.h:410
AFopr_Domainwall::AFOPR
AFopr< AFIELD > AFOPR
Definition: afopr_Domainwall.h:41
AFopr_Domainwall::convert
void convert(AFIELD &, const Field &)
convert Field to AField for this class.
Definition: afopr_Domainwall-tmpl.h:454
AFopr_Domainwall::m_M0
real_t m_M0
domain-wall height
Definition: afopr_Domainwall.h:48
AFopr::needs_convert
virtual bool needs_convert()
returns true if additional field conversion is needed.
Definition: afopr.h:174
AFopr_Domainwall::mult_gm5_4d
void mult_gm5_4d(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:685
AFopr_Domainwall::Ldag_inv
void Ldag_inv(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:1024
AFopr_Domainwall::get_parameters
void get_parameters(Parameters &params) const
gets parameters by a Parameter object: to be implemented in a subclass.
Definition: afopr_Domainwall-tmpl.h:252
AFopr_Domainwall::m_Ns
int m_Ns
size of fifth-dimension
Definition: afopr_Domainwall.h:49
AFopr_Domainwall::set_precond_parameters
void set_precond_parameters()
set parameters for preconditioning.
Definition: afopr_Domainwall-tmpl.h:427
AFopr_Domainwall::~AFopr_Domainwall
~AFopr_Domainwall()
destructor.
Definition: afopr_Domainwall.h:89
AFopr_Domainwall::m_kernel_type
std::string m_kernel_type
Definition: afopr_Domainwall.h:61
AFopr_Domainwall::m_dm
std::vector< real_t > m_dm
Definition: afopr_Domainwall.h:73
AFopr_Domainwall::D_prec
void D_prec(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:729
AFopr_Domainwall::field_nvol
int field_nvol()
returns the volume of the fermion field.
Definition: afopr_Domainwall.h:151
AFopr_Domainwall::class_name
static const std::string class_name
Definition: afopr_Domainwall.h:43
AFopr_Domainwall::field_nex
int field_nex()
returns the external degree of freedom of the fermion field.
Definition: afopr_Domainwall.h:152
AFopr_Domainwall::m_b
std::vector< real_t > m_b
coefficient b (array)
Definition: afopr_Domainwall.h:51
AFopr_Domainwall::field_nin
int field_nin()
returns the on-site degree of freedom of the fermion field.
Definition: afopr_Domainwall.h:150
AFopr_Domainwall::AFopr_Domainwall
AFopr_Domainwall(AFOPR *fopr)
constructor.
Definition: afopr_Domainwall.h:80
AFopr_Domainwall::set_coefficients
void set_coefficients(const std::vector< real_t > b, const std::vector< real_t > c)
set coefficients if they depend in s.
Definition: afopr_Domainwall-tmpl.h:385
AFopr_Domainwall::m_y4
AFIELD m_y4
working 4d vectors.
Definition: afopr_Domainwall.h:64
AFopr_Domainwall::m_g
real_t m_g
Definition: afopr_Domainwall.h:76
AFopr_Domainwall::set_config
void set_config(Field *U)
sets the gauge configuration.
Definition: afopr_Domainwall.h:125
AFopr_Domainwall::get_mode
std::string get_mode() const
returns the current mult mode.
Definition: afopr_Domainwall.h:132
AFopr_Domainwall::mult_dag
void mult_dag(AFIELD &v, const AFIELD &w)
hermitian conjugate of mult.
Definition: afopr_Domainwall-tmpl.h:544
AFopr_Domainwall::m_mq
real_t m_mq
quark mass
Definition: afopr_Domainwall.h:47
AFopr_Domainwall::m_NinF
int m_NinF
Definition: afopr_Domainwall.h:58
AFopr_Domainwall::set_parameters
void set_parameters(const Parameters &params)
sets parameters by a Parameter object: to be implemented in a subclass.
Definition: afopr_Domainwall-tmpl.h:203
commonParameters.h
AFopr_Domainwall::set_mode
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Definition: afopr_Domainwall-tmpl.h:500
AFopr_Domainwall::m_e
std::vector< real_t > m_e
Definition: afopr_Domainwall.h:74
AFopr_Domainwall::m_Nvol
int m_Nvol
Definition: afopr_Domainwall.h:58
Field
Container of Field-type object.
Definition: field.h:46
AFopr_Domainwall::Hdag
void Hdag(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:776
afopr.h
AFopr_Domainwall::mult_R
void mult_R(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:801
AFopr_Domainwall::m_w4lex
Field m_w4lex
Definition: afopr_Domainwall.h:68
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
Field_G
SU(N) gauge field.
Definition: field_G.h:38
AFopr_Domainwall::mult_gm5R
void mult_gm5R(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:785
AFopr_Domainwall::D
void D(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:818
AFopr_Domainwall::Ddag
void Ddag(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:859
AFopr_Domainwall::H
void H(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:767
AFopr_Domainwall::L_inv
void L_inv(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall-tmpl.h:897
AFopr_Domainwall::real_t
AFIELD::real_t real_t
Definition: afopr_Domainwall.h:42
AFopr_Domainwall::mult_chproj_4d
void mult_chproj_4d(AFIELD &, const AFIELD &, const int ipm)
Definition: afopr_Domainwall-tmpl.h:666
AFopr_Domainwall::init
void init(const Parameters &params)
initial setup.
Definition: afopr_Domainwall-tmpl.h:27
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512