Bridge++  Ver. 2.0.2
afopr_Domainwall_5din.h
Go to the documentation of this file.
1 
10 #ifndef QXS_AFOPR_DOMAINWALL_5DIN_INCLUDED
11 #define QXS_AFOPR_DOMAINWALL_5DIN_INCLUDED
12 
13 #include <vector>
14 #include <string>
15 
16 #include "lib/Fopr/afopr.h"
19 #include "lib/IO/bridgeIO.h"
20 using Bridge::vout;
21 
24 
25 
26 class Field;
27 class Field_G;
28 
30 
34 template<typename AFIELD>
35 class AFopr_Domainwall_5din : public AFopr<AFIELD>
36 {
37  public:
38  typedef typename AFIELD::real_t real_t;
39  static const std::string class_name;
40 
41  private:
42  // parameters common to overlap fermion
45  int m_Ns;
46  std::vector<int> m_boundary;
47  std::vector<real_t> m_b;
48  std::vector<real_t> m_c;
49  std::string m_repr;
50 
51  std::string m_mode;
52 
54 
55  int m_Nx, m_Ny, m_Nz, m_Nt;
56  int m_Nvol, m_Ndim;
59 
61 
64 
65  // for preconditioning
66  std::vector<real_t> m_dp;
67  std::vector<real_t> m_dpinv;
68  std::vector<real_t> m_dm;
69  std::vector<real_t> m_e;
70  std::vector<real_t> m_f;
72 
73  int m_Nsize[4]; // lattice sizes in units of SIMD variable
74 
75  int do_comm[4];
77 
78  std::vector<int> m_Nbdsize;
79  using allocator_t = typename AFIELD::template aligned_allocator<char>;
81  std::vector<Channel> chsend_up, chrecv_up, chsend_dn, chrecv_dn;
83 
84  public:
86  : AFopr<AFIELD>()
87  {
89  init(params);
90  }
91 
93 
94  void set_parameters(const Parameters& params);
95 
97  void set_parameters(const double mq, const double M0,
98  const int Ns, const std::vector<int> bc,
99  const double b, const double c);
100 
102  void set_precond_parameters();
103 
105  void set_coefficients(const std::vector<double> b,
106  const std::vector<double> c);
107 
109  bool needs_convert() { return true; }
110 
112  void convert(AFIELD&, const Field&);
113 
115  void reverse(Field&, const AFIELD&);
116 
118  void set_config(Field *U);
119 
120  // void set_boundary_config(AFIELD& U, const int mu);
121 
122  void set_mode(std::string mode);
123 
124  std::string get_mode() const { return m_mode; }
125 
126  void mult(AFIELD& v, const AFIELD& w)
127  { mult(v, w, m_mode); }
128 
129  void mult_dag(AFIELD& v, const AFIELD& w)
130  { mult_dag(v, w, m_mode); }
131 
134  void mult(AFIELD& v, const AFIELD& w, std::string mode);
135 
137  void mult_dag(AFIELD& v, const AFIELD& w, std::string mode);
138 
140  void mult_gm5(AFIELD& v, const AFIELD& w);
141 
142  void DdagD(AFIELD&, const AFIELD&);
143  void D(AFIELD&, const AFIELD&);
144  void Ddag(AFIELD&, const AFIELD&);
145 
146  void mult_D(AFIELD&, const AFIELD&);
147  void mult_Ddag(AFIELD&, const AFIELD&);
148 
149  // preconditioner
150  void DdagD_prec(AFIELD&, const AFIELD&);
151  void D_prec(AFIELD&, const AFIELD&);
152  void Ddag_prec(AFIELD&, const AFIELD&);
153  void Prec(AFIELD&, const AFIELD&);
154  void Precdag(AFIELD&, const AFIELD&);
155 
156  void L_inv(AFIELD&, const AFIELD&);
157  void U_inv(AFIELD&, const AFIELD&);
158  void Ldag_inv(AFIELD&, const AFIELD&);
159  void Udag_inv(AFIELD&, const AFIELD&);
160 
161  int field_nin() { return m_NinF; }
162  int field_nvol() { return m_Nvol; }
163  int field_nex() { return 1; }
164 
166  double flop_count() { return flop_count(m_mode); }
167 
169  double flop_count(std::string mode);
170 
171  private:
173  void init(const Parameters& params);
174 
176  void tidyup();
177 
179  void setup_channels();
180 
182  void set_config_omp(Field *u);
183 
185  void set_config_impl(Field *u);
186 
188  void Dhop(real_t *, real_t *);
189 
190  void Dhop_1(real_t *, real_t *);
191 
192  void Dhop_2(real_t *, real_t *);
193 
194  void Dhop_b(real_t *, real_t *);
195 
196 #ifdef USE_FACTORY
197  private:
198  static AFopr<AFIELD> *create_object_with_params(const Parameters& params)
199  { return new AFopr_Domainwall_5din(params); }
200 
201  public:
202  static bool register_factory()
203  {
205  "Domainwall_5din", create_object_with_params);
207  "Domainwall_General_5din", create_object_with_params);
208  return init1;
209  }
210 #endif
211 };
212 
213 // for transition of the class name
214 template<class AFIELD>
216 
217 #endif
AFopr_Domainwall_5din::m_w4
AFIELD m_w4
Definition: afopr_Domainwall_5din.h:62
AFopr_Domainwall_5din::set_coefficients
void set_coefficients(const std::vector< double > b, const std::vector< double > c)
set coefficients if they depend in s.
Definition: afopr_Domainwall_5din-tmpl.h:301
bridgeIO.h
AFopr_Domainwall_5din::Ldag_inv
void Ldag_inv(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:821
AFopr_Domainwall_5din::m_v2
AFIELD m_v2
working 5d vectors.
Definition: afopr_Domainwall_5din.h:63
AFopr_Domainwall_5din::m_U
AFIELD m_U
Definition: afopr_Domainwall_5din.h:60
AFopr_Domainwall_5din::m_Nstv
int m_Nstv
Definition: afopr_Domainwall_5din.h:58
AFopr
Definition: afopr.h:48
AFopr_Domainwall_5din::m_c
std::vector< real_t > m_c
Definition: afopr_Domainwall_5din.h:48
AFopr_Domainwall_5din::mult
void mult(AFIELD &v, const AFIELD &w)
multiplies fermion operator to a given field.
Definition: afopr_Domainwall_5din.h:126
AFopr_Domainwall_5din::Precdag
void Precdag(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:609
AFopr_Domainwall_5din::m_g
real_t m_g
Definition: afopr_Domainwall_5din.h:71
AFopr_Domainwall_5din::mult_Ddag
void mult_Ddag(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:715
AFopr_Domainwall_5din::m_M0
real_t m_M0
domain-wall height
Definition: afopr_Domainwall_5din.h:44
AFopr_Domainwall_5din::mult_dag
void mult_dag(AFIELD &v, const AFIELD &w)
hermitian conjugate of mult.
Definition: afopr_Domainwall_5din.h:129
communicator_impl.h
Parameters
Class for parameters.
Definition: parameters.h:46
AFopr_Domainwall_5din::m_Ns
int m_Ns
size of fifth-dimension
Definition: afopr_Domainwall_5din.h:45
AFopr_Domainwall_5din::m_mq
real_t m_mq
quark mass
Definition: afopr_Domainwall_5din.h:43
AFopr_Domainwall_5din::Ddag
void Ddag(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:628
AFopr_Domainwall_5din::set_config_omp
void set_config_omp(Field *u)
setting gauge configuration (setting omp parallel).
Definition: afopr_Domainwall_5din-tmpl.h:356
AFopr_Domainwall_5din::m_Nx
int m_Nx
Definition: afopr_Domainwall_5din.h:55
ChannelSet
ChannelSet class for a collection of channels.
Definition: channel.h:148
AFopr_Domainwall_5din::class_name
static const std::string class_name
Definition: afopr_Domainwall_5din.h:39
AFopr_Domainwall_5din::do_comm
int do_comm[4]
communication switch (4=Ndim): (0: n, 1: y).
Definition: afopr_Domainwall_5din.h:75
AFopr_Domainwall_5din::get_mode
std::string get_mode() const
returns the current mult mode.
Definition: afopr_Domainwall_5din.h:124
AFopr_Domainwall_5din::field_nin
int field_nin()
returns the on-site degree of freedom of the fermion field.
Definition: afopr_Domainwall_5din.h:161
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
AFopr_Domainwall_5din::D
void D(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:620
AFopr_Domainwall_5din::m_t4
AFIELD m_t4
Definition: afopr_Domainwall_5din.h:62
AFopr_Domainwall_5din::setup_channels
void setup_channels()
setup channels for communication.
Definition: afopr_Domainwall_5din-tmpl.h:126
AFopr_Domainwall_5din::m_Nyv
int m_Nyv
Definition: afopr_Domainwall_5din.h:58
AFopr_Domainwall_5din::m_boundary
std::vector< int > m_boundary
boundary conditions
Definition: afopr_Domainwall_5din.h:46
AFopr_Domainwall_5din::D_prec
void D_prec(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:575
AFopr_Domainwall_5din::convert
void convert(AFIELD &, const Field &)
convert Field to AField for this class.
Definition: afopr_Domainwall_5din-tmpl.h:384
AFopr_Domainwall_5din::field_nex
int field_nex()
returns the external degree of freedom of the fermion field.
Definition: afopr_Domainwall_5din.h:163
AFopr_Domainwall_5din::m_Nz
int m_Nz
Definition: afopr_Domainwall_5din.h:55
AFopr_Domainwall_5din::mult_D
void mult_D(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:636
Field::real_t
double real_t
Definition: field.h:51
AFopr_Domainwall_5din::Dhop_b
void Dhop_b(real_t *, real_t *)
AFopr_Domainwall_5din::Dhop_1
void Dhop_1(real_t *, real_t *)
AFopr_Domainwall_5din::Ddag_prec
void Ddag_prec(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:587
AFopr_Domainwall_5din::chrecv_dn
std::vector< Channel > chrecv_dn
Definition: afopr_Domainwall_5din.h:81
AFopr_Domainwall_5din::set_config_impl
void set_config_impl(Field *u)
setting gauge configuration (implementation).
Definition: afopr_Domainwall_5din-tmpl.h:369
AFopr_Domainwall_5din::m_Nvol
int m_Nvol
Definition: afopr_Domainwall_5din.h:56
AFopr_Domainwall_5din::m_dp
std::vector< real_t > m_dp
Definition: afopr_Domainwall_5din.h:66
AFopr_Domainwall_5din
Optimal Domain-wall fermion operator.
Definition: afopr_Domainwall_5din.h:35
AFopr_Domainwall_5din::chset_recv
ChannelSet chset_recv
Definition: afopr_Domainwall_5din.h:82
AFopr_Domainwall_5din::set_precond_parameters
void set_precond_parameters()
set parameters for preconditioning.
Definition: afopr_Domainwall_5din-tmpl.h:261
AFopr_Domainwall_5din::L_inv
void L_inv(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:795
AFopr_Domainwall_5din::m_v1
AFIELD m_v1
Definition: afopr_Domainwall_5din.h:63
AFopr_Domainwall_5din::m_Nsize
int m_Nsize[4]
Definition: afopr_Domainwall_5din.h:73
AFopr_Domainwall_5din::m_Ny
int m_Ny
Definition: afopr_Domainwall_5din.h:55
AFopr_Domainwall_5din::~AFopr_Domainwall_5din
~AFopr_Domainwall_5din()
Definition: afopr_Domainwall_5din.h:92
AFopr_Domainwall_5din::m_mode
std::string m_mode
Definition: afopr_Domainwall_5din.h:51
AFopr_Domainwall_5din::needs_convert
bool needs_convert()
this class needs convert of fermion field.
Definition: afopr_Domainwall_5din.h:109
AFopr_Domainwall_5din::Prec
void Prec(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:598
AFopr_Domainwall_5din::m_b
std::vector< real_t > m_b
Definition: afopr_Domainwall_5din.h:47
AFopr_Domainwall_5din::real_t
AFIELD::real_t real_t
Definition: afopr_Domainwall_5din.h:38
AFopr_Domainwall_5din::Dhop_2
void Dhop_2(real_t *, real_t *)
AFopr_Domainwall_5din::m_dpinv
std::vector< real_t > m_dpinv
Definition: afopr_Domainwall_5din.h:67
AFopr_Domainwall_5din::m_w1
AFIELD m_w1
Definition: afopr_Domainwall_5din.h:63
parameters.h
AFopr_Domainwall_5din::m_y4
AFIELD m_y4
working 4d vectors.
Definition: afopr_Domainwall_5din.h:62
AFopr_Domainwall_5din::DdagD
void DdagD(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:556
AFopr_Domainwall_5din::DdagD_prec
void DdagD_prec(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:565
AFopr_Domainwall_5din::chsend_dn
std::vector< Channel > chsend_dn
Definition: afopr_Domainwall_5din.h:81
AFopr_Domainwall_5din::m_Nbdsize
std::vector< int > m_Nbdsize
Definition: afopr_Domainwall_5din.h:78
AFopr_Domainwall_5din::chrecv_up
std::vector< Channel > chrecv_up
Definition: afopr_Domainwall_5din.h:81
AFopr_Domainwall_5din::reverse
void reverse(Field &, const AFIELD &)
reverse AField to Field.
Definition: afopr_Domainwall_5din-tmpl.h:424
AFopr_Domainwall_5din::tidyup
void tidyup()
final tidyup.
Definition: afopr_Domainwall_5din-tmpl.h:118
CommonParameters::Vlevel
static Bridge::VerboseLevel Vlevel()
Definition: commonParameters.h:122
AFopr_Domainwall_5din::U_inv
void U_inv(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:808
AFopr_Domainwall_5din::m_f
std::vector< real_t > m_f
Definition: afopr_Domainwall_5din.h:70
AFopr_Domainwall_5din::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_5din-tmpl.h:464
AFopr_Domainwall_5din::field_nvol
int field_nvol()
returns the volume of the fermion field.
Definition: afopr_Domainwall_5din.h:162
AFopr_Domainwall_5din::mult_gm5
void mult_gm5(AFIELD &v, const AFIELD &w)
mult_dag with specified mode.
Definition: afopr_Domainwall_5din-tmpl.h:541
AFopr_Domainwall_5din::m_NinF
int m_NinF
Definition: afopr_Domainwall_5din.h:57
AFopr_Domainwall_5din::Udag_inv
void Udag_inv(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:835
AFopr_Domainwall_5din::m_Nt
int m_Nt
Definition: afopr_Domainwall_5din.h:55
AFopr_Domainwall_5din::m_Ndf
int m_Ndf
Definition: afopr_Domainwall_5din.h:57
AFopr_Domainwall_5din::m_e
std::vector< real_t > m_e
Definition: afopr_Domainwall_5din.h:69
AFopr_Domainwall_5din::m_Ndim
int m_Ndim
Definition: afopr_Domainwall_5din.h:56
AFopr_Domainwall_5din::m_Nvcd
int m_Nvcd
Definition: afopr_Domainwall_5din.h:57
AFopr_Domainwall_5din::flop_count
double flop_count()
this returns the number of floating point number operations.
Definition: afopr_Domainwall_5din.h:166
AFopr_Domainwall_5din::m_vl
Bridge::VerboseLevel m_vl
verbose level
Definition: afopr_Domainwall_5din.h:53
commonParameters.h
AFopr_Domainwall_5din::init
void init(const Parameters &params)
initial setup.
Definition: afopr_Domainwall_5din-tmpl.h:15
AFopr_Domainwall_5din::m_Nxv
int m_Nxv
Definition: afopr_Domainwall_5din.h:58
AFopr_Domainwall_5din::set_parameters
void set_parameters(const Parameters &params)
sets parameters by a Parameter object: to be implemented in a subclass.
Definition: afopr_Domainwall_5din-tmpl.h:160
Field
Container of Field-type object.
Definition: field.h:46
afopr.h
AFopr_Domainwall_5din::m_v4
AFIELD m_v4
Definition: afopr_Domainwall_5din.h:62
AFopr_Domainwall_5din::AFopr_Domainwall_5din
AFopr_Domainwall_5din(const Parameters &params)
Definition: afopr_Domainwall_5din.h:85
AFopr_Domainwall_5din::chset_send
ChannelSet chset_send
Definition: afopr_Domainwall_5din.h:82
communicator.h
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
Field_G
SU(N) gauge field.
Definition: field_G.h:38
AFopr_Domainwall_5din::do_comm_any
int do_comm_any
communication switch (if any): (0: n, 1: y).
Definition: afopr_Domainwall_5din.h:76
AFopr_Domainwall_5din::allocator_t
typename AFIELD::template aligned_allocator< char > allocator_t
Definition: afopr_Domainwall_5din.h:79
AFopr_Domainwall_5din::m_dm
std::vector< real_t > m_dm
Definition: afopr_Domainwall_5din.h:68
AFopr_Domainwall_5din::Dhop
void Dhop(real_t *, real_t *)
hopping part of fermion operator.
AFopr_Domainwall_5din::chsend_up
std::vector< Channel > chsend_up
Definition: afopr_Domainwall_5din.h:81
AFopr_Domainwall_5din::m_repr
std::string m_repr
gamma matrix representation
Definition: afopr_Domainwall_5din.h:49
Channel_impl
Definition: channel.h:86
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
AFopr_Domainwall_5din::set_config
void set_config(Field *U)
setting gauge configuration (common interface).
Definition: afopr_Domainwall_5din-tmpl.h:337