Bridge++  Ver. 2.0.2
afopr_Wilson_eo.h
Go to the documentation of this file.
1 
10 #ifndef QXS_AFOPR_WILSON_EO_INCLUDED
11 #define QXS_AFOPR_WILSON_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"
24 #include "lib/IO/bridgeIO.h"
25 using Bridge::vout;
26 
29 
30 class Field;
31 
37 template<typename AFIELD>
38 class AFopr_Wilson_eo : public AFopr<AFIELD>
39 {
40  public:
41  typedef typename AFIELD::real_t real_t;
42  static const std::string class_name;
43 
44  protected:
45  int m_Nc, m_Nd, m_Ndf, m_Nvc;
46  int m_Nst, m_Nx, m_Ny, m_Nz, m_Nt;
47  int m_Ndim;
48  int m_Nx2, m_Nst2;
50 
52  std::vector<int> m_boundary;
53  std::string m_repr;
55 
56  std::vector<int> m_Leo;
57 
62 
63  std::string m_mode;
64 
67 
68  int m_Nsize[4]; // lattice sizes (Nx2v in x-direction)
69 
70  int do_comm[4]; // switchs of communication (4=Ndim): (0: n, 1: y).
71  int do_comm_any; // switchs of communication (if any): (0: n, 1: y).
72 
73  std::vector<int> m_bdsize;
74  using allocator_t = typename AFIELD::template aligned_allocator<char>;
76  std::vector<Channel> chsend_up, chrecv_up, chsend_dn, chrecv_dn;
78 
79  public:
81  AFopr_Wilson_eo(const Parameters& params)
82  {
83  init(params);
84  }
85 
88 
90  void set_parameters(const Parameters& params);
91 
93  void set_parameters(real_t CKs, std::vector<int> bc);
94 
96  void get_parameters(Parameters& params) const;
97 
99  void set_config(Field *u);
100 
102  void set_config_omp(Field *u);
103 
105  void set_config_impl(Field *u);
106 
108  void set_mode(std::string mode);
109 
111  std::string get_mode() const { return m_mode; }
112 
113  void mult(AFIELD&, const AFIELD&);
114  void mult_dag(AFIELD&, const AFIELD&);
115  void mult_gm5(AFIELD&, const AFIELD&);
116 
117  void mult_gm4(AFIELD&, const AFIELD&);
118 
119  void mult(AFIELD&, const AFIELD&,
120  const std::string mode);
121 
122  void DdagD(AFIELD&, const AFIELD&);
123  void Ddag(AFIELD&, const AFIELD&);
124  void D(AFIELD&, const AFIELD&);
125 
126  void aypx(real_t, AFIELD&, const AFIELD&);
127 
129  void Meo(AFIELD&, const AFIELD&, const int ieo);
130 
132  void Meo(AFIELD&, const AFIELD&, const AFIELD&,
133  const int ieo, const int iflag);
134 
136  void mult_Meo(AFIELD&, const AFIELD&, const AFIELD&,
137  const int ieo, const int iflag);
138 
140  void mult_Meo_alt(AFIELD&, const AFIELD&, const AFIELD&,
141  const int ieo, const int iflag);
142 
144  void mult_Meo_qxs(AFIELD&, const AFIELD&, const AFIELD&,
145  const int ieo, const int iflag);
146 
148  int field_nin() { return 2 * m_Nc * m_Nd; }
149 
151  int field_nvol() { return m_Nst2; }
152 
154  int field_nex() { return 1; }
155 
157  double flop_count() { return flop_count(m_mode); }
158 
160  double flop_count(const std::string mode);
161 
163  bool needs_convert() { return true; }
164 
166  void convert(AFIELD&, const Field&);
167 
169  void reverse(Field&, const AFIELD&);
170 
171  private:
173  void init(const Parameters& params);
174 
176  void tidyup();
177 
179  void setup_channels();
180 
181  void mult_gm4(real_t *, real_t *);
182 
183  void clear(real_t *);
184 
185  void aypx(real_t, real_t *, real_t *);
186  void scal(real_t *, const real_t);
187 
188  void clear(real_t *, const int, const int);
189 
190  void aypx(real_t, real_t *, real_t *, const int, const int);
191  void scal(real_t *, const real_t, const int, const int);
192 
193 
194 #ifdef USE_FACTORY
195  private:
196  static AFopr<AFIELD> *create_object_with_params(const Parameters& params)
197  { return new AFopr_Wilson_eo(params); }
198 
199  public:
200  static bool register_factory()
201  {
202  bool init1 = AFopr<AFIELD>::Factory_params::Register("Wilson_eo",
203  create_object_with_params);
204  return init1;
205  }
206 #endif
207 };
208 
209 #endif
AFopr_Wilson_eo::m_conf
Field * m_conf
original gauge configuration
Definition: afopr_Wilson_eo.h:59
AFopr_Wilson_eo::m_Nst2
int m_Nst2
Definition: afopr_Wilson_eo.h:48
AFopr_Wilson_eo::chrecv_up
std::vector< Channel > chrecv_up
Definition: afopr_Wilson_eo.h:76
bridgeIO.h
AFopr_Wilson_eo::D
void D(AFIELD &, const AFIELD &)
Definition: afopr_Wilson_eo-tmpl.h:502
afield.h
AFopr_Wilson_eo::setup_channels
void setup_channels()
setup channels for communication.
Definition: afopr_Wilson_eo-tmpl.h:154
AFopr_Wilson_eo::m_v1
AFIELD m_v1
Definition: afopr_Wilson_eo.h:65
AFopr
Definition: afopr.h:48
AFopr_Wilson_eo::field_nin
int field_nin()
returns inner size parameter.
Definition: afopr_Wilson_eo.h:148
AFopr_Wilson_eo::aypx
void aypx(real_t, AFIELD &, const AFIELD &)
Definition: afopr_Wilson_eo-tmpl.h:511
AFopr_Wilson_eo::clear
void clear(real_t *)
Definition: afopr_Wilson_eo-tmpl.h:630
AFopr_Wilson_eo::m_Nx2
int m_Nx2
Definition: afopr_Wilson_eo.h:48
communicator_impl.h
Parameters
Class for parameters.
Definition: parameters.h:46
AFopr_Wilson_eo::init
void init(const Parameters &params)
initial setup.
Definition: afopr_Wilson_eo-tmpl.h:17
AFopr_Wilson_eo::chrecv_dn
std::vector< Channel > chrecv_dn
Definition: afopr_Wilson_eo.h:76
AFopr_Wilson_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.
AFopr_Wilson_eo::m_bdsize
std::vector< int > m_bdsize
Definition: afopr_Wilson_eo.h:73
AFopr_Wilson_eo::mult
void mult(AFIELD &, const AFIELD &)
multiplies fermion operator to a given field.
Definition: afopr_Wilson_eo-tmpl.h:367
AFopr_Wilson_eo::DdagD
void DdagD(AFIELD &, const AFIELD &)
Definition: afopr_Wilson_eo-tmpl.h:479
AFopr_Wilson_eo::m_Nx
int m_Nx
Definition: afopr_Wilson_eo.h:46
AFopr_Wilson_eo::Ddag
void Ddag(AFIELD &, const AFIELD &)
Definition: afopr_Wilson_eo-tmpl.h:490
AFopr_Wilson_eo::class_name
static const std::string class_name
Definition: afopr_Wilson_eo.h:42
AFopr_Wilson_eo::m_Ndf
int m_Ndf
Definition: afopr_Wilson_eo.h:45
ChannelSet
ChannelSet class for a collection of channels.
Definition: channel.h:148
AFopr_Wilson_eo::m_repr
std::string m_repr
gamma matrix representation
Definition: afopr_Wilson_eo.h:53
AFopr_Wilson_eo::m_Nst2v
int m_Nst2v
Definition: afopr_Wilson_eo.h:49
AFopr_Wilson_eo::m_Ueo
AFIELD m_Ueo
gauge config in even-odd index
Definition: afopr_Wilson_eo.h:61
AFopr_Wilson_eo::m_vl
Bridge::VerboseLevel m_vl
verbose level
Definition: afopr_Wilson_eo.h:54
AFopr_Wilson_eo::scal
void scal(real_t *, const real_t)
Definition: afopr_Wilson_eo-tmpl.h:650
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
AFopr_Wilson_eo::field_nvol
int field_nvol()
returns local volume size parameter.
Definition: afopr_Wilson_eo.h:151
AFopr_Wilson_eo::set_mode
void set_mode(std::string mode)
setting mult mode.
Definition: afopr_Wilson_eo-tmpl.h:354
AFopr_Wilson_eo::m_v2
AFIELD m_v2
working field.
Definition: afopr_Wilson_eo.h:65
AFopr_Wilson_eo::mult_Meo
void mult_Meo(AFIELD &, const AFIELD &, const AFIELD &, const int ieo, const int iflag)
Meo implementation: standard.
Field::real_t
double real_t
Definition: field.h:51
AFopr_Wilson_eo::m_Ndim
int m_Ndim
Definition: afopr_Wilson_eo.h:47
AFopr_Wilson_eo::real_t
AFIELD::real_t real_t
Definition: afopr_Wilson_eo.h:41
AFopr_Wilson_eo::set_config
void set_config(Field *u)
setting gauge configuration (common interface).
Definition: afopr_Wilson_eo-tmpl.h:264
AFopr_Wilson_eo::set_parameters
void set_parameters(const Parameters &params)
setting parameters by a Parameter object.
Definition: afopr_Wilson_eo-tmpl.h:198
AFopr_Wilson_eo::m_Nyv
int m_Nyv
Definition: afopr_Wilson_eo.h:49
AFopr_Wilson_eo::m_Nz
int m_Nz
Definition: afopr_Wilson_eo.h:46
AFopr_Wilson_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_Wilson_eo-tmpl.h:543
AFopr_Wilson_eo::Meo
void Meo(AFIELD &, const AFIELD &, const int ieo)
Fermion matrix with ieo = 0: even <– odd, 1: odd <– even.
Definition: afopr_Wilson_eo-tmpl.h:524
aindex_eo.h
AFopr_Wilson_eo::m_Nvc
int m_Nvc
Definition: afopr_Wilson_eo.h:45
AFopr_Wilson_eo::m_mode
std::string m_mode
mult mode
Definition: afopr_Wilson_eo.h:63
AFopr_Wilson_eo::m_z1
AFIELD m_z1
lexical field: used in convert/reverse.
Definition: afopr_Wilson_eo.h:66
AFopr_Wilson_eo::m_boundary
std::vector< int > m_boundary
pointer to boundary condition
Definition: afopr_Wilson_eo.h:52
AFopr_Wilson_eo::m_Leo
std::vector< int > m_Leo
Leo = 0 (even site) or 1 (odd site).
Definition: afopr_Wilson_eo.h:56
AFopr_Wilson_eo::convert
void convert(AFIELD &, const Field &)
convert Field to AField for this class.
Definition: afopr_Wilson_eo-tmpl.h:332
AFopr_Wilson_eo::AFopr_Wilson_eo
AFopr_Wilson_eo(const Parameters &params)
constructor.
Definition: afopr_Wilson_eo.h:81
AFopr_Wilson_eo::do_comm_any
int do_comm_any
Definition: afopr_Wilson_eo.h:71
AFopr_Wilson_eo::field_nex
int field_nex()
returns external size parameter.
Definition: afopr_Wilson_eo.h:154
AFopr_Wilson_eo::do_comm
int do_comm[4]
Definition: afopr_Wilson_eo.h:70
AFopr_Wilson_eo::m_Ny
int m_Ny
Definition: afopr_Wilson_eo.h:46
AFopr_Wilson_eo::chset_send
ChannelSet chset_send
Definition: afopr_Wilson_eo.h:77
AFopr_Wilson_eo::chset_recv
ChannelSet chset_recv
Definition: afopr_Wilson_eo.h:77
AFopr_Wilson_eo::m_Nsize
int m_Nsize[4]
Definition: afopr_Wilson_eo.h:68
AFopr_Wilson_eo::chsend_dn
std::vector< Channel > chsend_dn
Definition: afopr_Wilson_eo.h:76
AFopr_Wilson_eo::mult_gm4
void mult_gm4(AFIELD &, const AFIELD &)
Definition: afopr_Wilson_eo-tmpl.h:417
AFopr_Wilson_eo::mult_dag
void mult_dag(AFIELD &, const AFIELD &)
hermitian conjugate of mult.
Definition: afopr_Wilson_eo-tmpl.h:384
AFopr_Wilson_eo::m_Ulex
AFIELD m_Ulex
converted gauge config with boundary conditions
Definition: afopr_Wilson_eo.h:60
AFopr_Wilson_eo::tidyup
void tidyup()
final tidy-up.
Definition: afopr_Wilson_eo-tmpl.h:188
AFopr_Wilson_eo::~AFopr_Wilson_eo
~AFopr_Wilson_eo()
destructor.
Definition: afopr_Wilson_eo.h:87
AFopr_Wilson_eo::m_Nc
int m_Nc
Definition: afopr_Wilson_eo.h:45
commonParameters.h
AFopr_Wilson_eo::m_Nt
int m_Nt
Definition: afopr_Wilson_eo.h:46
AFopr_Wilson_eo::m_CKs
real_t m_CKs
hopping parameter.
Definition: afopr_Wilson_eo.h:51
Field
Container of Field-type object.
Definition: field.h:46
AFopr_Wilson_eo::m_Nst
int m_Nst
Definition: afopr_Wilson_eo.h:46
AFopr_Wilson_eo::chsend_up
std::vector< Channel > chsend_up
Definition: afopr_Wilson_eo.h:76
afopr.h
AFopr_Wilson_eo::get_mode
std::string get_mode() const
returns mult mode.
Definition: afopr_Wilson_eo.h:111
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
AFopr_Wilson_eo::set_config_impl
void set_config_impl(Field *u)
setting gauge configuration (implementation).
Definition: afopr_Wilson_eo-tmpl.h:296
AFopr_Wilson_eo::needs_convert
bool needs_convert()
field convert is necessary in this implementation.
Definition: afopr_Wilson_eo.h:163
AFopr_Wilson_eo::flop_count
double flop_count()
returns floating operation counts.
Definition: afopr_Wilson_eo.h:157
AFopr_Wilson_eo::reverse
void reverse(Field &, const AFIELD &)
reverse AField to Field.
Definition: afopr_Wilson_eo-tmpl.h:343
AFopr_Wilson_eo::set_config_omp
void set_config_omp(Field *u)
setting gauge configuration (setting omp parallel).
Definition: afopr_Wilson_eo-tmpl.h:283
AFopr_Wilson_eo::m_Nx2v
int m_Nx2v
Definition: afopr_Wilson_eo.h:49
AFopr_Wilson_eo::m_Nd
int m_Nd
Definition: afopr_Wilson_eo.h:45
Channel_impl
Definition: channel.h:86
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
AFopr_Wilson_eo::m_index
AIndex_eo< real_t, AFIELD::IMPL > m_index
Definition: afopr_Wilson_eo.h:58
AFopr_Wilson_eo
Definition: afopr_Wilson_eo.h:38
AFopr_Wilson_eo::mult_gm5
void mult_gm5(AFIELD &, const AFIELD &)
multiplies gamma_5 matrix.
Definition: afopr_Wilson_eo-tmpl.h:402
AIndex_eo< real_t, AFIELD::IMPL >
AFopr_Wilson_eo::allocator_t
typename AFIELD::template aligned_allocator< char > allocator_t
Definition: afopr_Wilson_eo.h:74
AFopr_Wilson_eo::get_parameters
void get_parameters(Parameters &params) const
get parameters via a Parameter object
Definition: afopr_Wilson_eo-tmpl.h:252