Bridge++  Ver. 2.0.2
afopr_Clover_dd.h
Go to the documentation of this file.
1 
10 #ifndef QXS_AFOPR_CLOVER_DD_INCLUDED
11 #define QXS_AFOPR_CLOVER_DD_INCLUDED
12 
13 #include <cstdio>
14 #include <cstdlib>
15 
16 #include <string>
17 using std::string;
18 
19 #include <vector>
20 using std::vector;
21 
22 #include "lib_alt/Fopr/afopr_dd.h"
23 
26 #include "lib/IO/bridgeIO.h"
27 using Bridge::vout;
28 
31 
33 
36 
37 class Field;
38 
44 template<typename AFIELD>
45 class AFopr_Clover_dd : public AFopr_dd<AFIELD>
46 {
47  public:
48  typedef typename AFIELD::real_t real_t;
49  static const std::string class_name;
50 
51  protected:
53  int m_Nx, m_Ny, m_Nz, m_Nt, m_Nst;
55 
58  std::vector<int> m_boundary;
59  std::string m_repr;
60 
62 
63  std::vector<int> m_block_size;
64 
65  int m_Ieo;
66 
70 
71  std::string m_mode;
72 
74 
76 
78 
80 
81  int m_Nsize[4];
82  int m_block_sizev[4];
83 
84  int do_comm[4]; // switchs of communication (4=Ndim): (0: n, 1: y).
85  int do_comm_any; // switchs of communication (if any): (0: n, 1: y).
86 
87  std::vector<int> m_bdsize;
88  using allocator_t = typename AFIELD::template aligned_allocator<char>;
90  std::vector<Channel> chsend_up, chrecv_up, chsend_dn, chrecv_dn;
92 
93  public:
96  { init(params); }
97 
100 
102  void set_parameters(const Parameters& params);
103 
105  void set_parameters(real_t CKs, real_t csw,
106  std::vector<int> bc,
107  std::vector<int> block_size);
108 
110  void get_parameters(Parameters& params) const;
111 
113  void set_config(Field *u);
114 
116  bool needs_convert() { return true; }
117 
119  void convert(AFIELD& v, const Field& w);
120 
122  void reverse(Field& v, const AFIELD& w);
123 
125  inline Field *get_conf(void) { return m_conf; }
126 
128  // void set_mode(std::string mode){ m_mode = mode; }
129  void set_mode(std::string mode);
130 
132  std::string get_mode() const;
133 
134  void mult(AFIELD&, const AFIELD&);
135  void mult_dag(AFIELD&, const AFIELD&);
136  void mult_gm5(AFIELD&, const AFIELD&);
137 
138  void project_chiral(AFIELD&, const AFIELD&, int ch);
139 
140  void mult_up(int mu, AFIELD&, const AFIELD&);
141  void mult_dn(int mu, AFIELD&, const AFIELD&);
142 
143  void mult_sap(AFIELD&, const AFIELD&, const int ieo);
144  void mult_dd(AFIELD&, const AFIELD&);
145  void mult_dup(AFIELD&, const AFIELD&, const int mu);
146  void mult_ddn(AFIELD&, const AFIELD&, const int mu);
147 
148  // to be discarded
149  void mult_block_hop(AFIELD& v, const AFIELD& w, const int mu)
150  { mult_dup(v, w, mu); }
151 
153  int field_nin() { return 2 * m_Nc * m_Nd; }
154 
156  int field_nvol() { return m_Nst; }
157 
159  int field_nex() { return 1; }
160 
162  double flop_count() { return flop_count(m_mode); }
163 
165  double flop_count_sap();
166 
168  double flop_count(const std::string mode);
169 
170  private:
172  void init(const Parameters& params);
173 
175  void tidyup();
176 
178  void setup_channels();
179 
181  void set_config_omp(Field *u);
182 
184  void set_config_impl(Field *u);
185 
187  void set_block_config(AFIELD&);
188 
190  void set_csw();
191 
193  void set_csw_chrot();
194 
196  void mult_csw(real_t *, real_t *);
197 
198  void DdagD(AFIELD&, const AFIELD&);
199  void Ddag(AFIELD&, const AFIELD&);
200  void H(AFIELD&, const AFIELD&);
201  void D(AFIELD&, const AFIELD&);
202 
203  void mult_gm4(AFIELD&, const AFIELD&);
204 
206  void mult_D(AFIELD&, const AFIELD&);
207 
209  void mult_D_alt(AFIELD&, const AFIELD&);
210 
211  void mult_xp(real_t *, real_t *, int);
212  void mult_xm(real_t *, real_t *, int);
213  void mult_yp(real_t *, real_t *, int);
214  void mult_ym(real_t *, real_t *, int);
215  void mult_zp(real_t *, real_t *, int);
216  void mult_zm(real_t *, real_t *, int);
217  void mult_tp(real_t *, real_t *, int);
218  void mult_tm(real_t *, real_t *, int);
219 
220  void mult_gm5(real_t *, real_t *);
221 
222  void clear(real_t *);
223 
224  void scal_local(real_t *, real_t);
225  void aypx(real_t, real_t *, real_t *);
226  void gm5_aypx(real_t, real_t *, real_t *);
227 
228 
229 #ifdef USE_FACTORY
230  private:
231  static AFopr<AFIELD> *create_object_with_params(const Parameters& params)
232  { return new AFopr_Clover_dd(params); }
233 
234  public:
235  static bool register_factory()
236  {
237  bool init1 = AFopr<AFIELD>::Factory_params::Register("Clover_dd",
238  create_object_with_params);
239  return init1;
240  }
241 #endif
242 };
243 
244 #endif
AFopr_Clover_dd::get_parameters
void get_parameters(Parameters &params) const
get parameters via a Parameter object
Definition: afopr_Clover_dd-tmpl.h:291
AFopr_Clover_dd::clear
void clear(real_t *)
Definition: afopr_Clover_dd-tmpl.h:1202
AFopr_Clover_dd::chset_recv
ChannelSet chset_recv
Definition: afopr_Clover_dd.h:91
AFopr_Clover_dd::set_block_config
void set_block_config(AFIELD &)
inpose the block condition to link variable.
Definition: afopr_Clover_dd-tmpl.h:370
AFopr_Clover_dd::m_Ndf
int m_Ndf
Definition: afopr_Clover_dd.h:52
AFopr_Clover_dd::scal_local
void scal_local(real_t *, real_t)
Definition: afopr_Clover_dd-tmpl.h:813
AFopr_Clover_dd::m_Nxv
int m_Nxv
Definition: afopr_Clover_dd.h:54
AFopr_Clover_dd::mult_D
void mult_D(AFIELD &, const AFIELD &)
standard D mult.
Definition: afopr_Clover_dd-tmpl.h:906
bridgeIO.h
AFopr_Clover_dd::tidyup
void tidyup()
final tidy-up.
Definition: afopr_Clover_dd-tmpl.h:168
AFopr_Clover_dd::chsend_dn
std::vector< Channel > chsend_dn
Definition: afopr_Clover_dd.h:90
afield.h
AFopr_Clover_dd::set_config
void set_config(Field *u)
setting gauge configuration (common interface).
Definition: afopr_Clover_dd-tmpl.h:305
AFopr_Clover_dd::convert
void convert(AFIELD &v, const Field &w)
convert of spinor field.
Definition: afopr_Clover_dd-tmpl.h:592
AFopr_Clover_dd::m_Nt
int m_Nt
Definition: afopr_Clover_dd.h:53
AFopr_Clover_dd::class_name
static const std::string class_name
Definition: afopr_Clover_dd.h:49
AFopr_Clover_dd::m_w2
Field_F m_w2
Definition: afopr_Clover_dd.h:79
AFopr_Clover_dd::m_csw
real_t m_csw
colver coefficient
Definition: afopr_Clover_dd.h:57
AFopr_Clover_dd::m_U
AFIELD m_U
copied gauge config. with boundary conditions.
Definition: afopr_Clover_dd.h:68
AFopr_Clover_dd::set_config_impl
void set_config_impl(Field *u)
setting gauge configuration (implementation).
Definition: afopr_Clover_dd-tmpl.h:337
AFopr_Clover_dd::mult_ddn
void mult_ddn(AFIELD &, const AFIELD &, const int mu)
Downward hopping part of mult.
Definition: afopr_Clover_dd-tmpl.h:1100
AFopr
Definition: afopr.h:48
AFopr_Clover_dd::m_w1
Field_F m_w1
Definition: afopr_Clover_dd.h:79
AFopr_Clover_dd::Ddag
void Ddag(AFIELD &, const AFIELD &)
Definition: afopr_Clover_dd-tmpl.h:743
AFopr_Clover_dd::m_block_size
std::vector< int > m_block_size
block size
Definition: afopr_Clover_dd.h:63
communicator_impl.h
AFopr_Clover_dd::mult_tm
void mult_tm(real_t *, real_t *, int)
Definition: afopr_Clover_dd-tmpl.h:1702
Parameters
Class for parameters.
Definition: parameters.h:46
AFopr_Clover_dd::field_nvol
int field_nvol()
returns local volume size parameter.
Definition: afopr_Clover_dd.h:156
AFopr_Clover_dd::m_conf
Field * m_conf
original gauge config.
Definition: afopr_Clover_dd.h:67
AFopr_Clover_dd::m_Nsize
int m_Nsize[4]
lattice sizes (Nxv in x-direction)
Definition: afopr_Clover_dd.h:81
AFopr_Clover_dd::field_nin
int field_nin()
returns inner size parameter.
Definition: afopr_Clover_dd.h:153
AFopr_Clover_dd::chset_send
ChannelSet chset_send
Definition: afopr_Clover_dd.h:91
AFopr_Clover_dd::~AFopr_Clover_dd
~AFopr_Clover_dd()
destructor.
Definition: afopr_Clover_dd.h:99
AFopr_Clover_dd::m_repr
std::string m_repr
gamma matrix representation
Definition: afopr_Clover_dd.h:59
AFopr_Clover_dd::set_config_omp
void set_config_omp(Field *u)
setting gauge configuration (setting omp parallel).
Definition: afopr_Clover_dd-tmpl.h:324
AFopr_Clover_dd::field_nex
int field_nex()
returns external size parameter.
Definition: afopr_Clover_dd.h:159
AFopr_Clover_dd::mult_ym
void mult_ym(real_t *, real_t *, int)
Definition: afopr_Clover_dd-tmpl.h:1429
AFopr_Clover_dd::m_Ieo
int m_Ieo
even-odd label of origin in units of block
Definition: afopr_Clover_dd.h:65
AFopr_Clover_dd::m_Ny
int m_Ny
Definition: afopr_Clover_dd.h:53
AFopr_Clover_dd::mult_dd
void mult_dd(AFIELD &, const AFIELD &)
Mult only inside domain.
Definition: afopr_Clover_dd-tmpl.h:1008
AFopr_Clover_dd::mult_zp
void mult_zp(real_t *, real_t *, int)
Definition: afopr_Clover_dd-tmpl.h:1504
AFopr_Clover_dd::init
void init(const Parameters &params)
initial setup.
Definition: afopr_Clover_dd-tmpl.h:17
AFopr_Clover_dd::flop_count
double flop_count()
returns floating operation counts.
Definition: afopr_Clover_dd.h:162
ChannelSet
ChannelSet class for a collection of channels.
Definition: channel.h:148
AFopr_Clover_dd::flop_count_sap
double flop_count_sap()
returns floating operation counts of mult_sap.
Definition: afopr_Clover_dd-tmpl.h:1808
AFopr_Clover_dd::mult_D_alt
void mult_D_alt(AFIELD &, const AFIELD &)
D mult using mult_xp, etc.
Definition: afopr_Clover_dd-tmpl.h:1038
AFopr_Clover_dd::m_block_sizev
int m_block_sizev[4]
block size in units of SIMD vector
Definition: afopr_Clover_dd.h:82
AFopr_Clover_dd::chsend_up
std::vector< Channel > chsend_up
Definition: afopr_Clover_dd.h:90
AFopr_Clover_dd::mult_dup
void mult_dup(AFIELD &, const AFIELD &, const int mu)
Upward hopping part of mult.
Definition: afopr_Clover_dd-tmpl.h:1064
AFopr_Clover_dd::m_Nc
int m_Nc
Definition: afopr_Clover_dd.h:52
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
AFopr_Clover_dd::setup_channels
void setup_channels()
setup channels for communication.
Definition: afopr_Clover_dd-tmpl.h:134
AFopr_Clover_dd::aypx
void aypx(real_t, real_t *, real_t *)
Definition: afopr_Clover_dd-tmpl.h:1184
AFopr_Clover_dd::chrecv_dn
std::vector< Channel > chrecv_dn
Definition: afopr_Clover_dd.h:90
AFopr_Clover_dd::D
void D(AFIELD &, const AFIELD &)
Definition: afopr_Clover_dd-tmpl.h:723
AFopr_dd
Base class of fermion operator family.
Definition: afopr_dd.h:24
AFopr_Clover_dd::mult_block_hop
void mult_block_hop(AFIELD &v, const AFIELD &w, const int mu)
Definition: afopr_Clover_dd.h:149
AFopr_Clover_dd::mult_sap
void mult_sap(AFIELD &, const AFIELD &, const int ieo)
SAP operator.
Definition: afopr_Clover_dd-tmpl.h:977
AFopr_Clover_dd::m_v2
AFIELD m_v2
Definition: afopr_Clover_dd.h:75
Field::real_t
double real_t
Definition: field.h:51
AFopr_Clover_dd::do_comm_any
int do_comm_any
Definition: afopr_Clover_dd.h:85
AFopr_Clover_dd::mult_csw
void mult_csw(real_t *, real_t *)
set_csw now assumes Dirac repr.
Definition: afopr_Clover_dd-tmpl.h:862
AFopr_Clover_dd::mult_gm5
void mult_gm5(AFIELD &, const AFIELD &)
multiplies gamma_5 matrix.
Definition: afopr_Clover_dd-tmpl.h:770
AFopr_Clover_dd::reverse
void reverse(Field &v, const AFIELD &w)
reverse of spinor field.
Definition: afopr_Clover_dd-tmpl.h:603
AFopr_Clover_dd::set_parameters
void set_parameters(const Parameters &params)
setting parameters by a Parameter object.
Definition: afopr_Clover_dd-tmpl.h:178
afopr_dd.h
AFopr_Clover_dd::mult_xp
void mult_xp(real_t *, real_t *, int)
Definition: afopr_Clover_dd-tmpl.h:1218
AFopr_Clover_dd::mult_zm
void mult_zm(real_t *, real_t *, int)
Definition: afopr_Clover_dd-tmpl.h:1570
aindex_lex.h
AFopr_Clover_dd::do_comm
int do_comm[4]
Definition: afopr_Clover_dd.h:84
fopr_CloverTerm.h
AFopr_Clover_dd::m_Nst
int m_Nst
Definition: afopr_Clover_dd.h:53
AFopr_Clover_dd::needs_convert
bool needs_convert()
QXS version requires convert of spinor field.
Definition: afopr_Clover_dd.h:116
AFopr_Clover_dd::mult
void mult(AFIELD &, const AFIELD &)
multiplies fermion operator to a given field.
Definition: afopr_Clover_dd-tmpl.h:681
AFopr_Clover_dd::mult_up
void mult_up(int mu, AFIELD &, const AFIELD &)
upward nearest neighbor hopping term.
Definition: afopr_Clover_dd-tmpl.h:614
AFopr_Clover_dd::set_csw_chrot
void set_csw_chrot()
set_csw with rotation to chiral repr.
Definition: afopr_Clover_dd-tmpl.h:513
AFopr_Clover_dd::mult_yp
void mult_yp(real_t *, real_t *, int)
Definition: afopr_Clover_dd-tmpl.h:1358
AFopr_Clover_dd::m_T
AFIELD m_T
clover term
Definition: afopr_Clover_dd.h:77
AFopr_Clover_dd::DdagD
void DdagD(AFIELD &, const AFIELD &)
Definition: afopr_Clover_dd-tmpl.h:732
AFopr_Clover_dd::m_boundary
std::vector< int > m_boundary
pointer to boundary condition
Definition: afopr_Clover_dd.h:58
AFopr_Clover_dd::H
void H(AFIELD &, const AFIELD &)
Definition: afopr_Clover_dd-tmpl.h:1175
AFopr_Clover_dd::m_Ublock
AFIELD m_Ublock
copied gauge config. with block condition.
Definition: afopr_Clover_dd.h:69
AFopr_Clover_dd::chrecv_up
std::vector< Channel > chrecv_up
Definition: afopr_Clover_dd.h:90
AFopr_Clover_dd::get_mode
std::string get_mode() const
returns mult mode.
Definition: afopr_Clover_dd-tmpl.h:673
AFopr_Clover_dd::m_bdsize
std::vector< int > m_bdsize
Definition: afopr_Clover_dd.h:87
AFopr_Clover_dd::mult_tp
void mult_tp(real_t *, real_t *, int)
Definition: afopr_Clover_dd-tmpl.h:1637
parameters.h
AFopr_Clover_dd::set_mode
void set_mode(std::string mode)
setting mult mode.
Definition: afopr_Clover_dd-tmpl.h:660
AFopr_Clover_dd::gm5_aypx
void gm5_aypx(real_t, real_t *, real_t *)
AFopr_Clover_dd::m_vl
Bridge::VerboseLevel m_vl
verbose level
Definition: afopr_Clover_dd.h:61
AFopr_Clover_dd::m_Nz
int m_Nz
Definition: afopr_Clover_dd.h:53
AFopr_Clover_dd::m_CKs
real_t m_CKs
hopping parameter.
Definition: afopr_Clover_dd.h:56
AFopr_Clover_dd::mult_dn
void mult_dn(int mu, AFIELD &, const AFIELD &)
downward nearest neighbor hopping term.
Definition: afopr_Clover_dd-tmpl.h:637
AFopr_Clover_dd::real_t
AFIELD::real_t real_t
Definition: afopr_Clover_dd.h:48
AFopr_Clover_dd
Definition: afopr_Clover_dd.h:45
AFopr_Clover_dd::m_fopr_csw
Fopr_CloverTerm * m_fopr_csw
clover term (corelib)
Definition: afopr_Clover_dd.h:73
AFopr_Clover_dd::m_Nstv
int m_Nstv
Definition: afopr_Clover_dd.h:54
AFopr_Clover_dd::set_csw
void set_csw()
set_csw now assumes Dirac repr.
Definition: afopr_Clover_dd-tmpl.h:424
AFopr_Clover_dd::m_mode
std::string m_mode
mult mode
Definition: afopr_Clover_dd.h:71
AFopr_Clover_dd::get_conf
Field * get_conf(void)
returns the pointer to gauge configuration.
Definition: afopr_Clover_dd.h:125
AFopr_Clover_dd::project_chiral
void project_chiral(AFIELD &, const AFIELD &, int ch)
Definition: afopr_Clover_dd-tmpl.h:753
AFopr_Clover_dd::m_Nd
int m_Nd
Definition: afopr_Clover_dd.h:52
AFopr_Clover_dd::mult_dag
void mult_dag(AFIELD &, const AFIELD &)
hermitian conjugate of mult.
Definition: afopr_Clover_dd-tmpl.h:703
AFopr_Clover_dd::mult_xm
void mult_xm(real_t *, real_t *, int)
Definition: afopr_Clover_dd-tmpl.h:1287
AFopr_Clover_dd::m_Nyv
int m_Nyv
Definition: afopr_Clover_dd.h:54
Field_F
Wilson-type fermion field.
Definition: field_F.h:37
AFopr_Clover_dd::m_Ndim
int m_Ndim
Definition: afopr_Clover_dd.h:52
Org::Fopr_CloverTerm
Definition: fopr_CloverTerm_impl.h:55
commonParameters.h
AFopr_Clover_dd::m_Nx
int m_Nx
Definition: afopr_Clover_dd.h:53
Field
Container of Field-type object.
Definition: field.h:46
communicator.h
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
AFopr_Clover_dd::AFopr_Clover_dd
AFopr_Clover_dd(const Parameters &params)
constructor.
Definition: afopr_Clover_dd.h:95
AFopr_Clover_dd::allocator_t
typename AFIELD::template aligned_allocator< char > allocator_t
Definition: afopr_Clover_dd.h:88
AFopr_Clover_dd::m_Nvc
int m_Nvc
Definition: afopr_Clover_dd.h:52
Channel_impl
Definition: channel.h:86
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
AFopr_Clover_dd::mult_gm4
void mult_gm4(AFIELD &, const AFIELD &)
Definition: afopr_Clover_dd-tmpl.h:829