Bridge++  Ver.2.1.3
afopr_Domainwall_5din.h
Go to the documentation of this file.
1 
9 #ifndef ACCEL_AFOPR_DOMAINWALL_5DIN_INCLUDED
10 #define ACCEL_AFOPR_DOMAINWALL_5DIN_INCLUDED
11 
12 #include <vector>
13 #include <string>
14 
15 #include "lib/Fopr/afopr.h"
19 #include "lib/IO/bridgeIO.h"
20 using Bridge::vout;
21 
22 class Field;
23 class Field_G;
24 
26 
41 template<typename AFIELD>
42 class AFopr_Domainwall_5din : public AFopr<AFIELD>
43 {
44  public:
45  typedef typename AFIELD::real_t real_t;
46  static const std::string class_name;
47 
48  private:
49  // parameters common to overlap fermion
52  int m_Ns;
53  std::vector<int> m_boundary;
54  std::vector<real_t> m_b;
55  std::vector<real_t> m_c;
58  std::string m_kernel_type;
59  std::string m_repr;
60  std::string m_impl;
61 
62  int m_Nx, m_Ny, m_Nz, m_Nt;
63  int m_Nvol, m_Ndim;
65 
66  // for preconditioning
67  std::vector<real_t> m_dp;
68  std::vector<real_t> m_dpinv;
69  std::vector<real_t> m_dm;
70  std::vector<real_t> m_e;
71  std::vector<real_t> m_f;
73 
74  int m_Nsize[4]; // lattice sizes in units of SIMD variable
75  int m_bc[4];
76  int m_bc2[4];
77 
78  int do_comm[4];
80 
81  std::vector<int> m_Nbdsize;
83  std::vector<Channel> chsend_up, chrecv_up, chsend_dn, chrecv_dn;
85 
86  std::string m_mode;
87 
89 
90  // AFIELD m_w4, m_v4, m_t4, m_y4; //!< working 4d vectors.
92 
93  // for convert and reverse
96 
97 
98  public:
101  { init(params); }
102 
105 
106  void set_parameters(const Parameters& params);
107 
109  void set_parameters(const real_t mq, const real_t M0,
110  const int Ns, const std::vector<int> bc,
111  const real_t b, const real_t c,
112  const real_t alpha);
113 
114  /*
116  void set_parameters(const real_t mq, const real_t M0,
117  const int Ns, const std::vector<int> bc,
118  const std::vector<real_t> vec_b,
119  const std::vector<real_t> vec_c,
120  const real_t alpha);
121  */
122 
123  void get_parameters(Parameters& params) const;
124 
125  void setup_channels();
126 
128  void set_precond_parameters();
129 
131  void set_coefficients(const std::vector<real_t> b,
132  const std::vector<real_t> c);
133 
135  bool needs_convert() { return true; }
136 
138  void convert(AFIELD&, const Field&);
139 
141  void reverse(Field&, const AFIELD&);
142 
143  void set_config(Field *U);
144 
145  void set_config_omp(Field *U);
146 
147  void set_config_impl(Field *U);
148 
149  void set_mode(std::string mode);
150 
151  std::string get_mode() const { return m_mode; }
152 
153  void mult(AFIELD& v, const AFIELD& w);
154 
155  void mult_dag(AFIELD& v, const AFIELD& w);
156 
160  void mult(AFIELD& v, const AFIELD& w, std::string mode);
161 
163  void mult_dag(AFIELD& v, const AFIELD& w, std::string mode);
164 
165  void mult_gm5(AFIELD&, const AFIELD&);
166 
167  void mult_chproj_4d(AFIELD&, const AFIELD&, const int ipm);
168 
169  int field_nin() { return m_NinF; }
170  int field_nvol() { return m_Nvol; }
171  int field_nex() { return 1; }
172 
174  double flop_count() { return flop_count(m_mode); }
175 
177  double flop_count(std::string mode);
178 
179  void DdagD(AFIELD&, const AFIELD&);
180  void DDdag(AFIELD&, const AFIELD&);
181  void D(AFIELD&, const AFIELD&);
182  void Ddag(AFIELD&, const AFIELD&);
183  void H(AFIELD&, const AFIELD&);
184  void Hdag(AFIELD&, const AFIELD&);
185  void mult_gm5R(AFIELD&, const AFIELD&);
186  void mult_R(AFIELD&, const AFIELD&);
187 
188  // preconditioner
189  void DdagD_prec(AFIELD&, const AFIELD&);
190  void D_prec(AFIELD&, const AFIELD&);
191  void Ddag_prec(AFIELD&, const AFIELD&);
192  void Prec(AFIELD&, const AFIELD&);
193  void Precdag(AFIELD&, const AFIELD&);
194 
195  private:
196 
198  void init(const Parameters& params);
199 
201  void tidyup();
202 
203  void LU_inv(AFIELD&, const AFIELD&);
204  void LUdag_inv(AFIELD&, const AFIELD&);
205 
206  void mult_gm5_4d(AFIELD&, const AFIELD&);
207 
208 #ifdef USE_FACTORY
209  private:
210  static AFopr<AFIELD> *create_object_with_params(const Parameters& params)
211  { return new AFopr_Domainwall_5din(params); }
212 
213  public:
214  static bool register_factory()
215  {
216  bool init = true;
218  "Domainwall_5din", create_object_with_params);
219  return init;
220  }
221 #endif
222 };
223 
224 #endif
AFopr_Domainwall_5din::m_b
std::vector< real_t > m_b
coefficient b (array)
Definition: afopr_Domainwall_5din.h:54
bridgeIO.h
AFopr_Domainwall_5din::m_e
std::vector< real_t > m_e
Definition: afopr_Domainwall_5din.h:70
AFopr_Domainwall_5din::mult_gm5_4d
void mult_gm5_4d(AFIELD &, const AFIELD &)
AFopr_Domainwall_5din::m_kernel_type
std::string m_kernel_type
fermion kernel type
Definition: afopr_Domainwall_5din.h:58
AFopr_Domainwall_5din::m_v2
AFIELD m_v2
working 5d vectors.
Definition: afopr_Domainwall_5din.h:91
AFopr_Domainwall_5din::m_U
AFIELD m_U
Definition: afopr_Domainwall_5din.h:88
AFopr
Definition: afopr.h:48
AFopr_Domainwall_5din::mult
void mult(AFIELD &v, const AFIELD &w)
multiplies fermion operator to a given field.
Definition: afopr_Domainwall_5din-tmpl.h:536
AFopr_Domainwall_5din::Precdag
void Precdag(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:747
AFopr_Domainwall_5din::m_g
real_t m_g
Definition: afopr_Domainwall_5din.h:72
AFopr_Domainwall_5din::chsend_up
std::vector< Channel > chsend_up
Definition: afopr_Domainwall_5din.h:83
AFopr_Domainwall_5din::m_M0
real_t m_M0
domain-wall height
Definition: afopr_Domainwall_5din.h:51
AFopr_Domainwall_5din::get_parameters
void get_parameters(Parameters &params) const
gets parameters by a Parameter object: to be implemented in a subclass.
Definition: afopr_Domainwall_5din-tmpl.h:259
AFopr_Domainwall_5din::mult_dag
void mult_dag(AFIELD &v, const AFIELD &w)
hermitian conjugate of mult.
Definition: afopr_Domainwall_5din-tmpl.h:567
communicator_impl.h
Parameters
Class for parameters.
Definition: parameters.h:46
AFopr_Domainwall_5din::H
void H(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:755
AFopr_Domainwall_5din::m_Ns
int m_Ns
size of fifth-dimension
Definition: afopr_Domainwall_5din.h:52
AFopr_Domainwall_5din::m_mq
real_t m_mq
quark mass
Definition: afopr_Domainwall_5din.h:50
AFopr_Domainwall_5din::Ddag
void Ddag(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:904
AFopr_Domainwall_5din::mult_gm5R
void mult_gm5R(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:773
AFopr_Domainwall_5din::set_config_omp
void set_config_omp(Field *U)
Definition: afopr_Domainwall_5din-tmpl.h:445
AFopr_Domainwall_5din::Hdag
void Hdag(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:764
AFopr_Domainwall_5din::m_Nx
int m_Nx
Definition: afopr_Domainwall_5din.h:62
ChannelSet
ChannelSet class for a collection of channels.
Definition: channel.h:148
AFopr_Domainwall_5din::m_w4lex
Field m_w4lex
Definition: afopr_Domainwall_5din.h:94
AFopr_Domainwall_5din::chrecv_dn
std::vector< Channel > chrecv_dn
Definition: afopr_Domainwall_5din.h:83
AFopr_Domainwall_5din::mult_chproj_4d
void mult_chproj_4d(AFIELD &, const AFIELD &, const int ipm)
AFopr_Domainwall_5din::get_mode
std::string get_mode() const
returns the current mult mode.
Definition: afopr_Domainwall_5din.h:151
AFopr_Domainwall_5din::chrecv_up
std::vector< Channel > chrecv_up
Definition: afopr_Domainwall_5din.h:83
AFopr_Domainwall_5din::field_nin
int field_nin()
returns the on-site degree of freedom of the fermion field.
Definition: afopr_Domainwall_5din.h:169
AFopr_Domainwall_5din::D
void D(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:813
AFopr_Domainwall_5din::setup_channels
void setup_channels()
Definition: afopr_Domainwall_5din-tmpl.h:146
AFopr_Domainwall_5din::D_prec
void D_prec(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:721
AFopr_Domainwall_5din::convert
void convert(AFIELD &, const Field &)
convert Field to AField for this class.
Definition: afopr_Domainwall_5din-tmpl.h:471
AFopr_Domainwall_5din::field_nex
int field_nex()
returns the external degree of freedom of the fermion field.
Definition: afopr_Domainwall_5din.h:171
AFopr_Domainwall_5din::m_Nz
int m_Nz
Definition: afopr_Domainwall_5din.h:62
AFopr_Domainwall_5din::do_comm
int do_comm[4]
communication switch (4=Ndim): (0: n, 1: y)
Definition: afopr_Domainwall_5din.h:78
Field::real_t
double real_t
Definition: field.h:51
AFopr_Domainwall_5din::m_Nbdsize
std::vector< int > m_Nbdsize
Definition: afopr_Domainwall_5din.h:81
AFopr_Domainwall_5din::m_boundary
std::vector< int > m_boundary
boundary conditions
Definition: afopr_Domainwall_5din.h:53
AFopr_Domainwall_5din::Ddag_prec
void Ddag_prec(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:730
AFopr_Domainwall_5din::m_v4lex
AFIELD m_v4lex
Definition: afopr_Domainwall_5din.h:95
AFopr_Domainwall_5din::m_Nvol
int m_Nvol
Definition: afopr_Domainwall_5din.h:63
AFopr_Domainwall_5din
Domain-wall fermion operator.
Definition: afopr_Domainwall_5din.h:42
AFopr_Domainwall_5din::chset_recv
ChannelSet chset_recv
Definition: afopr_Domainwall_5din.h:84
AFopr_Domainwall_5din::set_precond_parameters
void set_precond_parameters()
set parameters for preconditioning.
Definition: afopr_Domainwall_5din-tmpl.h:385
AFopr_Domainwall_5din::m_f
std::vector< real_t > m_f
Definition: afopr_Domainwall_5din.h:71
AFopr_Domainwall_5din::m_v1
AFIELD m_v1
Definition: afopr_Domainwall_5din.h:91
AFopr_Domainwall_5din::m_Ny
int m_Ny
Definition: afopr_Domainwall_5din.h:62
AFopr_Domainwall_5din::m_bc2
int m_bc2[4]
Definition: afopr_Domainwall_5din.h:76
AFopr_Domainwall_5din::~AFopr_Domainwall_5din
~AFopr_Domainwall_5din()
destructor.
Definition: afopr_Domainwall_5din.h:104
AFopr_Domainwall_5din::m_mode
std::string m_mode
Definition: afopr_Domainwall_5din.h:86
AFopr_Domainwall_5din::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_5din-tmpl.h:357
AFopr_Domainwall_5din::needs_convert
bool needs_convert()
this class needs convert of fermion field.
Definition: afopr_Domainwall_5din.h:135
AFopr_Domainwall_5din::mult_gm5
void mult_gm5(AFIELD &, const AFIELD &)
multiplies gamma_5 matrix.
Definition: afopr_Domainwall_5din-tmpl.h:665
AFopr_Domainwall_5din::m_Nsize
int m_Nsize[4]
Definition: afopr_Domainwall_5din.h:74
AFopr_Domainwall_5din::m_dp
std::vector< real_t > m_dp
Definition: afopr_Domainwall_5din.h:67
AFopr_Domainwall_5din::Prec
void Prec(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:739
AFopr_Domainwall_5din::m_bc
int m_bc[4]
Definition: afopr_Domainwall_5din.h:75
AFopr_Domainwall_5din::mult_R
void mult_R(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:792
AFopr_Domainwall_5din::real_t
AFIELD::real_t real_t
Definition: afopr_Domainwall_5din.h:45
AFopr_Domainwall_5din::m_dm
std::vector< real_t > m_dm
Definition: afopr_Domainwall_5din.h:69
AFopr_Domainwall_5din::m_c
std::vector< real_t > m_c
coefficient c (array)
Definition: afopr_Domainwall_5din.h:55
AFopr_Domainwall_5din::m_alpha
real_t m_alpha
parameter alpha
Definition: afopr_Domainwall_5din.h:56
AFopr_Domainwall_5din::m_w1
AFIELD m_w1
Definition: afopr_Domainwall_5din.h:91
AFopr_Domainwall_5din::DdagD
void DdagD(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:683
AFopr_Domainwall_5din::DdagD_prec
void DdagD_prec(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:707
real_t
double real_t
Definition: bridgeACC_AField_double.cpp:14
AFopr_Domainwall_5din::reverse
void reverse(Field &, const AFIELD &)
reverse AField to Field.
Definition: afopr_Domainwall_5din-tmpl.h:496
AFopr_Domainwall_5din::tidyup
void tidyup()
final tidyup.
Definition: afopr_Domainwall_5din-tmpl.h:117
AFopr_Domainwall_5din::m_dpinv
std::vector< real_t > m_dpinv
Definition: afopr_Domainwall_5din.h:68
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:523
AFopr_Domainwall_5din::field_nvol
int field_nvol()
returns the volume of the fermion field.
Definition: afopr_Domainwall_5din.h:170
AFopr_Domainwall_5din::m_NinF
int m_NinF
Definition: afopr_Domainwall_5din.h:64
AFopr_Domainwall_5din::LU_inv
void LU_inv(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:1002
AFopr_Domainwall_5din::m_Nt
int m_Nt
Definition: afopr_Domainwall_5din.h:62
AFopr_Domainwall_5din::m_Ndf
int m_Ndf
Definition: afopr_Domainwall_5din.h:64
AFopr_Domainwall_5din::m_Ndim
int m_Ndim
Definition: afopr_Domainwall_5din.h:63
AFopr_Domainwall_5din::m_Nvcd
int m_Nvcd
Definition: afopr_Domainwall_5din.h:64
AFopr_Domainwall_5din::flop_count
double flop_count()
this returns the number of floating point number operations.
Definition: afopr_Domainwall_5din.h:174
AFopr_Domainwall_5din::LUdag_inv
void LUdag_inv(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:1022
AFopr_Domainwall_5din::m_vl
Bridge::VerboseLevel m_vl
verbose level
Definition: afopr_Domainwall_5din.h:57
commonParameters.h
AFopr_Domainwall_5din::init
void init(const Parameters &params)
initial setup.
Definition: afopr_Domainwall_5din-tmpl.h:29
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:198
AFopr_Domainwall_5din::set_config_impl
void set_config_impl(Field *U)
Definition: afopr_Domainwall_5din-tmpl.h:458
Field
Container of Field-type object.
Definition: field.h:46
AFopr_Domainwall_5din::class_name
static const std::string class_name
Definition: afopr_Domainwall_5din.h:46
afopr.h
AFopr_Domainwall_5din::AFopr_Domainwall_5din
AFopr_Domainwall_5din(const Parameters &params)
constructor.
Definition: afopr_Domainwall_5din.h:100
AFopr_Domainwall_5din::chset_send
ChannelSet chset_send
Definition: afopr_Domainwall_5din.h:84
communicator.h
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:45
AFopr_Domainwall_5din::DDdag
void DDdag(AFIELD &, const AFIELD &)
Definition: afopr_Domainwall_5din-tmpl.h:695
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:79
AFopr_Domainwall_5din::m_impl
std::string m_impl
4d or 5d kernel implementation
Definition: afopr_Domainwall_5din.h:60
AFopr_Domainwall_5din::chsend_dn
std::vector< Channel > chsend_dn
Definition: afopr_Domainwall_5din.h:83
AFopr_Domainwall_5din::m_repr
std::string m_repr
Dirac matrix representation.
Definition: afopr_Domainwall_5din.h:59
Channel_impl
Definition: channel.h:86
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:572
AFopr_Domainwall_5din::set_config
void set_config(Field *U)
sets the gauge configuration.
Definition: afopr_Domainwall_5din-tmpl.h:426