Bridge++  Ver. 2.0.2
aindex_lex_QWS_dd.h
Go to the documentation of this file.
1 
10 #ifndef QXS_AINDEX_LEX_QWS_DD_INCLUDED
11 #define QXS_AINDEX_LEX_QWS_DD_INCLUDED
12 
13 #include <string>
14 
15 #include "lib_alt/alt_impl.h"
16 
18 
19 #include "lib_alt_QXS/inline/define_vlen.h"
20 #include "lib_alt_QXS/inline/define_params.h"
21 
23  template<typename REALTYPE>
24  inline int idx(const int in, const int Nin, const int ist,
25  const int Nx, const int Ny, const int Nxv,
26  const int Nyv_, const int Nstv, const int ex)
27  {
28  int ix = ist % Nx;
29  int Nxh = Nx / 2;
30  int deo = ix / Nxh;
31  int ixh = ix % Nxh;
32  int kx = ixh % VLEND;
33  int ixv = ixh / VLEND;
34  int iyzt = ist / Nx;
35  int istv = ixv + Nxv * iyzt / 2;
36  return kx + VLEND * (in + Nin * (istv + deo * Nstv / 2 + Nstv * ex));
37  }
38 
39 
40  template<>
41  inline int idx<float>(const int in, const int Nin, const int ist,
42  const int Nx, const int Ny, const int Nxv,
43  const int Nyv_, const int Nstv, const int ex)
44  {
45  int ix = ist % Nx;
46  int Nxh = Nx / 2;
47  int deo = ix / Nxh;
48  int ixh = ix % Nxh;
49  int kx = ixh % VLENS;
50  int ixv = ixh / VLENS;
51  int iyzt = ist / Nx;
52  int istv = ixv + Nxv * iyzt / 2;
53  return kx + VLENS * (in + Nin * (istv + deo * Nstv / 2 + Nstv * ex));
54  }
55 
56 
57  template<typename REALTYPE>
58  inline int set_Nxv(const int Nx) { return Nx / VLEND; }
59 
60  template<>
61  inline int set_Nxv<float>(const int Nx) { return Nx / VLENS; }
62 
63  //template<typename REALTYPE>
64  // inline int set_Nyv(const int Ny){ return Ny/VLENYD; }
65 
66  //template<>
67  // inline int set_Nyv<float>(const int Ny){ return Ny/VLENYS; }
68 }
69 
71 
81 template<typename REALTYPE, Impl impl>
83 
84 template<typename REALTYPE>
85 class AIndex_lex_QWS_dd<REALTYPE, QXS>
86 {
87  protected:
88  int m_Nc, m_Nd, m_Ndf, m_Nvcd;
89  int m_Nx, m_Ny, m_Nz, m_Nt, m_Nst;
90  int m_Nxv, m_Nyv, m_Nzt, m_Nstv;
91 
92  public:
94  {
95  m_Nx = CommonParameters::Nx();
96  m_Ny = CommonParameters::Ny();
97  m_Nz = CommonParameters::Nz();
98  m_Nt = CommonParameters::Nt();
99  init_common();
100  }
101 
102  AIndex_lex_QWS_dd(int Nx, int Ny, int Nz, int Nt)
103  {
104  m_Nx = Nx;
105  m_Ny = Ny;
106  m_Nz = Nz;
107  m_Nt = Nt;
108  init_common();
109  }
110 
111  private:
112  void init_common()
113  {
114  m_Nc = CommonParameters::Nc();
115  m_Nd = CommonParameters::Nd();
116  m_Ndf = 2 * m_Nc * m_Nc;
117  m_Nvcd = 2 * m_Nc * m_Nd;
118  m_Nst = m_Nx * m_Ny * m_Nz * m_Nt;
119  m_Nxv = AIndex_lex_qxs_qws_dd::set_Nxv<REALTYPE>(m_Nx);
120  m_Nyv = m_Ny;
121  m_Nzt = m_Nz * m_Nt;
122  m_Nstv = m_Nxv * m_Ny * m_Nzt;
123  vout.paranoiac("AIndex_lex_QWS: VLEND=%d, VLNES=%d\n", VLEND, VLENS);
124  }
125 
126  public:
127 
128  int site(const int x, const int y, const int z, const int t) const
129  { return x + m_Nxv * (y + m_Ny * (z + m_Nz * t)); }
130 
131  int idx(const int in, const int Nin, const int ist, const int ex) const
132  {
133  return AIndex_lex_qxs_qws_dd::idx<REALTYPE>(in, Nin, ist, m_Nx, m_Ny,
134  m_Nxv, m_Nyv, m_Nstv, ex);
135  }
136 
137  int idx_G(const int idf, const int ist, const int ex) const
138  { return idx(idf, m_Ndf, ist, ex); }
139 
140  int idx_Gr(const int ic1, const int ic2, const int ist, const int ex) const
141  {
142  int idf = 2 * (ic2 + m_Nc * ic1);
143  return idx_G(idf, ist, ex);
144  }
145 
146  int idx_Gi(const int ic1, const int ic2, const int ist, const int ex) const
147  {
148  int idf = 1 + 2 * (ic2 + m_Nc * ic1);
149  return idx_G(idf, ist, ex);
150  }
151 
152  int idx_SP(const int in, const int ist, const int ex) const
153  { return idx(in, m_Nvcd, ist, ex); }
154 
155  int idx_SPr(const int ic, const int id, const int ist, const int ex) const
156  {
157  int in = 2 * (id + m_Nd * ic);
158  return idx_SP(in, ist, ex);
159  }
160 
161  int idx_SPi(const int ic, const int id, const int ist, const int ex) const
162  {
163  int in = 1 + 2 * (id + m_Nd * ic);
164  return idx_SP(in, ist, ex);
165  }
166 };
167 
168 #endif
AIndex_lex_QWS_dd< REALTYPE, QXS >::idx_Gi
int idx_Gi(const int ic1, const int ic2, const int ist, const int ex) const
Definition: aindex_lex_QWS_dd.h:146
CommonParameters::Ny
static int Ny()
Definition: commonParameters.h:106
CommonParameters::Nz
static int Nz()
Definition: commonParameters.h:107
VLEND
#define VLEND
Definition: define_vlen.h:42
AIndex_lex_qxs_qws_dd::idx< float >
int idx< float >(const int in, const int Nin, const int ist, const int Nx, const int Ny, const int Nxv, const int Nyv_, const int Nstv, const int ex)
Definition: aindex_lex_QWS_dd.h:41
AIndex_lex_QWS_dd< REALTYPE, QXS >::init_common
void init_common()
Definition: aindex_lex_QWS_dd.h:112
AIndex_lex_QWS_dd< REALTYPE, QXS >::idx_SP
int idx_SP(const int in, const int ist, const int ex) const
Definition: aindex_lex_QWS_dd.h:152
AIndex_lex_qxs_qws_dd::idx
int idx(const int in, const int Nin, const int ist, const int Nx, const int Ny, const int Nxv, const int Nyv_, const int Nstv, const int ex)
Definition: aindex_lex_QWS_dd.h:24
AIndex_lex_qxs_qws_dd::set_Nxv< float >
int set_Nxv< float >(const int Nx)
Definition: aindex_lex_QWS_dd.h:61
VLENS
#define VLENS
Definition: define_vlen.h:41
AIndex_lex_qxs_qws_dd::set_Nxv
int set_Nxv(const int Nx)
Definition: aindex_lex_QWS_dd.h:58
Bridge::BridgeIO::paranoiac
void paranoiac(const char *format,...)
Definition: bridgeIO.cpp:238
CommonParameters::Nx
static int Nx()
Definition: commonParameters.h:105
CommonParameters::Nc
static int Nc()
Definition: commonParameters.h:115
AIndex_lex_QWS_dd< REALTYPE, QXS >::idx_SPr
int idx_SPr(const int ic, const int id, const int ist, const int ex) const
Definition: aindex_lex_QWS_dd.h:155
CommonParameters::Nt
static int Nt()
Definition: commonParameters.h:108
AIndex_lex_QWS_dd< REALTYPE, QXS >::AIndex_lex_QWS_dd
AIndex_lex_QWS_dd()
Definition: aindex_lex_QWS_dd.h:93
AIndex_lex_QWS_dd< REALTYPE, QXS >::site
int site(const int x, const int y, const int z, const int t) const
Definition: aindex_lex_QWS_dd.h:128
AIndex_lex_qxs_qws_dd
Definition: aindex_lex_QWS_dd.h:22
AIndex_lex_QWS_dd< REALTYPE, QXS >::AIndex_lex_QWS_dd
AIndex_lex_QWS_dd(int Nx, int Ny, int Nz, int Nt)
Definition: aindex_lex_QWS_dd.h:102
QXS
@ QXS
Definition: alt_impl.h:15
AIndex_lex_QWS_dd< REALTYPE, QXS >::idx_G
int idx_G(const int idf, const int ist, const int ex) const
Definition: aindex_lex_QWS_dd.h:137
CommonParameters::Nd
static int Nd()
Definition: commonParameters.h:116
AIndex_lex_QWS_dd< REALTYPE, QXS >::m_Nvcd
int m_Nvcd
Definition: aindex_lex_QWS_dd.h:88
AIndex_lex_QWS_dd< REALTYPE, QXS >::idx_Gr
int idx_Gr(const int ic1, const int ic2, const int ist, const int ex) const
Definition: aindex_lex_QWS_dd.h:140
AIndex_lex_QWS_dd< REALTYPE, QXS >::idx_SPi
int idx_SPi(const int ic, const int id, const int ist, const int ex) const
Definition: aindex_lex_QWS_dd.h:161
AIndex_lex_QWS_dd< REALTYPE, QXS >::m_Nzt
int m_Nzt
Definition: aindex_lex_QWS_dd.h:90
commonParameters.h
alt_impl.h
AIndex_lex_QWS_dd
Lexical site index.
Definition: aindex_lex_QWS_dd.h:82
AIndex_lex_QWS_dd< REALTYPE, QXS >::m_Nz
int m_Nz
Definition: aindex_lex_QWS_dd.h:89
AIndex_lex_QWS_dd< REALTYPE, QXS >::idx
int idx(const int in, const int Nin, const int ist, const int ex) const
Definition: aindex_lex_QWS_dd.h:131
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512