Bridge++  Ver. 2.0.2
aindex_eo.h
Go to the documentation of this file.
1 
10 #ifndef QXS_AINDEX_EO_INCLUDED
11 #define QXS_AINDEX_EO_INCLUDED
12 
13 #include <vector>
14 
16 
18 #include "lib/IO/bridgeIO.h"
19 using Bridge::vout;
20 
21 #include "lib_alt_QXS/inline/define_vlen.h"
22 #include "lib_alt_QXS/inline/define_params.h"
23 
24 
25 namespace AIndex_eo_qxs {
26  template<typename REALTYPE>
27  inline int idx(const int in, const int Nin, const int ist,
28  const int Nx2, const int Ny,
29  const int leo, const int Nvol2, const int ex)
30  {
31  int ist2 = ist / 2;
32  int ieo = (ist + leo) % 2;
33  int offset = (ieo + 2 * ex) * Nin * Nvol2;
34  int ix2 = ist2 % Nx2;
35  int iy = (ist2 / Nx2) % Ny;
36  int kx2 = ix2 % VLENXD;
37  int ky = iy % VLENYD;
38  int k = kx2 + VLENXD * ky;
39  int ix2v = ix2 / VLENXD;
40  int iyv = iy / VLENYD;
41  int izt = ist2 / (Nx2 * Ny);
42  int ist2v = ix2v + (Nx2 / VLENXD) * (iyv + (Ny / VLENYD) * izt);
43  return k + VLEND * (in + Nin * ist2v) + offset;
44  }
45 
46 
47  template<typename REALTYPE>
48  inline int idxh(const int in, const int Nin, const int ist2,
49  const int Nx2, const int Ny,
50  const int Nvol2, const int ex)
51  {
52  int ix2 = ist2 % Nx2;
53  int iy = (ist2 / Nx2) % Ny;
54  int kx2 = ix2 % VLENXD;
55  int ky = iy % VLENYD;
56  int k = kx2 + VLENXD * ky;
57  int ix2v = ix2 / VLENXD;
58  int iyv = iy / VLENYD;
59  int izt = ist2 / (Nx2 * Ny);
60  int ist2v = ix2v + (Nx2 / VLENXD) * (iyv + (Ny / VLENYD) * izt);
61  return k + VLEND * (in + Nin * ist2v) + Nin * Nvol2 * ex;
62  }
63 
64 
65  template<>
66  inline int idx<float>(const int in, const int Nin, const int ist,
67  const int Nx2, const int Ny,
68  const int leo, const int Nvol2, const int ex)
69  {
70  int ist2 = ist / 2;
71  int ieo = (ist + leo) % 2;
72  int offset = (ieo + 2 * ex) * Nin * Nvol2;
73  int ix2 = ist2 % Nx2;
74  int iy = (ist2 / Nx2) % Ny;
75  int kx2 = ix2 % VLENXS;
76  int ky = iy % VLENYS;
77  int k = kx2 + VLENXS * ky;
78  int ix2v = ix2 / VLENXS;
79  int iyv = iy / VLENYS;
80  int izt = ist2 / (Nx2 * Ny);
81  int ist2v = ix2v + (Nx2 / VLENXS) * (iyv + (Ny / VLENYS) * izt);
82  return k + VLENS * (in + Nin * ist2v) + offset;
83  }
84 
85 
86  template<>
87  inline int idxh<float>(const int in, const int Nin, const int ist2,
88  const int Nx2, const int Ny,
89  const int Nvol2, const int ex)
90  {
91  int ix2 = ist2 % Nx2;
92  int iy = (ist2 / Nx2) % Ny;
93  int kx2 = ix2 % VLENXS;
94  int ky = iy % VLENYS;
95  int k = kx2 + VLENXS * ky;
96  int ix2v = ix2 / VLENXS;
97  int iyv = iy / VLENYS;
98  int izt = ist2 / (Nx2 * Ny);
99  int ist2v = ix2v + (Nx2 / VLENXS) * (iyv + (Ny / VLENYS) * izt);
100  return k + VLENS * (in + Nin * ist2v) + Nin * Nvol2 * ex;
101  }
102 }
103 
105 
112 template<typename REALTYPE>
113 class AIndex_eo<REALTYPE, QXS>
114 {
115  private:
116  int Nx, Ny, Nz, Nt, Nvol;
117  int Nx2, Nvol2;
118  int Nc, Nd, Ndf, Nvcd;
119  std::vector<int> Leo;
121 
123  void init();
124 
125  public:
127  AIndex_eo() { init(); }
128 
129  int site(const int x, const int y, const int z, const int t) const
130  {
131  int ieo = (x + leo(y, z, t)) % 2;
132  return (x / 2) + Nx2 * (y + Ny * (z + Nz * t)) + ieo * Nvol2;
133  }
134 
135  int idx(const int in, const int Nin, const int ist, const int ex) const
136  {
137  int ist2 = ist / 2;
138  int leot = Leo[ist2 / Nx2];
139  return AIndex_eo_qxs::idx<REALTYPE>(in, Nin, ist,
140  Nx2, Ny, leot, Nvol2, ex);
141  }
142 
143  int idx_G(const int idf, const int ist, const int ex) const
144  { return idx(idf, Ndf, ist, ex); }
145 
146  int idx_Gr(const int ic1, const int ic2, const int ist, const int ex) const
147  {
148  int idf = 2 * (ic2 + Nc * ic1);
149  return idx_G(idf, ist, ex);
150  }
151 
152  int idx_Gi(const int ic1, const int ic2, const int ist, const int ex) const
153  {
154  int idf = 1 + 2 * (ic2 + Nc * ic1);
155  return idx_G(idf, ist, ex);
156  }
157 
158  int idx_SP(const int in, const int ist, const int ex) const
159  { return idx(in, Nvcd, ist, ex); }
160 
161  int idx_SPr(const int ic, const int id, const int ist, const int ex) const
162  {
163  int in = 2 * (id + Nd * ic);
164  return idx_SP(in, ist, ex);
165  }
166 
167  int idx_SPi(const int ic, const int id, const int ist, const int ex) const
168  {
169  int in = 1 + 2 * (id + Nd * ic);
170  return idx_SP(in, ist, ex);
171  }
172 
173  int idxh(const int in, const int Nin, const int ist2, const int ex) const
174  {
175  return AIndex_eo_qxs::idxh<REALTYPE>(in, Nin, ist2,
176  Nx2, Ny, Nvol2, ex);
177  }
178 
179  int idxh_SP(const int in, const int ist2, const int ex) const
180  { return idxh(in, Nvcd, ist2, ex); }
181 
182  int idxh_SPr(const int ic, const int id, const int ist, const int ex) const
183  {
184  int in = 2 * (id + Nd * ic);
185  return idxh_SP(in, ist, ex);
186  }
187 
188  int idxh_SPi(const int ic, const int id, const int ist, const int ex) const
189  {
190  int in = 1 + 2 * (id + Nd * ic);
191  return idxh_SP(in, ist, ex);
192  }
193 
194  int site(const int x2, const int y, const int z, const int t,
195  const int ieo) const
196  { return x2 + Nx2 * (y + Ny * (z + Nz * t)) + Nvol2 * ieo; }
197 
198  int site(const int is, const int ieo) const
199  { return is + Nvol2 * ieo; }
200 
201  int siteh(const int x2, const int y, const int z, const int t)
202  const
203  { return x2 + Nx2 * (y + Ny * (z + Nz * t)); }
204 
205  int leo(const int y, const int z, const int t) const
206  { return Leo[y + Ny * (z + Nz * t)]; }
207 
208  int leo(const int iyzt) const { return Leo[iyzt]; }
209 
210  template<typename AFIELD>
211  void split(AFIELD& v_e, AFIELD& v_o, const AFIELD& v);
212 
213  template<typename AFIELD>
214  void merge(AFIELD& v, const AFIELD& v_e, const AFIELD& v_o);
215 };
216 
217 #endif
AIndex_eo< REALTYPE, QXS >::idx_Gr
int idx_Gr(const int ic1, const int ic2, const int ist, const int ex) const
Definition: aindex_eo.h:146
bridgeIO.h
VLEND
#define VLEND
Definition: define_vlen.h:42
AIndex_eo_qxs::idxh
int idxh(const int in, const int Nin, const int ist2, const int Nx2, const int Ny, const int Nvol2, const int ex)
Definition: aindex_eo.h:48
AIndex_eo< REALTYPE, QXS >::idxh_SP
int idxh_SP(const int in, const int ist2, const int ex) const
Definition: aindex_eo.h:179
AIndex_eo< REALTYPE, QXS >::Nx2
int Nx2
Definition: aindex_eo.h:117
AIndex_eo< REALTYPE, QXS >::leo
int leo(const int y, const int z, const int t) const
Definition: aindex_eo.h:205
AIndex_eo< REALTYPE, QXS >::idx_Gi
int idx_Gi(const int ic1, const int ic2, const int ist, const int ex) const
Definition: aindex_eo.h:152
VLENYS
#define VLENYS
Definition: define_vlen.h:27
AIndex_eo< REALTYPE, QXS >::siteh
int siteh(const int x2, const int y, const int z, const int t) const
Definition: aindex_eo.h:201
VLENS
#define VLENS
Definition: define_vlen.h:41
AIndex_eo< REALTYPE, QXS >::site
int site(const int is, const int ieo) const
Definition: aindex_eo.h:198
AIndex_eo< REALTYPE, QXS >::m_vl
Bridge::VerboseLevel m_vl
Definition: aindex_eo.h:120
AIndex_eo_qxs::idx< float >
int idx< float >(const int in, const int Nin, const int ist, const int Nx2, const int Ny, const int leo, const int Nvol2, const int ex)
Definition: aindex_eo.h:66
AIndex_eo< REALTYPE, QXS >::AIndex_eo
AIndex_eo()
constructor.
Definition: aindex_eo.h:127
AIndex_eo< REALTYPE, QXS >::idx_SPr
int idx_SPr(const int ic, const int id, const int ist, const int ex) const
Definition: aindex_eo.h:161
AIndex_eo< REALTYPE, QXS >::Nz
int Nz
Definition: aindex_eo.h:116
AIndex_eo_qxs
Definition: aindex_eo.h:25
AIndex_eo< REALTYPE, QXS >::site
int site(const int x2, const int y, const int z, const int t, const int ieo) const
Definition: aindex_eo.h:194
AIndex_eo< REALTYPE, QXS >::leo
int leo(const int iyzt) const
Definition: aindex_eo.h:208
AIndex_eo< REALTYPE, QXS >::idxh_SPr
int idxh_SPr(const int ic, const int id, const int ist, const int ex) const
Definition: aindex_eo.h:182
AIndex_eo_qxs::idx
int idx(const int in, const int Nin, const int ist, const int Nx2, const int Ny, const int leo, const int Nvol2, const int ex)
Definition: aindex_eo.h:27
AIndex_eo< REALTYPE, QXS >::idx
int idx(const int in, const int Nin, const int ist, const int ex) const
Definition: aindex_eo.h:135
AIndex_eo< REALTYPE, QXS >::idxh
int idxh(const int in, const int Nin, const int ist2, const int ex) const
Definition: aindex_eo.h:173
AIndex_eo< REALTYPE, QXS >::idx_SP
int idx_SP(const int in, const int ist, const int ex) const
Definition: aindex_eo.h:158
AIndex_eo< REALTYPE, QXS >::idx_G
int idx_G(const int idf, const int ist, const int ex) const
Definition: aindex_eo.h:143
VLENXD
#define VLENXD
Definition: define_vlen.h:23
AIndex_eo< REALTYPE, QXS >::idx_SPi
int idx_SPi(const int ic, const int id, const int ist, const int ex) const
Definition: aindex_eo.h:167
QXS
@ QXS
Definition: alt_impl.h:15
AIndex_eo< REALTYPE, QXS >::Leo
std::vector< int > Leo
Definition: aindex_eo.h:119
AIndex_eo< REALTYPE, QXS >::site
int site(const int x, const int y, const int z, const int t) const
Definition: aindex_eo.h:129
VLENYD
#define VLENYD
Definition: define_vlen.h:24
commonParameters.h
Field
Container of Field-type object.
Definition: field.h:46
AIndex_eo< REALTYPE, QXS >::Nvcd
int Nvcd
Definition: aindex_eo.h:118
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
aindex_eo_base.h
VLENXS
#define VLENXS
Definition: define_vlen.h:26
AIndex_eo_qxs::idxh< float >
int idxh< float >(const int in, const int Nin, const int ist2, const int Nx2, const int Ny, const int Nvol2, const int ex)
Definition: aindex_eo.h:87
AIndex_eo< REALTYPE, QXS >::idxh_SPi
int idxh_SPi(const int ic, const int id, const int ist, const int ex) const
Definition: aindex_eo.h:188
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
AIndex_eo
Definition: aindex_eo_base.h:17