Bridge++  Ver. 2.0.2
afopr_Wilson.h
Go to the documentation of this file.
1 
10 #ifndef QXS_AFOPR_WILSON_INCLUDED
11 #define QXS_AFOPR_WILSON_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"
26 #include "lib/IO/bridgeIO.h"
27 using Bridge::vout;
28 
31 
32 class Field;
33 
39 template<typename AFIELD>
40 class AFopr_Wilson : public AFopr<AFIELD>
41 {
42  public:
43  typedef typename AFIELD::real_t real_t;
44  static const std::string class_name;
45 
46  protected:
48  int m_Nx, m_Ny, m_Nz, m_Nt, m_Nst;
50 
52  std::vector<int> m_boundary;
53  std::string m_repr;
54 
56 
59 
60  std::string m_mode;
61 
63 
64  int m_Nsize[4]; // lattice sizes (Nxv in x-direction)
65 
66  int do_comm[4]; // switchs of communication (4=Ndim): (0: n, 1: y).
67  int do_comm_any; // switchs of communication (if any): (0: n, 1: y).
68 
69  std::vector<int> m_bdsize;
70  using allocator_t = typename AFIELD::template aligned_allocator<char>;
72  std::vector<Channel> chsend_up, chrecv_up, chsend_dn, chrecv_dn;
74 
75  public:
77  AFopr_Wilson(const Parameters& params) : AFopr<AFIELD>()
78  { init(params); }
79 
82 
84  void set_parameters(const Parameters& params);
85 
87  void set_parameters(real_t CKs, std::vector<int> bc);
88 
90  void get_parameters(Parameters& params) const;
91 
93  void set_config(Field *u);
94 
96  bool needs_convert() { return true; }
97 
99  void convert(AFIELD& v, const Field& w);
100 
102  void reverse(Field& v, const AFIELD& w);
103 
105  void set_mode(std::string mode);
106 
108  std::string get_mode() const;
109 
110  void mult(AFIELD&, const AFIELD&);
111  void mult_dag(AFIELD&, const AFIELD&);
112  void mult_gm5(AFIELD&, const AFIELD&);
113 
114  void mult_up(int mu, AFIELD&, const AFIELD&);
115  void mult_dn(int mu, AFIELD&, const AFIELD&);
116 
118  int field_nin() { return 2 * m_Nc * m_Nd; }
119 
121  int field_nvol() { return m_Nst; }
122 
124  int field_nex() { return 1; }
125 
127  double flop_count() { return flop_count(m_mode); }
128 
130  double flop_count(const std::string mode);
131 
132  private:
134  void init(const Parameters& params);
135 
137  void tidyup();
138 
140  void setup_channels();
141 
143  void set_config_omp(Field *u);
144 
146  void set_config_impl(Field *u);
147 
148  void DdagD(AFIELD&, const AFIELD&);
149  void Ddag(AFIELD&, const AFIELD&);
150  void H(AFIELD&, const AFIELD&);
151  void D(AFIELD&, const AFIELD&);
152 
153  void mult_gm4(AFIELD&, const AFIELD&);
154 
156  void mult_D(AFIELD&, const AFIELD&);
157 
159  void mult_D_alt(AFIELD&, const AFIELD&);
160 
161  void mult_xp(real_t *, real_t *);
162  void mult_xm(real_t *, real_t *);
163  void mult_yp(real_t *, real_t *);
164  void mult_ym(real_t *, real_t *);
165  void mult_zp(real_t *, real_t *);
166  void mult_zm(real_t *, real_t *);
167  void mult_tp(real_t *, real_t *);
168  void mult_tm(real_t *, real_t *);
169 
170  void clear(real_t *);
171 
172  void aypx(real_t, real_t *, real_t *);
173  void gm5_aypx(real_t, real_t *, real_t *);
174 
175 
176 #ifdef USE_FACTORY
177  private:
178  static AFopr<AFIELD> *create_object_with_params(const Parameters& params)
179  { return new AFopr_Wilson(params); }
180 
181  public:
182  static bool register_factory()
183  {
184  bool init1 = AFopr<AFIELD>::Factory_params::Register("Wilson",
185  create_object_with_params);
186  return init1;
187  }
188 #endif
189 };
190 
191 #endif
AFopr_Wilson::mult_xm
void mult_xm(real_t *, real_t *)
Definition: afopr_Wilson-tmpl.h:684
AFopr_Wilson::m_Ndf
int m_Ndf
Definition: afopr_Wilson.h:47
bridgeIO.h
AFopr_Wilson::mult_tm
void mult_tm(real_t *, real_t *)
Definition: afopr_Wilson-tmpl.h:1093
afield.h
AFopr_Wilson::m_mode
std::string m_mode
mult mode
Definition: afopr_Wilson.h:60
AFopr_Wilson::mult_xp
void mult_xp(real_t *, real_t *)
Definition: afopr_Wilson-tmpl.h:616
AFopr_Wilson::m_Nx
int m_Nx
Definition: afopr_Wilson.h:48
AFopr
Definition: afopr.h:48
AFopr_Wilson::clear
void clear(real_t *)
Definition: afopr_Wilson-tmpl.h:600
AFopr_Wilson::DdagD
void DdagD(AFIELD &, const AFIELD &)
Definition: afopr_Wilson-tmpl.h:416
AFopr_Wilson::m_Nxv
int m_Nxv
Definition: afopr_Wilson.h:49
AFopr_Wilson::field_nex
int field_nex()
returns external size parameter.
Definition: afopr_Wilson.h:124
AFopr_Wilson::mult_dag
void mult_dag(AFIELD &, const AFIELD &)
hermitian conjugate of mult.
Definition: afopr_Wilson-tmpl.h:389
communicator_impl.h
Parameters
Class for parameters.
Definition: parameters.h:46
AFopr_Wilson::chrecv_dn
std::vector< Channel > chrecv_dn
Definition: afopr_Wilson.h:72
AFopr_Wilson::mult_D
void mult_D(AFIELD &, const AFIELD &)
standard D mult.
Definition: afopr_Wilson-tmpl.h:487
AFopr_Wilson::set_mode
void set_mode(std::string mode)
setting mult mode.
Definition: afopr_Wilson-tmpl.h:349
AFopr_Wilson::mult_D_alt
void mult_D_alt(AFIELD &, const AFIELD &)
D mult using mult_xp, etc.
Definition: afopr_Wilson-tmpl.h:549
AFopr_Wilson::mult_gm5
void mult_gm5(AFIELD &, const AFIELD &)
multiplies gamma_5 matrix.
Definition: afopr_Wilson-tmpl.h:437
AFopr_Wilson::mult_dn
void mult_dn(int mu, AFIELD &, const AFIELD &)
downward nearest neighbor hopping term.
Definition: afopr_Wilson-tmpl.h:326
AFopr_Wilson::allocator_t
typename AFIELD::template aligned_allocator< char > allocator_t
Definition: afopr_Wilson.h:70
AFopr_Wilson::chset_recv
ChannelSet chset_recv
Definition: afopr_Wilson.h:73
AFopr_Wilson::mult_zm
void mult_zm(real_t *, real_t *)
Definition: afopr_Wilson-tmpl.h:963
AFopr_Wilson::m_Ndim
int m_Ndim
Definition: afopr_Wilson.h:47
AFopr_Wilson::set_parameters
void set_parameters(const Parameters &params)
setting parameters by a Parameter object.
Definition: afopr_Wilson-tmpl.h:169
ChannelSet
ChannelSet class for a collection of channels.
Definition: channel.h:148
AFopr_Wilson::m_Nt
int m_Nt
Definition: afopr_Wilson.h:48
AFopr_Wilson::reverse
void reverse(Field &v, const AFIELD &w)
reverse of spinor field.
Definition: afopr_Wilson-tmpl.h:292
AFopr_Wilson::m_CKs
real_t m_CKs
hopping parameter.
Definition: afopr_Wilson.h:51
AFopr_Wilson::mult_yp
void mult_yp(real_t *, real_t *)
Definition: afopr_Wilson-tmpl.h:754
AFopr_Wilson::mult_up
void mult_up(int mu, AFIELD &, const AFIELD &)
upward nearest neighbor hopping term.
Definition: afopr_Wilson-tmpl.h:303
AFopr_Wilson::chrecv_up
std::vector< Channel > chrecv_up
Definition: afopr_Wilson.h:72
AFopr_Wilson::~AFopr_Wilson
~AFopr_Wilson()
destructor.
Definition: afopr_Wilson.h:81
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
AFopr_Wilson::m_Nd
int m_Nd
Definition: afopr_Wilson.h:47
AFopr_Wilson::init
void init(const Parameters &params)
initial setup.
Definition: afopr_Wilson-tmpl.h:17
AFopr_Wilson::get_parameters
void get_parameters(Parameters &params) const
get parameters via a Parameter object
Definition: afopr_Wilson-tmpl.h:219
Field::real_t
double real_t
Definition: field.h:51
AFopr_Wilson::m_bdsize
std::vector< int > m_bdsize
Definition: afopr_Wilson.h:69
AFopr_Wilson::m_Ny
int m_Ny
Definition: afopr_Wilson.h:48
AFopr_Wilson::m_Nyv
int m_Nyv
Definition: afopr_Wilson.h:49
AFopr_Wilson::set_config
void set_config(Field *u)
setting gauge configuration (common interface).
Definition: afopr_Wilson-tmpl.h:231
AFopr_Wilson::H
void H(AFIELD &, const AFIELD &)
Definition: afopr_Wilson-tmpl.h:573
AFopr_Wilson::Ddag
void Ddag(AFIELD &, const AFIELD &)
Definition: afopr_Wilson-tmpl.h:427
AFopr_Wilson::needs_convert
bool needs_convert()
QXS version requires convert of spinor field.
Definition: afopr_Wilson.h:96
aindex_lex.h
AFopr_Wilson::m_repr
std::string m_repr
gamma matrix representation
Definition: afopr_Wilson.h:53
AFopr_Wilson::setup_channels
void setup_channels()
setup channels for communication.
Definition: afopr_Wilson-tmpl.h:124
AFopr_Wilson::chsend_dn
std::vector< Channel > chsend_dn
Definition: afopr_Wilson.h:72
AFopr_Wilson::m_U
AFIELD m_U
copied gauge config. with boundary conditions.
Definition: afopr_Wilson.h:58
AFopr_Wilson::m_Nsize
int m_Nsize[4]
Definition: afopr_Wilson.h:64
AFopr_Wilson::mult_gm4
void mult_gm4(AFIELD &, const AFIELD &)
Definition: afopr_Wilson-tmpl.h:454
AFopr_Wilson::m_vl
Bridge::VerboseLevel m_vl
verbose level
Definition: afopr_Wilson.h:55
AFopr_Wilson::convert
void convert(AFIELD &v, const Field &w)
convert of spinor field.
Definition: afopr_Wilson-tmpl.h:281
AFopr_Wilson
Definition: afopr_Wilson.h:40
AFopr_Wilson::do_comm_any
int do_comm_any
Definition: afopr_Wilson.h:67
AFopr_Wilson::aypx
void aypx(real_t, real_t *, real_t *)
Definition: afopr_Wilson-tmpl.h:582
AFopr_Wilson::mult_tp
void mult_tp(real_t *, real_t *)
Definition: afopr_Wilson-tmpl.h:1029
AFopr_Wilson::field_nvol
int field_nvol()
returns local volume size parameter.
Definition: afopr_Wilson.h:121
AFopr_Wilson::real_t
AFIELD::real_t real_t
Definition: afopr_Wilson.h:43
AFopr_Wilson::gm5_aypx
void gm5_aypx(real_t, real_t *, real_t *)
AFopr_Wilson::class_name
static const std::string class_name
Definition: afopr_Wilson.h:44
AFopr_Wilson::do_comm
int do_comm[4]
Definition: afopr_Wilson.h:66
AFopr_Wilson::m_v2
AFIELD m_v2
Definition: afopr_Wilson.h:62
AFopr_Wilson::mult_ym
void mult_ym(real_t *, real_t *)
Definition: afopr_Wilson-tmpl.h:824
AFopr_Wilson::D
void D(AFIELD &, const AFIELD &)
Definition: afopr_Wilson-tmpl.h:408
AFopr_Wilson::m_Nc
int m_Nc
Definition: afopr_Wilson.h:47
AFopr_Wilson::chset_send
ChannelSet chset_send
Definition: afopr_Wilson.h:73
AFopr_Wilson::set_config_omp
void set_config_omp(Field *u)
setting gauge configuration (setting omp parallel).
Definition: afopr_Wilson-tmpl.h:250
AFopr_Wilson::chsend_up
std::vector< Channel > chsend_up
Definition: afopr_Wilson.h:72
AFopr_Wilson::m_Nstv
int m_Nstv
Definition: afopr_Wilson.h:49
AFopr_Wilson::set_config_impl
void set_config_impl(Field *u)
setting gauge configuration (implementation).
Definition: afopr_Wilson-tmpl.h:263
AFopr_Wilson::tidyup
void tidyup()
final tidy-up.
Definition: afopr_Wilson-tmpl.h:159
AFopr_Wilson::m_conf
Field * m_conf
original gauge config.
Definition: afopr_Wilson.h:57
AFopr_Wilson::flop_count
double flop_count()
returns floating operation counts.
Definition: afopr_Wilson.h:127
AFopr_Wilson::m_Nz
int m_Nz
Definition: afopr_Wilson.h:48
commonParameters.h
AFopr_Wilson::get_mode
std::string get_mode() const
returns mult mode.
Definition: afopr_Wilson-tmpl.h:362
Field
Container of Field-type object.
Definition: field.h:46
afopr.h
AFopr_Wilson::m_Nst
int m_Nst
Definition: afopr_Wilson.h:48
communicator.h
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
AFopr_Wilson::mult
void mult(AFIELD &, const AFIELD &)
multiplies fermion operator to a given field.
Definition: afopr_Wilson-tmpl.h:370
AFopr_Wilson::field_nin
int field_nin()
returns inner size parameter.
Definition: afopr_Wilson.h:118
AFopr_Wilson::m_boundary
std::vector< int > m_boundary
pointer to boundary condition
Definition: afopr_Wilson.h:52
AFopr_Wilson::mult_zp
void mult_zp(real_t *, real_t *)
Definition: afopr_Wilson-tmpl.h:898
AFopr_Wilson::AFopr_Wilson
AFopr_Wilson(const Parameters &params)
constructor.
Definition: afopr_Wilson.h:77
AFopr_Wilson::m_Nvc
int m_Nvc
Definition: afopr_Wilson.h:47
Channel_impl
Definition: channel.h:86
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512