Bridge++  Ver. 2.0.2
afopr_Staggered.h
Go to the documentation of this file.
1 
10 #ifndef QXS_AFOPR_STAGGERED_INCLUDED
11 #define QXS_AFOPR_STAGGERED_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 
31 
33 
40 template<typename AFIELD>
41 class AFopr_Staggered : public AFopr<AFIELD>
42 {
43  public:
44  typedef typename AFIELD::real_t real_t;
45  static const std::string class_name;
46 
47  private:
49  int m_Nx, m_Ny, m_Nz, m_Nt, m_Nst;
50  int m_Nxv, m_Nyv, m_Nstv;
51 
53  std::vector<int> m_boundary;
55 
58 
60 
62 
63  std::string m_mode;
64 
67 
68  int do_comm[4];
70 
71  std::vector<int> m_Nbdsize;
72  using allocator_t = typename AFIELD::template aligned_allocator<char>;
74  std::vector<Channel> chsend_up, chrecv_up, chsend_dn, chrecv_dn;
76 
77  int m_Nsize[4];
78 
79  public:
81  AFopr_Staggered(const Parameters& params) : AFopr<AFIELD>()
82  { init(params); }
83 
86 
88  void set_parameters(const Parameters& params);
89 
91  void set_parameters(const real_t mq, const std::vector<int> bc);
92 
94  void get_parameters(Parameters& params) const;
95 
97  void set_config(Field *U);
98 
99  bool needs_convert() { return false; }
100 
101  void set_mode(std::string mode);
102 
103  std::string get_mode() const { return m_mode; }
104 
105 
106  void mult(AFIELD&, const AFIELD&);
107  void mult_dag(AFIELD&, const AFIELD&);
108  void mult_gm5(AFIELD&, const AFIELD&);
109 
110  void mult_gm5(AFIELD&);
111 
112  void fprop_normalize(AFIELD& v) { }
113 
114  void fopr_normalize(AFIELD& v) { }
115 
116  int field_nvol() { return m_Nst; }
117  int field_nin() { return m_Nvc; }
118  int field_nex() { return 1; }
119 
121  double flop_count();
122 
124  double flop_count(const std::string mode);
125 
126  private:
127  void init(const Parameters& params);
128 
129  void tidyup();
130 
131  void set_staggered_phase();
132 
133  void setup_channels();
134 
136  void set_config_omp(Field *u);
137 
139  void set_config_impl(Field *u);
140 
141  void D(AFIELD&, const AFIELD&);
142  void Ddag(AFIELD&, const AFIELD&);
143  void DdagD(AFIELD&, const AFIELD&);
144  void H(AFIELD&, const AFIELD&);
145 
146  void mult_D_qxs(AFIELD&, const AFIELD&, int jd);
147  void mult_D_alt(AFIELD&, const AFIELD&, int jd);
148 
149  void clear(real_t *);
150 
151  void axpby(real_t, real_t *, real_t, real_t *);
152 
153  void mult_up(int mu, AFIELD&, const AFIELD&);
154  void mult_dn(int mu, AFIELD&, const AFIELD&);
155 
156 
157 #ifdef USE_FACTORY
158  private:
159  static AFopr<AFIELD> *create_object_with_params(const Parameters& params)
160  { return new AFopr_Staggered(params); }
161 
162  public:
163  static bool register_factory()
164  {
165  bool init1 = AFopr<AFIELD>::Factory_params::Register("Staggered",
166  create_object_with_params);
167  return init1;
168  }
169 #endif
170 };
171 #endif
AFopr_Staggered::D
void D(AFIELD &, const AFIELD &)
Definition: afopr_Staggered-tmpl.h:398
AFopr_Staggered::m_Nbdsize
std::vector< int > m_Nbdsize
Definition: afopr_Staggered.h:71
AFopr_Staggered::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-tmpl.h:327
bridgeIO.h
AFopr_Staggered::fopr_normalize
void fopr_normalize(AFIELD &v)
Definition: afopr_Staggered.h:114
AFopr
Definition: afopr.h:48
AFopr_Staggered::m_Nc
int m_Nc
Definition: afopr_Staggered.h:48
communicator_impl.h
Parameters
Class for parameters.
Definition: parameters.h:46
AFopr_Staggered::m_v2
AFIELD m_v2
working vector
Definition: afopr_Staggered.h:66
AFopr_Staggered::m_boundary
std::vector< int > m_boundary
boundary conditions.
Definition: afopr_Staggered.h:53
AFopr_Staggered::m_Nt
int m_Nt
Definition: afopr_Staggered.h:49
AFopr_Staggered::m_Nyv
int m_Nyv
Definition: afopr_Staggered.h:50
AFopr_Staggered::mult_up
void mult_up(int mu, AFIELD &, const AFIELD &)
upward nearest neighbor hopping term.
Definition: afopr_Staggered-tmpl.h:563
AFopr_Staggered::m_Nst
int m_Nst
Definition: afopr_Staggered.h:49
AFopr_Staggered::set_config_impl
void set_config_impl(Field *u)
setting gauge configuration (implementation).
Definition: afopr_Staggered-tmpl.h:306
AFopr_Staggered::~AFopr_Staggered
~AFopr_Staggered()
destructor.
Definition: afopr_Staggered.h:85
AFopr_Staggered::tidyup
void tidyup()
Definition: afopr_Staggered-tmpl.h:119
AFopr_Staggered::allocator_t
typename AFIELD::template aligned_allocator< char > allocator_t
Definition: afopr_Staggered.h:72
ChannelSet
ChannelSet class for a collection of channels.
Definition: channel.h:148
AFopr_Staggered::chrecv_up
std::vector< Channel > chrecv_up
Definition: afopr_Staggered.h:74
AFopr_Staggered
Staggered fermion operator.
Definition: afopr_Staggered.h:41
ShiftAField_lex
Methods to shift a field in the lexical site index.
Definition: shiftAField_lex.h:33
AFopr_Staggered::do_comm
int do_comm[4]
switchs of communication (4=Ndim): (0: n, 1: y).
Definition: afopr_Staggered.h:68
AFopr_Staggered::init
void init(const Parameters &params)
Definition: afopr_Staggered-tmpl.h:17
AFopr_Staggered::get_mode
std::string get_mode() const
returns the current mult mode.
Definition: afopr_Staggered.h:103
AFopr_Staggered::chsend_dn
std::vector< Channel > chsend_dn
Definition: afopr_Staggered.h:74
AFopr_Staggered::m_Ndim
int m_Ndim
Definition: afopr_Staggered.h:48
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
AFopr_Staggered::chset_recv
ChannelSet chset_recv
Definition: afopr_Staggered.h:75
AFopr_Staggered::chrecv_dn
std::vector< Channel > chrecv_dn
Definition: afopr_Staggered.h:74
Field::real_t
double real_t
Definition: field.h:51
AFopr_Staggered::field_nvol
int field_nvol()
returns the volume of the fermion field.
Definition: afopr_Staggered.h:116
AFopr_Staggered::mult_D_alt
void mult_D_alt(AFIELD &, const AFIELD &, int jd)
Definition: afopr_Staggered-tmpl.h:487
shiftAField_lex.h
AFopr_Staggered::m_Nxv
int m_Nxv
Definition: afopr_Staggered.h:50
AFopr_Staggered::m_Ndf
int m_Ndf
Definition: afopr_Staggered.h:48
AFopr_Staggered::real_t
AFIELD::real_t real_t
Definition: afopr_Staggered.h:44
AFopr_Staggered::m_U
AFIELD m_U
gauge field multiplied by staggered phase
Definition: afopr_Staggered.h:59
AFopr_Staggered::m_Nz
int m_Nz
Definition: afopr_Staggered.h:49
AFopr_Staggered::m_parity
AFIELD m_parity
site parity for multiplying gamma_5
Definition: afopr_Staggered.h:57
AFopr_Staggered::m_Ny
int m_Ny
Definition: afopr_Staggered.h:49
AFopr_Staggered::m_Nvc
int m_Nvc
Definition: afopr_Staggered.h:48
AFopr_Staggered::setup_channels
void setup_channels()
Definition: afopr_Staggered-tmpl.h:129
AFopr_Staggered::chsend_up
std::vector< Channel > chsend_up
Definition: afopr_Staggered.h:74
AFopr_Staggered::mult_D_qxs
void mult_D_qxs(AFIELD &, const AFIELD &, int jd)
Definition: afopr_Staggered-tmpl.h:416
AFopr_Staggered::get_parameters
void get_parameters(Parameters &params) const
getting parameters via a Parameters object.
Definition: afopr_Staggered-tmpl.h:213
AFopr_Staggered::mult
void mult(AFIELD &, const AFIELD &)
multiplies fermion operator to a given field.
Definition: afopr_Staggered-tmpl.h:340
AFopr_Staggered::field_nin
int field_nin()
returns the on-site degree of freedom of the fermion field.
Definition: afopr_Staggered.h:117
AFopr_Staggered::m_mq
real_t m_mq
quark mass.
Definition: afopr_Staggered.h:52
AFopr_Staggered::Ddag
void Ddag(AFIELD &, const AFIELD &)
Definition: afopr_Staggered-tmpl.h:407
AFopr_Staggered::class_name
static const std::string class_name
Definition: afopr_Staggered.h:45
parameters.h
AFopr_Staggered::set_parameters
void set_parameters(const Parameters &params)
setting parameters by a Parameter object.
Definition: afopr_Staggered-tmpl.h:163
AFopr_Staggered::axpby
void axpby(real_t, real_t *, real_t, real_t *)
Definition: afopr_Staggered-tmpl.h:554
AFopr_Staggered::m_Nstv
int m_Nstv
for SIMD arrays
Definition: afopr_Staggered.h:50
AFopr_Staggered::field_nex
int field_nex()
returns the external degree of freedom of the fermion field.
Definition: afopr_Staggered.h:118
AFopr_Staggered::m_stg_phase
AFIELD m_stg_phase
staggered phase
Definition: afopr_Staggered.h:56
AFopr_Staggered::clear
void clear(real_t *)
Definition: afopr_Staggered-tmpl.h:546
AFopr_Staggered::mult_dag
void mult_dag(AFIELD &, const AFIELD &)
hermitian conjugate of mult.
Definition: afopr_Staggered-tmpl.h:359
AFopr_Staggered::needs_convert
bool needs_convert()
returns true if additional field conversion is needed.
Definition: afopr_Staggered.h:99
AFopr_Staggered::m_Nsize
int m_Nsize[4]
lattice size in units of SIMD vector
Definition: afopr_Staggered.h:77
AFopr_Staggered::fprop_normalize
void fprop_normalize(AFIELD &v)
Definition: afopr_Staggered.h:112
AFopr_Staggered::set_staggered_phase
void set_staggered_phase()
Definition: afopr_Staggered-tmpl.h:224
AFopr_Staggered::AFopr_Staggered
AFopr_Staggered(const Parameters &params)
constructor.
Definition: afopr_Staggered.h:81
AFopr_Staggered::chset_send
ChannelSet chset_send
Definition: afopr_Staggered.h:75
AFopr_Staggered::set_config
void set_config(Field *U)
setting gauge configuration (common interface).
Definition: afopr_Staggered-tmpl.h:274
AFopr_Staggered::m_w1
AFIELD m_w1
Definition: afopr_Staggered.h:65
AFopr_Staggered::mult_dn
void mult_dn(int mu, AFIELD &, const AFIELD &)
downward nearest neighbor hopping term.
Definition: afopr_Staggered-tmpl.h:582
AFopr_Staggered::do_comm_any
int do_comm_any
switchs of communication (if any): (0: n, 1: y).
Definition: afopr_Staggered.h:69
AFopr_Staggered::flop_count
double flop_count()
returns floating operation counts.
Definition: afopr_Staggered-tmpl.h:601
commonParameters.h
AFopr_Staggered::m_vl
Bridge::VerboseLevel m_vl
verbose level
Definition: afopr_Staggered.h:54
AFopr_Staggered::mult_gm5
void mult_gm5(AFIELD &, const AFIELD &)
multiplies gamma_5 matrix.
Definition: afopr_Staggered-tmpl.h:515
AFopr_Staggered::m_shift
ShiftAField_lex< AFIELD > * m_shift
Definition: afopr_Staggered.h:61
Field
Container of Field-type object.
Definition: field.h:46
afopr.h
communicator.h
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
AFopr_Staggered::H
void H(AFIELD &, const AFIELD &)
Definition: afopr_Staggered-tmpl.h:378
AFopr_Staggered::DdagD
void DdagD(AFIELD &, const AFIELD &)
Definition: afopr_Staggered-tmpl.h:387
AFopr_Staggered::m_mode
std::string m_mode
Definition: afopr_Staggered.h:63
AFopr_Staggered::m_Nx
int m_Nx
Definition: afopr_Staggered.h:49
AFopr_Staggered::m_w2
AFIELD m_w2
working vectors
Definition: afopr_Staggered.h:65
Channel_impl
Definition: channel.h:86
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
AFopr_Staggered::set_config_omp
void set_config_omp(Field *u)
setting gauge configuration (setting omp parallel).
Definition: afopr_Staggered-tmpl.h:293