Bridge++  Ver. 2.0.2
afopr_Clover.h
Go to the documentation of this file.
1 
10 #ifndef QXS_AFOPR_CLOVER_INCLUDED
11 #define QXS_AFOPR_CLOVER_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/Fopr/afopr.h"
27 #include "lib/IO/bridgeIO.h"
28 using Bridge::vout;
29 
32 
33 class Field;
34 
40 template<typename AFIELD>
41 class AFopr_Clover : public AFopr<AFIELD>
42 {
43  public:
44  typedef typename AFIELD::real_t real_t;
45  static const std::string class_name;
46 
47  protected:
49  int m_Nx, m_Ny, m_Nz, m_Nt, m_Nst;
51 
54  std::vector<int> m_boundary;
55  std::string m_repr;
56 
58 
61 
62  std::string m_mode;
63 
65 
67 
69 
71 
72  int m_Nsize[4]; // lattice sizes (Nxv in x-direction)
73 
74  int do_comm[4]; // switchs of communication (4=Ndim): (0: n, 1: y).
75  int do_comm_any; // switchs of communication (if any): (0: n, 1: y).
76 
77  std::vector<int> m_bdsize;
78  using allocator_t = typename AFIELD::template aligned_allocator<char>;
80  std::vector<Channel> chsend_up, chrecv_up, chsend_dn, chrecv_dn;
82 
83  public:
85  AFopr_Clover(const Parameters& params) : AFopr<AFIELD>()
86  { init(params); }
87 
90 
92  void set_parameters(const Parameters& params);
93 
95  void set_parameters(real_t CKs, real_t csw, std::vector<int> bc);
96 
98  void get_parameters(Parameters& params) const;
99 
101  void set_config(Field *u);
102 
104  bool needs_convert() { return true; }
105 
107  void convert(AFIELD& v, const Field& w);
108 
110  void reverse(Field& v, const AFIELD& w);
111 
113  void set_mode(std::string mode);
114 
116  std::string get_mode() const;
117 
118  void mult(AFIELD&, const AFIELD&);
119  void mult_dag(AFIELD&, const AFIELD&);
120  void mult_gm5(AFIELD&, const AFIELD&);
121 
122  void mult_up(int mu, AFIELD&, const AFIELD&);
123  void mult_dn(int mu, AFIELD&, const AFIELD&);
124 
126  int field_nin() { return 2 * m_Nc * m_Nd; }
127 
129  int field_nvol() { return m_Nst; }
130 
132  int field_nex() { return 1; }
133 
135  double flop_count() { return flop_count(m_mode); }
136 
138  double flop_count(const std::string mode);
139 
140  private:
142  void init(const Parameters& params);
143 
145  void tidyup();
146 
148  void setup_channels();
149 
151  void set_config_omp(Field *u);
152 
154  void set_config_impl(Field *u);
155 
157  void set_csw();
158 
160  void set_csw_chrot();
161 
163  void mult_csw(real_t *, real_t *);
164 
165  void DdagD(AFIELD&, const AFIELD&);
166  void Ddag(AFIELD&, const AFIELD&);
167  void H(AFIELD&, const AFIELD&);
168  void D(AFIELD&, const AFIELD&);
169 
170  void mult_gm4(AFIELD&, const AFIELD&);
171 
173  void mult_D(AFIELD&, const AFIELD&);
174 
176  void mult_D_alt(AFIELD&, const AFIELD&);
177 
178  void mult_xp(real_t *, real_t *);
179  void mult_xm(real_t *, real_t *);
180  void mult_yp(real_t *, real_t *);
181  void mult_ym(real_t *, real_t *);
182  void mult_zp(real_t *, real_t *);
183  void mult_zm(real_t *, real_t *);
184  void mult_tp(real_t *, real_t *);
185  void mult_tm(real_t *, real_t *);
186 
187  void mult_gm5(real_t *, real_t *);
188 
189  void clear(real_t *);
190 
191  void aypx(real_t, real_t *, real_t *);
192  void gm5_aypx(real_t, real_t *, real_t *);
193 
194 
195 #ifdef USE_FACTORY
196  private:
197  static AFopr<AFIELD> *create_object_with_params(const Parameters& params)
198  { return new AFopr_Clover(params); }
199 
200  public:
201  static bool register_factory()
202  {
203  bool init1 = AFopr<AFIELD>::Factory_params::Register("Clover",
204  create_object_with_params);
205  return init1;
206  }
207 #endif
208 };
209 
210 #endif
AFopr_Clover::mult_dag
void mult_dag(AFIELD &, const AFIELD &)
hermitian conjugate of mult.
Definition: afopr_Clover-tmpl.h:588
bridgeIO.h
AFopr_Clover::m_Nx
int m_Nx
Definition: afopr_Clover.h:49
afield.h
AFopr_Clover::do_comm
int do_comm[4]
Definition: afopr_Clover.h:74
AFopr_Clover::m_Nyv
int m_Nyv
Definition: afopr_Clover.h:50
AFopr_Clover::m_Nstv
int m_Nstv
Definition: afopr_Clover.h:50
AFopr
Definition: afopr.h:48
AFopr_Clover::flop_count
double flop_count()
returns floating operation counts.
Definition: afopr_Clover.h:135
AFopr_Clover::field_nvol
int field_nvol()
returns local volume size parameter.
Definition: afopr_Clover.h:129
communicator_impl.h
Parameters
Class for parameters.
Definition: parameters.h:46
AFopr_Clover::clear
void clear(real_t *)
Definition: afopr_Clover-tmpl.h:869
AFopr_Clover::m_Nsize
int m_Nsize[4]
Definition: afopr_Clover.h:72
AFopr_Clover::m_bdsize
std::vector< int > m_bdsize
Definition: afopr_Clover.h:77
AFopr_Clover::Ddag
void Ddag(AFIELD &, const AFIELD &)
Definition: afopr_Clover-tmpl.h:627
AFopr_Clover::mult_csw
void mult_csw(real_t *, real_t *)
set_csw now assumes Dirac repr.
Definition: afopr_Clover-tmpl.h:703
AFopr_Clover::m_Nt
int m_Nt
Definition: afopr_Clover.h:49
AFopr_Clover::AFopr_Clover
AFopr_Clover(const Parameters &params)
constructor.
Definition: afopr_Clover.h:85
AFopr_Clover::aypx
void aypx(real_t, real_t *, real_t *)
Definition: afopr_Clover-tmpl.h:851
AFopr_Clover::setup_channels
void setup_channels()
setup channels for communication.
Definition: afopr_Clover-tmpl.h:137
AFopr_Clover::D
void D(AFIELD &, const AFIELD &)
Definition: afopr_Clover-tmpl.h:607
AFopr_Clover::mult_up
void mult_up(int mu, AFIELD &, const AFIELD &)
upward nearest neighbor hopping term.
Definition: afopr_Clover-tmpl.h:502
ChannelSet
ChannelSet class for a collection of channels.
Definition: channel.h:148
AFopr_Clover::m_boundary
std::vector< int > m_boundary
pointer to boundary condition
Definition: afopr_Clover.h:54
AFopr_Clover::mult_xm
void mult_xm(real_t *, real_t *)
Definition: afopr_Clover-tmpl.h:953
AFopr_Clover::mult_gm4
void mult_gm4(AFIELD &, const AFIELD &)
Definition: afopr_Clover-tmpl.h:670
AFopr_Clover::m_v2
AFIELD m_v2
Definition: afopr_Clover.h:66
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
AFopr_Clover::field_nex
int field_nex()
returns external size parameter.
Definition: afopr_Clover.h:132
AFopr_Clover::gm5_aypx
void gm5_aypx(real_t, real_t *, real_t *)
AFopr_Clover::m_Ndim
int m_Ndim
Definition: afopr_Clover.h:48
AFopr_Clover::set_config_omp
void set_config_omp(Field *u)
setting gauge configuration (setting omp parallel).
Definition: afopr_Clover-tmpl.h:273
AFopr_Clover::m_Nz
int m_Nz
Definition: afopr_Clover.h:49
Field::real_t
double real_t
Definition: field.h:51
AFopr_Clover::~AFopr_Clover
~AFopr_Clover()
destructor.
Definition: afopr_Clover.h:89
AFopr_Clover::m_U
AFIELD m_U
copied gauge config. with boundary conditions.
Definition: afopr_Clover.h:60
AFopr_Clover::m_Nxv
int m_Nxv
Definition: afopr_Clover.h:50
AFopr_Clover::m_conf
Field * m_conf
original gauge config.
Definition: afopr_Clover.h:59
AFopr_Clover::real_t
AFIELD::real_t real_t
Definition: afopr_Clover.h:44
AFopr_Clover::get_mode
std::string get_mode() const
returns mult mode.
Definition: afopr_Clover-tmpl.h:561
AFopr_Clover::m_Ny
int m_Ny
Definition: afopr_Clover.h:49
AFopr_Clover::chset_recv
ChannelSet chset_recv
Definition: afopr_Clover.h:81
AFopr_Clover::mult_zp
void mult_zp(real_t *, real_t *)
Definition: afopr_Clover-tmpl.h:1167
AFopr_Clover::mult_gm5
void mult_gm5(AFIELD &, const AFIELD &)
multiplies gamma_5 matrix.
Definition: afopr_Clover-tmpl.h:637
AFopr_Clover::set_mode
void set_mode(std::string mode)
setting mult mode.
Definition: afopr_Clover-tmpl.h:548
AFopr_Clover::mult_D_alt
void mult_D_alt(AFIELD &, const AFIELD &)
D mult using mult_xp, etc.
Definition: afopr_Clover-tmpl.h:816
aindex_lex.h
AFopr_Clover::m_Nvc
int m_Nvc
Definition: afopr_Clover.h:48
AFopr_Clover::m_vl
Bridge::VerboseLevel m_vl
verbose level
Definition: afopr_Clover.h:57
fopr_CloverTerm.h
AFopr_Clover::init
void init(const Parameters &params)
initial setup.
Definition: afopr_Clover-tmpl.h:17
AFopr_Clover::m_Nc
int m_Nc
Definition: afopr_Clover.h:48
AFopr_Clover::chsend_dn
std::vector< Channel > chsend_dn
Definition: afopr_Clover.h:80
AFopr_Clover::chsend_up
std::vector< Channel > chsend_up
Definition: afopr_Clover.h:80
AFopr_Clover::field_nin
int field_nin()
returns inner size parameter.
Definition: afopr_Clover.h:126
AFopr_Clover::mult_xp
void mult_xp(real_t *, real_t *)
Definition: afopr_Clover-tmpl.h:885
AFopr_Clover::mult_ym
void mult_ym(real_t *, real_t *)
Definition: afopr_Clover-tmpl.h:1093
AFopr_Clover::set_parameters
void set_parameters(const Parameters &params)
setting parameters by a Parameter object.
Definition: afopr_Clover-tmpl.h:181
AFopr_Clover::m_Ndf
int m_Ndf
Definition: afopr_Clover.h:48
AFopr_Clover::tidyup
void tidyup()
final tidy-up.
Definition: afopr_Clover-tmpl.h:171
AFopr_Clover::mult_tp
void mult_tp(real_t *, real_t *)
Definition: afopr_Clover-tmpl.h:1298
AFopr_Clover::needs_convert
bool needs_convert()
QXS version requires convert of spinor field.
Definition: afopr_Clover.h:104
AFopr_Clover::H
void H(AFIELD &, const AFIELD &)
Definition: afopr_Clover-tmpl.h:842
AFopr_Clover::m_CKs
real_t m_CKs
hopping parameter
Definition: afopr_Clover.h:52
AFopr_Clover::m_mode
std::string m_mode
mult mode
Definition: afopr_Clover.h:62
AFopr_Clover::mult_D
void mult_D(AFIELD &, const AFIELD &)
standard D mult.
Definition: afopr_Clover-tmpl.h:748
AFopr_Clover::set_csw
void set_csw()
set_csw now assumes Dirac repr.
Definition: afopr_Clover-tmpl.h:312
AFopr_Clover::set_config
void set_config(Field *u)
setting gauge configuration (common interface).
Definition: afopr_Clover-tmpl.h:254
AFopr_Clover::mult_zm
void mult_zm(real_t *, real_t *)
Definition: afopr_Clover-tmpl.h:1232
AFopr_Clover::set_csw_chrot
void set_csw_chrot()
set_csw with rotation to chiral repr.
Definition: afopr_Clover-tmpl.h:401
AFopr_Clover::m_Nst
int m_Nst
Definition: afopr_Clover.h:49
AFopr_Clover::m_Nd
int m_Nd
Definition: afopr_Clover.h:48
AFopr_Clover::chset_send
ChannelSet chset_send
Definition: afopr_Clover.h:81
AFopr_Clover::get_parameters
void get_parameters(Parameters &params) const
get parameters via a Parameter object
Definition: afopr_Clover-tmpl.h:241
AFopr_Clover::set_config_impl
void set_config_impl(Field *u)
setting gauge configuration (implementation).
Definition: afopr_Clover-tmpl.h:286
AFopr_Clover::m_fopr_csw
Fopr_CloverTerm * m_fopr_csw
clover term (corelib)
Definition: afopr_Clover.h:64
Field_F
Wilson-type fermion field.
Definition: field_F.h:37
AFopr_Clover::m_T
AFIELD m_T
clover term
Definition: afopr_Clover.h:68
Org::Fopr_CloverTerm
Definition: fopr_CloverTerm_impl.h:55
AFopr_Clover
Definition: afopr_Clover.h:41
AFopr_Clover::chrecv_up
std::vector< Channel > chrecv_up
Definition: afopr_Clover.h:80
commonParameters.h
AFopr_Clover::allocator_t
typename AFIELD::template aligned_allocator< char > allocator_t
Definition: afopr_Clover.h:78
AFopr_Clover::m_repr
std::string m_repr
gamma matrix representation
Definition: afopr_Clover.h:55
AFopr_Clover::do_comm_any
int do_comm_any
Definition: afopr_Clover.h:75
AFopr_Clover::m_csw
real_t m_csw
colver coefficient
Definition: afopr_Clover.h:53
Field
Container of Field-type object.
Definition: field.h:46
afopr.h
AFopr_Clover::mult_tm
void mult_tm(real_t *, real_t *)
Definition: afopr_Clover-tmpl.h:1362
AFopr_Clover::convert
void convert(AFIELD &v, const Field &w)
convert of spinor field.
Definition: afopr_Clover-tmpl.h:480
communicator.h
AFopr_Clover::mult_dn
void mult_dn(int mu, AFIELD &, const AFIELD &)
downward nearest neighbor hopping term.
Definition: afopr_Clover-tmpl.h:525
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
AFopr_Clover::reverse
void reverse(Field &v, const AFIELD &w)
reverse of spinor field.
Definition: afopr_Clover-tmpl.h:491
AFopr_Clover::DdagD
void DdagD(AFIELD &, const AFIELD &)
Definition: afopr_Clover-tmpl.h:616
AFopr_Clover::class_name
static const std::string class_name
Definition: afopr_Clover.h:45
AFopr_Clover::m_w2
Field_F m_w2
Definition: afopr_Clover.h:70
AFopr_Clover::m_w1
Field_F m_w1
Definition: afopr_Clover.h:70
AFopr_Clover::mult_yp
void mult_yp(real_t *, real_t *)
Definition: afopr_Clover-tmpl.h:1023
AFopr_Clover::mult
void mult(AFIELD &, const AFIELD &)
multiplies fermion operator to a given field.
Definition: afopr_Clover-tmpl.h:569
Channel_impl
Definition: channel.h:86
AFopr_Clover::chrecv_dn
std::vector< Channel > chrecv_dn
Definition: afopr_Clover.h:80
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512