Bridge++  Ver. 2.0.2
afopr_Clover_eo.h
Go to the documentation of this file.
1 
10 #ifndef QXS_AFOPR_CLOVER_EO_INCLUDED
11 #define QXS_AFOPR_CLOVER_EO_INCLUDED
12 
13 #include <cstdio>
14 #include <cstdlib>
15 
16 #include <string>
17 using std::string;
18 #include <vector>
19 using std::vector;
20 
21 #include "lib/Fopr/afopr.h"
26 #include "lib/IO/bridgeIO.h"
27 using Bridge::vout;
28 
31 
32 class Field;
33 
39 template<typename AFIELD>
40 class AFopr_Clover_eo : public AFopr<AFIELD>
41 {
42  public:
43  typedef typename AFIELD::real_t real_t;
44  static const std::string class_name;
45 
46  protected:
47  int m_Nc, m_Nd, m_Ndf, m_Nvc;
48  int m_Nst, m_Nx, m_Ny, m_Nz, m_Nt;
49  int m_Ndim;
50  int m_Nx2, m_Nst2;
52 
55  std::vector<int> m_boundary;
56  std::string m_repr;
58 
59  std::vector<int> m_Leo;
60 
65 
66  std::string m_mode;
67 
70 
72 
73  int m_Nsize[4]; // lattice sizes (Nx2v in x-direction)
74 
75  int do_comm[4]; // switchs of communication (4=Ndim): (0: n, 1: y).
76  int do_comm_any; // switchs of communication (if any): (0: n, 1: y).
77 
78  std::vector<int> m_bdsize;
79  using allocator_t = typename AFIELD::template aligned_allocator<char>;
81  std::vector<Channel> chsend_up, chrecv_up, chsend_dn, chrecv_dn;
83 
85 
87 
88  public:
90  AFopr_Clover_eo(const Parameters& params) { init(params); }
91 
94 
96  void set_parameters(const Parameters& params);
97 
99  void set_parameters(real_t CKs, real_t csw, std::vector<int> bc);
100 
102  void get_parameters(Parameters& params) const;
103 
105  void setup_qws();
106 
108  void set_config(Field *u);
109 
111  void set_mode(std::string mode);
112 
114  std::string get_mode() const { return m_mode; }
115 
116  void mult(AFIELD&, const AFIELD&);
117  void mult_dag(AFIELD&, const AFIELD&);
118  void mult_gm5(AFIELD&, const AFIELD&);
119 
120  void mult_gm4(AFIELD&, const AFIELD&);
121 
122  void mult(AFIELD&, const AFIELD&,
123  const std::string mode);
124 
125  void DdagD(AFIELD&, const AFIELD&);
126  void Ddag(AFIELD&, const AFIELD&);
127  void D(AFIELD&, const AFIELD&);
128  void gm5(AFIELD&, const AFIELD&);
129 
130  void aypx(real_t, AFIELD&, const AFIELD&);
131 
133  void Meo(AFIELD&, const AFIELD&, const int ieo);
134 
136  void Meo(AFIELD&, const AFIELD&, const AFIELD&,
137  const int ieo, const int iflag);
138 
140  void mult_Meo(AFIELD&, const AFIELD&, const AFIELD&,
141  const int ieo, const int iflag);
142 
144  void mult_Meo_alt(AFIELD&, const AFIELD&, const AFIELD&,
145  const int ieo, const int iflag);
146 
148  void mult_Meo_qxs(AFIELD&, const AFIELD&, const AFIELD&,
149  const int ieo, const int iflag);
150 
152  void mult_Meo_qws(AFIELD&, const AFIELD&, const AFIELD&,
153  const int ieo, const int iflag);
154 
156  int field_nin() { return 2 * m_Nc * m_Nd; }
157 
159  int field_nvol() { return m_Nst2; }
160 
162  int field_nex() { return 1; }
163 
165  double flop_count() { return flop_count(m_mode); }
166 
168  double flop_count(const std::string mode);
169 
171  bool needs_convert() { return true; }
172 
174  void convert(AFIELD&, const Field&);
175 
177  void reverse(Field&, const AFIELD&);
178 
179  private:
181  void init(const Parameters& params);
182 
184  void tidyup();
185 
187  void setup_channels();
188 
190  void set_csw();
191 
193  void set_config_omp(Field *u);
194 
196  void set_config_impl(Field *u);
197 
199  void set_csw_chrot(AFIELD& m_T_inv, int ieo);
200 
201  void mult_cswinv(AFIELD&, const AFIELD&, const int ieo);
202 
203  void mult_cswinv(real_t *v2, real_t *v1, int ieo);
204 
205  void mult_cswinv_dirac(real_t *v2, real_t *v1,
206  real_t *csw_inv, int site);
207 
208 
209  void mult_xp(real_t *, real_t *, const int);
210  void mult_xm(real_t *, real_t *, const int);
211  void mult_yp(real_t *, real_t *, const int);
212  void mult_ym(real_t *, real_t *, const int);
213  void mult_zp(real_t *, real_t *, const int);
214  void mult_zm(real_t *, real_t *, const int);
215  void mult_tp(real_t *, real_t *, const int);
216  void mult_tm(real_t *, real_t *, const int);
217 
218  void mult_gm5(real_t *, real_t *);
219 
220  void mult_gm4(real_t *, real_t *);
221 
222  void clear(real_t *);
223 
224  void aypx(real_t, real_t *, real_t *);
225  void scal(real_t *, const real_t);
226 
227  void clear(real_t *, const int, const int);
228 
229  void aypx(real_t, real_t *, real_t *, const int, const int);
230  void scal(real_t *, const real_t, const int, const int);
231 
232 
233 #ifdef USE_FACTORY
234  private:
235  static AFopr<AFIELD> *create_object_with_params(const Parameters& params)
236  { return new AFopr_Clover_eo(params); }
237 
238  public:
239  static bool register_factory()
240  {
241  bool init1 = AFopr<AFIELD>::Factory_params::Register("Clover_eo",
242  create_object_with_params);
243  return init1;
244  }
245 #endif
246 };
247 
248 #endif
AFopr_Clover_eo::mult
void mult(AFIELD &, const AFIELD &)
multiplies fermion operator to a given field.
Definition: afopr_Clover_eo-tmpl.h:493
AFopr_Clover_eo::m_Nd
int m_Nd
Definition: afopr_Clover_eo.h:47
AFopr_Clover_eo::do_comm
int do_comm[4]
Definition: afopr_Clover_eo.h:75
AFopr_Clover_eo::mult_zp
void mult_zp(real_t *, real_t *, const int)
AFopr_Clover_eo::allocator_t
typename AFIELD::template aligned_allocator< char > allocator_t
Definition: afopr_Clover_eo.h:79
bridgeIO.h
AFopr_Clover_eo::set_csw_chrot
void set_csw_chrot(AFIELD &m_T_inv, int ieo)
setting clover term inverse for chiral rotation case.
Definition: afopr_Clover_eo-tmpl.h:378
afield.h
AFopr
Definition: afopr.h:48
AFopr_Clover_eo::mult_xm
void mult_xm(real_t *, real_t *, const int)
AFopr_Clover_eo::D
void D(AFIELD &, const AFIELD &)
Definition: afopr_Clover_eo-tmpl.h:628
AFopr_Clover_eo::m_Nc
int m_Nc
Definition: afopr_Clover_eo.h:47
AFopr_Clover_eo::mult_Meo_alt
void mult_Meo_alt(AFIELD &, const AFIELD &, const AFIELD &, const int ieo, const int iflag)
Meo implementation: using mult_xp etc.
Org::Fopr_CloverTerm_eo
Definition: fopr_CloverTerm_eo_impl.h:64
communicator_impl.h
Parameters
Class for parameters.
Definition: parameters.h:46
AFopr_Clover_eo::convert
void convert(AFIELD &, const Field &)
convert Field to AField for this class.
Definition: afopr_Clover_eo-tmpl.h:458
AFopr_Clover_eo::chsend_dn
std::vector< Channel > chsend_dn
Definition: afopr_Clover_eo.h:81
AFopr_Clover_eo::setup_qws
void setup_qws()
initialize qxs library.
AFopr_Clover_eo::m_boundary
std::vector< int > m_boundary
pointer to boundary condition
Definition: afopr_Clover_eo.h:55
AFopr_Clover_eo::m_csw
real_t m_csw
clover coefficient
Definition: afopr_Clover_eo.h:54
AFopr_Clover_eo::m_Nx2v
int m_Nx2v
Definition: afopr_Clover_eo.h:51
AFopr_Clover_eo::m_Te_inv
AFIELD m_Te_inv
Definition: afopr_Clover_eo.h:86
AFopr_Clover_eo::m_Ndim
int m_Ndim
Definition: afopr_Clover_eo.h:49
AFopr_Clover_eo::m_Nst
int m_Nst
Definition: afopr_Clover_eo.h:48
AFopr_Clover_eo::set_config_impl
void set_config_impl(Field *u)
setting gauge configuration (implementation).
Definition: afopr_Clover_eo-tmpl.h:322
AFopr_Clover_eo::Meo
void Meo(AFIELD &, const AFIELD &, const int ieo)
Fermion matrix with ieo = 0: even <– odd, 1: odd <– even.
Definition: afopr_Clover_eo-tmpl.h:654
AFopr_Clover_eo::m_CKs
real_t m_CKs
hopping parameter
Definition: afopr_Clover_eo.h:53
AFopr_Clover_eo::get_parameters
void get_parameters(Parameters &params) const
get parameters via a Parameter object
Definition: afopr_Clover_eo-tmpl.h:277
AFopr_Clover_eo::m_Ny
int m_Ny
Definition: afopr_Clover_eo.h:48
AFopr_Clover_eo::m_Nz
int m_Nz
Definition: afopr_Clover_eo.h:48
AFopr_Clover_eo::mult_cswinv
void mult_cswinv(AFIELD &, const AFIELD &, const int ieo)
Definition: afopr_Clover_eo-tmpl.h:740
AFopr_Clover_eo::mult_gm4
void mult_gm4(AFIELD &, const AFIELD &)
Definition: afopr_Clover_eo-tmpl.h:545
ChannelSet
ChannelSet class for a collection of channels.
Definition: channel.h:148
AFopr_Clover_eo::~AFopr_Clover_eo
~AFopr_Clover_eo()
destructor.
Definition: afopr_Clover_eo.h:93
AFopr_Clover_eo::mult_tm
void mult_tm(real_t *, real_t *, const int)
AFopr_Clover_eo::m_Ueo
AFIELD m_Ueo
gauge config in even-odd index
Definition: afopr_Clover_eo.h:64
AFopr_Clover_eo::real_t
AFIELD::real_t real_t
Definition: afopr_Clover_eo.h:43
AFopr_Clover_eo::m_index
AIndex_eo< real_t, AFIELD::IMPL > m_index
Definition: afopr_Clover_eo.h:61
AFopr_Clover_eo::clear
void clear(real_t *)
Definition: afopr_Clover_eo-tmpl.h:807
AFopr_Clover_eo::do_comm_any
int do_comm_any
Definition: afopr_Clover_eo.h:76
AFopr_Clover_eo::flop_count
double flop_count()
returns floating operation counts.
Definition: afopr_Clover_eo.h:165
AFopr_Clover_eo::mult_gm5
void mult_gm5(AFIELD &, const AFIELD &)
multiplies gamma_5 matrix.
Definition: afopr_Clover_eo-tmpl.h:527
AFopr_Clover_eo::m_Nx2
int m_Nx2
Definition: afopr_Clover_eo.h:50
AFopr_Clover_eo::setup_channels
void setup_channels()
setup channels for communication.
Definition: afopr_Clover_eo-tmpl.h:169
AFopr_Clover_eo::m_w2
Field_F m_w2
Definition: afopr_Clover_eo.h:71
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
AFopr_Clover_eo::mult_yp
void mult_yp(real_t *, real_t *, const int)
AFopr_Clover_eo::set_csw
void set_csw()
setting clover term inverse.
Definition: afopr_Clover_eo-tmpl.h:368
AFopr_Clover_eo::mult_Meo_qws
void mult_Meo_qws(AFIELD &, const AFIELD &, const AFIELD &, const int ieo, const int iflag)
Meo implementation: using qxs library.
Field::real_t
double real_t
Definition: field.h:51
AFopr_Clover_eo::set_parameters
void set_parameters(const Parameters &params)
setting parameters by a Parameter object.
Definition: afopr_Clover_eo-tmpl.h:213
AFopr_Clover_eo::mult_tp
void mult_tp(real_t *, real_t *, const int)
fopr_CloverTerm_eo.h
AFopr_Clover_eo::m_Nst2v
int m_Nst2v
Definition: afopr_Clover_eo.h:51
AFopr_Clover_eo::chset_send
ChannelSet chset_send
Definition: afopr_Clover_eo.h:82
AFopr_Clover_eo::set_mode
void set_mode(std::string mode)
setting mult mode.
Definition: afopr_Clover_eo-tmpl.h:480
AFopr_Clover_eo::aypx
void aypx(real_t, AFIELD &, const AFIELD &)
Definition: afopr_Clover_eo-tmpl.h:641
AFopr_Clover_eo::m_Nt
int m_Nt
Definition: afopr_Clover_eo.h:48
AFopr_Clover_eo::m_Nx
int m_Nx
Definition: afopr_Clover_eo.h:48
aindex_eo.h
AFopr_Clover_eo::field_nex
int field_nex()
returns external size parameter.
Definition: afopr_Clover_eo.h:162
AFopr_Clover_eo::scal
void scal(real_t *, const real_t)
Definition: afopr_Clover_eo-tmpl.h:827
AFopr_Clover_eo::m_z1
AFIELD m_z1
lexical field: used in convert/reverse.
Definition: afopr_Clover_eo.h:69
AFopr_Clover_eo::m_repr
std::string m_repr
gamma matrix representation
Definition: afopr_Clover_eo.h:56
AFopr_Clover_eo::mult_ym
void mult_ym(real_t *, real_t *, const int)
AFopr_Clover_eo::chrecv_dn
std::vector< Channel > chrecv_dn
Definition: afopr_Clover_eo.h:81
AFopr_Clover_eo::m_mode
std::string m_mode
mult mode
Definition: afopr_Clover_eo.h:66
AFopr_Clover_eo::set_config
void set_config(Field *u)
setting gauge configuration (common interface).
Definition: afopr_Clover_eo-tmpl.h:290
AFopr_Clover_eo::m_Ndf
int m_Ndf
Definition: afopr_Clover_eo.h:47
AFopr_Clover_eo::m_Nyv
int m_Nyv
Definition: afopr_Clover_eo.h:51
AFopr_Clover_eo::needs_convert
bool needs_convert()
field convert is necessary in this implementation.
Definition: afopr_Clover_eo.h:171
AFopr_Clover_eo::m_vl
Bridge::VerboseLevel m_vl
verbose level
Definition: afopr_Clover_eo.h:57
AFopr_Clover_eo::m_Ulex
AFIELD m_Ulex
converted gauge config with boundary conditions
Definition: afopr_Clover_eo.h:63
AFopr_Clover_eo::m_v1
AFIELD m_v1
Definition: afopr_Clover_eo.h:68
AFopr_Clover_eo::mult_dag
void mult_dag(AFIELD &, const AFIELD &)
hermitian conjugate of mult.
Definition: afopr_Clover_eo-tmpl.h:510
AFopr_Clover_eo::m_w1
Field_F m_w1
Definition: afopr_Clover_eo.h:71
AFopr_Clover_eo::Ddag
void Ddag(AFIELD &, const AFIELD &)
Definition: afopr_Clover_eo-tmpl.h:612
AFopr_Clover_eo::mult_Meo_qxs
void mult_Meo_qxs(AFIELD &, const AFIELD &, const AFIELD &, const int ieo, const int iflag)
Meo implementation: using qxs library.
Definition: afopr_Clover_eo-tmpl.h:673
AFopr_Clover_eo::m_Nst2
int m_Nst2
Definition: afopr_Clover_eo.h:50
AFopr_Clover_eo::mult_xp
void mult_xp(real_t *, real_t *, const int)
AFopr_Clover_eo::mult_cswinv_dirac
void mult_cswinv_dirac(real_t *v2, real_t *v1, real_t *csw_inv, int site)
AFopr_Clover_eo::m_Leo
std::vector< int > m_Leo
Leo = 0 (even site) or 1 (odd site).
Definition: afopr_Clover_eo.h:59
AFopr_Clover_eo::m_Nvc
int m_Nvc
Definition: afopr_Clover_eo.h:47
AFopr_Clover_eo::set_config_omp
void set_config_omp(Field *u)
setting gauge configuration (setting omp parallel).
Definition: afopr_Clover_eo-tmpl.h:309
AFopr_Clover_eo::field_nvol
int field_nvol()
returns local volume size parameter.
Definition: afopr_Clover_eo.h:159
AFopr_Clover_eo::init
void init(const Parameters &params)
initial setup.
Definition: afopr_Clover_eo-tmpl.h:18
AFopr_Clover_eo::mult_Meo
void mult_Meo(AFIELD &, const AFIELD &, const AFIELD &, const int ieo, const int iflag)
Meo implementation: standard.
AFopr_Clover_eo::reverse
void reverse(Field &, const AFIELD &)
reverse AField to Field.
Definition: afopr_Clover_eo-tmpl.h:469
AFopr_Clover_eo::chset_recv
ChannelSet chset_recv
Definition: afopr_Clover_eo.h:82
AFopr_Clover_eo::AFopr_Clover_eo
AFopr_Clover_eo(const Parameters &params)
constructor.
Definition: afopr_Clover_eo.h:90
AFopr_Clover_eo::m_v2
AFIELD m_v2
working field.
Definition: afopr_Clover_eo.h:68
AFopr_Clover_eo::DdagD
void DdagD(AFIELD &, const AFIELD &)
Definition: afopr_Clover_eo-tmpl.h:603
AFopr_Clover_eo::gm5
void gm5(AFIELD &, const AFIELD &)
Field_F
Wilson-type fermion field.
Definition: field_F.h:37
AFopr_Clover_eo
Definition: afopr_Clover_eo.h:40
AFopr_Clover_eo::get_mode
std::string get_mode() const
returns mult mode.
Definition: afopr_Clover_eo.h:114
commonParameters.h
AFopr_Clover_eo::field_nin
int field_nin()
returns inner size parameter.
Definition: afopr_Clover_eo.h:156
Field
Container of Field-type object.
Definition: field.h:46
afopr.h
communicator.h
AFopr_Clover_eo::chsend_up
std::vector< Channel > chsend_up
Definition: afopr_Clover_eo.h:81
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
AFopr_Clover_eo::m_conf
Field * m_conf
original gauge config.
Definition: afopr_Clover_eo.h:62
AFopr_Clover_eo::m_bdsize
std::vector< int > m_bdsize
Definition: afopr_Clover_eo.h:78
AFopr_Clover_eo::tidyup
void tidyup()
final tidy-up.
Definition: afopr_Clover_eo-tmpl.h:203
AFopr_Clover_eo::chrecv_up
std::vector< Channel > chrecv_up
Definition: afopr_Clover_eo.h:81
AFopr_Clover_eo::m_To_inv
AFIELD m_To_inv
Definition: afopr_Clover_eo.h:86
AFopr_Clover_eo::m_fopr_ct
Fopr_CloverTerm_eo * m_fopr_ct
clover term (corelib)
Definition: afopr_Clover_eo.h:84
Channel_impl
Definition: channel.h:86
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
AIndex_eo< real_t, AFIELD::IMPL >
AFopr_Clover_eo::class_name
static const std::string class_name
Definition: afopr_Clover_eo.h:44
AFopr_Clover_eo::m_Nsize
int m_Nsize[4]
Definition: afopr_Clover_eo.h:73
AFopr_Clover_eo::mult_zm
void mult_zm(real_t *, real_t *, const int)