Bridge++  Ver. 2.0.2
afopr_Staggered_eo.h
Go to the documentation of this file.
1 
10 #ifndef QXS_AFOPR_STAGGERED_EO_INCLUDED
11 #define QXS_AFOPR_STAGGERED_EO_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 
34 
41 template<typename AFIELD>
42 class AFopr_Staggered_eo : public AFopr<AFIELD>
43 {
44  public:
45  typedef typename AFIELD::real_t real_t;
46  static const std::string class_name;
47 
48  private:
50  int m_Nx, m_Ny, m_Nz, m_Nt, m_Nst;
51  int m_Nx2, m_Nst2;
53 
55  std::vector<int> m_boundary;
57 
58  std::vector<int> m_Leo;
59 
62 
65 
67 
68  std::string m_mode;
69 
72 
73  int do_comm[4];
75 
76  std::vector<int> m_Nbdsize;
77  using allocator_t = typename AFIELD::template aligned_allocator<char>;
79  std::vector<Channel> chsend_up, chrecv_up, chsend_dn, chrecv_dn;
81 
82  int m_Nsize[4];
83 
84  public:
87  { init(params); }
88 
91 
93  void set_parameters(const Parameters& params);
94 
96  void set_parameters(const real_t mq, const std::vector<int> bc);
97 
99  void get_parameters(Parameters& params) const;
100 
102  void set_config(Field *U);
103 
104  bool needs_convert() { return false; }
105 
106  void set_mode(std::string mode);
107 
108  std::string get_mode() const { return m_mode; }
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(AFIELD&, const AFIELD&, const std::string mode);
115  void mult_dag(AFIELD&, const AFIELD&, const std::string mode);
116 
117  void mult_gm5(AFIELD&);
118 
119  void normalize_fprop(AFIELD& v);
120 
121  void normalize_fopr(AFIELD& v);
122 
123  int field_nvol() { return m_Nst2; }
124  int field_nin() { return m_Nvc; }
125  int field_nex() { return 1; }
126 
128  double flop_count();
129 
131  double flop_count(const std::string mode);
132 
133  private:
134  void init(const Parameters& params);
135  void tidyup();
136 
137  void set_staggered_phase();
138 
139  void setup_channels();
140 
142  void set_config_omp(Field *u);
143 
145  void set_config_impl(Field *u);
146 
147  void D(AFIELD&, const AFIELD&);
148  void Ddag(AFIELD&, const AFIELD&);
149  void DdagD(AFIELD&, const AFIELD&);
150  void H(AFIELD&, const AFIELD&);
151 
152  void Meo(AFIELD&, const AFIELD&, int ieo);
153  void Meo(AFIELD&, const AFIELD&, const AFIELD&,
154  int ieo, int iflag);
155 
156  void mult_Meo_qxs(AFIELD&, const AFIELD&, const AFIELD&,
157  int ieo, int iflag);
158  void mult_Meo_alt(AFIELD&, const AFIELD&, const AFIELD&,
159  int ieo, int iflag);
160 
161  void clear(real_t *);
162 
163  void axpby(real_t, real_t *, real_t, real_t *);
164 
165  void mult_up(int mu, AFIELD&, const AFIELD&);
166  void mult_dn(int mu, AFIELD&, const AFIELD&);
167 
168  void mult_up(int mu, AFIELD&, const AFIELD&, int ieo);
169  void mult_dn(int mu, AFIELD&, const AFIELD&, int ieo);
170 
171 
172 #ifdef USE_FACTORY
173  private:
174  static AFopr<AFIELD> *create_object_with_params(const Parameters& params)
175  { return new AFopr_Staggered_eo(params); }
176 
177  public:
178  static bool register_factory()
179  {
180  bool init1 = AFopr<AFIELD>::Factory_params::Register("Staggered_eo",
181  create_object_with_params);
182  return init1;
183  }
184 #endif
185 };
186 #endif
AFopr_Staggered_eo::AFopr_Staggered_eo
AFopr_Staggered_eo(const Parameters &params)
constructor.
Definition: afopr_Staggered_eo.h:86
AFopr_Staggered_eo::m_vl
Bridge::VerboseLevel m_vl
verbose level
Definition: afopr_Staggered_eo.h:56
bridgeIO.h
AFopr_Staggered_eo::m_Nc
int m_Nc
Definition: afopr_Staggered_eo.h:49
AFopr_Staggered_eo::chsend_dn
std::vector< Channel > chsend_dn
Definition: afopr_Staggered_eo.h:79
AFopr_Staggered_eo::m_Nx2
int m_Nx2
Definition: afopr_Staggered_eo.h:51
AFopr_Staggered_eo::set_mode
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Definition: afopr_Staggered_eo-tmpl.h:400
AFopr_Staggered_eo::m_Ndf
int m_Ndf
Definition: afopr_Staggered_eo.h:49
AFopr_Staggered_eo
Staggered_eo fermion operator.
Definition: afopr_Staggered_eo.h:42
AFopr
Definition: afopr.h:48
AFopr_Staggered_eo::set_config_omp
void set_config_omp(Field *u)
setting gauge configuration (setting omp parallel).
Definition: afopr_Staggered_eo-tmpl.h:323
AFopr_Staggered_eo::flop_count
double flop_count()
returns floating operation counts.
Definition: afopr_Staggered_eo-tmpl.h:814
communicator_impl.h
Parameters
Class for parameters.
Definition: parameters.h:46
AFopr_Staggered_eo::mult_Meo_qxs
void mult_Meo_qxs(AFIELD &, const AFIELD &, const AFIELD &, int ieo, int iflag)
Definition: afopr_Staggered_eo-tmpl.h:594
AFopr_Staggered_eo::~AFopr_Staggered_eo
~AFopr_Staggered_eo()
destructor.
Definition: afopr_Staggered_eo.h:90
shiftAField_eo.h
AFopr_Staggered_eo::set_config_impl
void set_config_impl(Field *u)
setting gauge configuration (implementation).
Definition: afopr_Staggered_eo-tmpl.h:336
AFopr_Staggered_eo::normalize_fopr
void normalize_fopr(AFIELD &v)
normalize propagator if necessary (default: do nothing)
Definition: afopr_Staggered_eo-tmpl.h:380
AFopr_Staggered_eo::mult_Meo_alt
void mult_Meo_alt(AFIELD &, const AFIELD &, const AFIELD &, int ieo, int iflag)
Definition: afopr_Staggered_eo-tmpl.h:670
AFopr_Staggered_eo::m_Nz
int m_Nz
Definition: afopr_Staggered_eo.h:50
AFopr_Staggered_eo::m_Ny
int m_Ny
Definition: afopr_Staggered_eo.h:50
AFopr_Staggered_eo::m_Ulex
AFIELD m_Ulex
converted lexical gauge field
Definition: afopr_Staggered_eo.h:64
ChannelSet
ChannelSet class for a collection of channels.
Definition: channel.h:148
AFopr_Staggered_eo::class_name
static const std::string class_name
Definition: afopr_Staggered_eo.h:46
AFopr_Staggered_eo::real_t
AFIELD::real_t real_t
Definition: afopr_Staggered_eo.h:45
AFopr_Staggered_eo::Ddag
void Ddag(AFIELD &, const AFIELD &)
Definition: afopr_Staggered_eo-tmpl.h:557
AFopr_Staggered_eo::m_Nsize
int m_Nsize[4]
lattice size in units of SIMD vector
Definition: afopr_Staggered_eo.h:82
AFopr_Staggered_eo::tidyup
void tidyup()
Definition: afopr_Staggered_eo-tmpl.h:148
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
AFopr_Staggered_eo::mult_dn
void mult_dn(int mu, AFIELD &, const AFIELD &)
downward nearest neighbor hopping term.
Definition: afopr_Staggered_eo-tmpl.h:761
AFopr_Staggered_eo::set_config
void set_config(Field *U)
setting gauge configuration (common interface).
Definition: afopr_Staggered_eo-tmpl.h:304
AFopr_Staggered_eo::get_mode
std::string get_mode() const
returns the current mult mode.
Definition: afopr_Staggered_eo.h:108
Field::real_t
double real_t
Definition: field.h:51
AFopr_Staggered_eo::m_mode
std::string m_mode
Definition: afopr_Staggered_eo.h:68
AFopr_Staggered_eo::field_nvol
int field_nvol()
returns the volume of the fermion field.
Definition: afopr_Staggered_eo.h:123
AFopr_Staggered_eo::D
void D(AFIELD &, const AFIELD &)
Definition: afopr_Staggered_eo-tmpl.h:539
AFopr_Staggered_eo::needs_convert
bool needs_convert()
returns true if additional field conversion is needed.
Definition: afopr_Staggered_eo.h:104
AFopr_Staggered_eo::DdagD
void DdagD(AFIELD &, const AFIELD &)
Definition: afopr_Staggered_eo-tmpl.h:528
AFopr_Staggered_eo::m_Nx
int m_Nx
Definition: afopr_Staggered_eo.h:50
AFopr_Staggered_eo::set_parameters
void set_parameters(const Parameters &params)
setting parameters by a Parameter object.
Definition: afopr_Staggered_eo-tmpl.h:190
aindex_eo.h
AFopr_Staggered_eo::m_Nyv
int m_Nyv
Definition: afopr_Staggered_eo.h:52
AFopr_Staggered_eo::do_comm_any
int do_comm_any
switchs of communication (if any): (0: n, 1: y).
Definition: afopr_Staggered_eo.h:74
AFopr_Staggered_eo::m_parity
AFIELD m_parity
site parity for multiplying gamma_5
Definition: afopr_Staggered_eo.h:61
AFopr_Staggered_eo::set_staggered_phase
void set_staggered_phase()
Definition: afopr_Staggered_eo-tmpl.h:254
AFopr_Staggered_eo::Meo
void Meo(AFIELD &, const AFIELD &, int ieo)
Definition: afopr_Staggered_eo-tmpl.h:573
AFopr_Staggered_eo::m_Nst2v
int m_Nst2v
for SIMD arrays
Definition: afopr_Staggered_eo.h:52
AFopr_Staggered_eo::do_comm
int do_comm[4]
switchs of communication (4=Ndim): (0: n, 1: y).
Definition: afopr_Staggered_eo.h:73
AFopr_Staggered_eo::m_Nst
int m_Nst
Definition: afopr_Staggered_eo.h:50
AFopr_Staggered_eo::chrecv_up
std::vector< Channel > chrecv_up
Definition: afopr_Staggered_eo.h:79
AFopr_Staggered_eo::m_Nbdsize
std::vector< int > m_Nbdsize
Definition: afopr_Staggered_eo.h:76
AFopr_Staggered_eo::H
void H(AFIELD &, const AFIELD &)
Definition: afopr_Staggered_eo-tmpl.h:519
AFopr_Staggered_eo::m_Ndim
int m_Ndim
Definition: afopr_Staggered_eo.h:49
AFopr_Staggered_eo::mult_dag
void mult_dag(AFIELD &, const AFIELD &)
hermitian conjugate of mult.
Definition: afopr_Staggered_eo-tmpl.h:432
AFopr_Staggered_eo::m_Nt
int m_Nt
Definition: afopr_Staggered_eo.h:50
AFopr_Staggered_eo::chset_send
ChannelSet chset_send
Definition: afopr_Staggered_eo.h:80
AFopr_Staggered_eo::allocator_t
typename AFIELD::template aligned_allocator< char > allocator_t
Definition: afopr_Staggered_eo.h:77
parameters.h
AFopr_Staggered_eo::axpby
void axpby(real_t, real_t *, real_t, real_t *)
Definition: afopr_Staggered_eo-tmpl.h:744
AFopr_Staggered_eo::setup_channels
void setup_channels()
Definition: afopr_Staggered_eo-tmpl.h:156
AFopr_Staggered_eo::m_shift
ShiftAField_eo< AFIELD > * m_shift
Definition: afopr_Staggered_eo.h:66
AFopr_Staggered_eo::field_nex
int field_nex()
returns the external degree of freedom of the fermion field.
Definition: afopr_Staggered_eo.h:125
AFopr_Staggered_eo::m_Ueo
AFIELD m_Ueo
gauge field multiplied by staggered phase
Definition: afopr_Staggered_eo.h:63
AFopr_Staggered_eo::field_nin
int field_nin()
returns the on-site degree of freedom of the fermion field.
Definition: afopr_Staggered_eo.h:124
AFopr_Staggered_eo::init
void init(const Parameters &params)
Definition: afopr_Staggered_eo-tmpl.h:17
AFopr_Staggered_eo::m_stg_phase
AFIELD m_stg_phase
staggered phase
Definition: afopr_Staggered_eo.h:60
AFopr_Staggered_eo::mult
void mult(AFIELD &, const AFIELD &)
multiplies fermion operator to a given field.
Definition: afopr_Staggered_eo-tmpl.h:413
AFopr_Staggered_eo::clear
void clear(real_t *)
Definition: afopr_Staggered_eo-tmpl.h:736
AFopr_Staggered_eo::m_Leo
std::vector< int > m_Leo
Leo = 0 (even site) or 1 (odd site).
Definition: afopr_Staggered_eo.h:58
AFopr_Staggered_eo::m_Nx2v
int m_Nx2v
Definition: afopr_Staggered_eo.h:52
AFopr_Staggered_eo::chrecv_dn
std::vector< Channel > chrecv_dn
Definition: afopr_Staggered_eo.h:79
AFopr_Staggered_eo::m_v2
AFIELD m_v2
working vectors
Definition: afopr_Staggered_eo.h:71
AFopr_Staggered_eo::mult_gm5
void mult_gm5(AFIELD &, const AFIELD &)
multiplies gamma_5 matrix.
Definition: afopr_Staggered_eo-tmpl.h:703
AFopr_Staggered_eo::m_v1
AFIELD m_v1
Definition: afopr_Staggered_eo.h:71
AFopr_Staggered_eo::m_Nst2
int m_Nst2
Definition: afopr_Staggered_eo.h:51
AFopr_Staggered_eo::normalize_fprop
void normalize_fprop(AFIELD &v)
normalize propagator if necessary (default: do nothing)
Definition: afopr_Staggered_eo-tmpl.h:390
AFopr_Staggered_eo::chset_recv
ChannelSet chset_recv
Definition: afopr_Staggered_eo.h:80
commonParameters.h
AFopr_Staggered_eo::get_parameters
void get_parameters(Parameters &params) const
getting parameters via a Parameters object.
Definition: afopr_Staggered_eo-tmpl.h:243
Field
Container of Field-type object.
Definition: field.h:46
afopr.h
communicator.h
ShiftAField_eo
Methods to shift a field in the even-odd site index.
Definition: shiftAField_eo.h:32
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
AFopr_Staggered_eo::m_boundary
std::vector< int > m_boundary
boundary conditions.
Definition: afopr_Staggered_eo.h:55
AFopr_Staggered_eo::m_mq
real_t m_mq
quark mass.
Definition: afopr_Staggered_eo.h:54
AFopr_Staggered_eo::mult_up
void mult_up(int mu, AFIELD &, const AFIELD &)
upward nearest neighbor hopping term.
Definition: afopr_Staggered_eo-tmpl.h:753
Channel_impl
Definition: channel.h:86
AFopr_Staggered_eo::chsend_up
std::vector< Channel > chsend_up
Definition: afopr_Staggered_eo.h:79
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
AFopr_Staggered_eo::m_w1
AFIELD m_w1
Definition: afopr_Staggered_eo.h:70
AFopr_Staggered_eo::m_w2
AFIELD m_w2
working vectors
Definition: afopr_Staggered_eo.h:70
AFopr_Staggered_eo::m_Nvc
int m_Nvc
Definition: afopr_Staggered_eo.h:49