Bridge++  Ver.2.1.3
aindex_eo.h
Go to the documentation of this file.
1 
10 #ifndef ACCEL_AINDEX_EO_INCLUDED
11 #define ACCEL_AINDEX_EO_INCLUDED
12 
14 
15 #include <vector>
16 
18 #include "lib/IO/bridgeIO.h"
19 using Bridge::vout;
20 
22 
24 
25 namespace AIndex_eo_accel {
26 
27  template<typename REALTYPE>
28  inline int idx(const int in, const int Nin, const int ist,
29  const int leo, const int Nvol2, const int ex) {
30  int ist2 = ist/2;
31  int ieo = (ist + leo) % 2;
32  int offset = (ieo + 2*ex)* Nvol2;
33  return (ist2 % NWP) + NWP*( in + Nin*( (ist2 + offset)/NWP) );
34  }
35 
36  template<typename REALTYPE>
37  inline int idxh(const int in, const int Nin,
38  const int ist2, const int Nvol2, const int ex) {
39  return (ist2 % NWP) + NWP*( in + Nin*( (ist2 + Nvol2*ex)/NWP) );
40  }
41 
42  template<>
43  inline int idx<float>(const int in, const int Nin, const int ist,
44  const int leo, const int Nvol2, const int ex) {
45  int ist2 = ist/2;
46  int ieo = (ist + leo) % 2;
47  int offset = (ieo + 2*ex)* Nvol2;
48  return (ist2 % NWP) + NWP*( in + Nin*( (ist2 + offset)/NWP) );
49  }
50 
51  template<>
52  inline int idxh<float>(const int in, const int Nin,
53  const int ist2, const int Nvol2, const int ex) {
54  return (ist2 % NWP) + NWP*( in + Nin*( (ist2 + Nvol2*ex)/NWP) );
55  }
56 
57 }
58 
60 
65 template<typename REALTYPE>
66 class AIndex_eo<REALTYPE, ACCEL>{
67 
68  public:
69  static const std::string class_name;
70 
71  private:
72  int Nx, Ny, Nz, Nt, Nvol;
73  int Nx2, Nvol2;
74  int Nc, Nd, Ndf, Nvcd;
76  int m_Nsize[4];
77  int m_Nsize2[4];
78  std::vector<int> Leo;
80 
82  void init();
83 
84  public:
86  AIndex_eo(){ init(); }
87 
88  int site(const int x, const int y, const int z, const int t) const
89  { int ieo = (x + leo(y,z,t)) % 2;
90  return (x/2) + Nx2 * (y + Ny * (z + Nz * t)) + ieo * Nvol2; }
91 
92  int idx(const int in, const int Nin, const int ist, const int ex) const
93  { int ist2 = ist/2;
94  int leo = Leo[ist2/Nx2];
95  return AIndex_eo_accel::idx<REALTYPE>(in, Nin, ist, leo, Nvol2, ex);
96  }
97 
98  int idx_G(const int idf, const int ist, const int ex) const
99  { return idx(idf, Ndf, ist, ex); }
100 
101  int idx_Gr(const int ic1, const int ic2, const int ist, const int ex) const
102  { int idf = 2*(ic1 + Nc * ic2);
103  return idx(idf, Ndf, ist, ex); }
104 
105  int idx_Gi(const int ic1, const int ic2, const int ist, const int ex) const
106  { int idf = 1 + 2*(ic1 + Nc * ic2);
107  return idx(idf, Ndf, ist, ex); }
108 
109  int idx_SP(const int in, const int ist, const int ex) const
110  { return idx(in, Nvcd, ist, ex); }
111 
112  int idxh(const int in, const int Nin, const int ist2, const int ex) const
113  { return AIndex_eo_accel::idxh<REALTYPE>(in, Nin, ist2, Nvol2, ex); }
114 
115  int idx_SPr(const int ic, const int id, const int ist, const int ex) const
116  { int in = 2*(ic + Nc * id);
117  return idx_SP(in, ist, ex); }
118 
119  int idx_SPi(const int ic, const int id, const int ist, const int ex) const
120  { int in = 1 + 2*(ic + Nc * id);
121  return idx_SP(in, ist, ex); }
122 
123  int idxh_SP(const int in, const int ist2, const int ex) const
124  { return idxh(in, Nvcd, ist2, ex); }
125 
126  int idxh_SPr(const int ic, const int id, const int ist, const int ex) const
127  { int in = 2*(ic + Nc * id);
128  return idxh_SP(in, ist, ex); }
129 
130  int idxh_SPi(const int ic, const int id, const int ist, const int ex) const
131  { int in = 1 + 2*(ic + Nc * id);
132  return idxh_SP(in, ist, ex); }
133 
134  int idxh_Gr(const int ic1, const int ic2, const int ist, const int ex) const
135  { int in = 2*(ic1 + Nc * ic2);
136  return idxh(in, Ndf, ist, ex); }
137 
138  int idxh_Gi(const int ic1, const int ic2, const int ist, const int ex) const
139  { int in = 1 + 2*(ic1 + Nc * ic2);
140  return idxh(in, Ndf, ist, ex); }
141 
142  int site(const int x2, const int y, const int z, const int t,
143  const int ieo) const
144  { return x2 + Nx2 * (y + Ny * (z + Nz * t)) + Nvol2 * ieo; }
145 
146  int site(const int is, const int ieo) const
147  { return is + Nvol2 * ieo; }
148 
149  int siteh(const int x2, const int y, const int z, const int t)
150  const
151  { return x2 + Nx2 * (y + Ny * (z + Nz * t)); }
152 
153  int nvol_pad() const
154  { return 2 * Nvol2; }
155 
156  int leo(const int y, const int z, const int t) const
157  { return Leo[y + Ny * (z + Nz * t)]; }
158 
159  int ieo_origin() const
160  { return m_ieo_origin; }
161 
162  template <typename AFIELD>
163  void split(AFIELD& v_e, AFIELD& v_o, const AFIELD& v);
164 
165  template <typename AFIELD>
166  void split(AFIELD& v_e, const int ex_e,
167  AFIELD& v_o, const int ex_o,
168  const AFIELD& v, const int ex);
169 
170  template <typename AFIELD>
171  void split_gauge(AFIELD& ueo, const AFIELD& ulex);
172 
173  template <typename AFIELD>
174  void merge(AFIELD& v, const AFIELD& v_e, const AFIELD& v_o);
175 
176 };
177 
178 #endif
AIndex_eo< REALTYPE, ACCEL >::idx_G
int idx_G(const int idf, const int ist, const int ex) const
Definition: aindex_eo.h:98
AIndex_eo< REALTYPE, ACCEL >::Nz
int Nz
Definition: aindex_eo.h:72
bridgeIO.h
merge
void merge(real_t *RESTRICT v, real_t *RESTRICT we, real_t *RESTRICT wo, int ieo_origin, int nin, int *Nsize)
Definition: index_eo_alt_openacc-inc.h:74
AIndex_eo_accel::idx< float >
int idx< float >(const int in, const int Nin, const int ist, const int leo, const int Nvol2, const int ex)
Definition: aindex_eo.h:43
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, ACCEL >::ieo_origin
int ieo_origin() const
Definition: aindex_eo.h:159
AIndex_eo< REALTYPE, ACCEL >::site
int site(const int x, const int y, const int z, const int t) const
Definition: aindex_eo.h:88
AIndex_eo< REALTYPE, ACCEL >::idxh
int idxh(const int in, const int Nin, const int ist2, const int ex) const
Definition: aindex_eo.h:112
AIndex_eo< REALTYPE, ACCEL >::idxh_Gi
int idxh_Gi(const int ic1, const int ic2, const int ist, const int ex) const
Definition: aindex_eo.h:138
AIndex_eo< REALTYPE, ACCEL >::idxh_SPr
int idxh_SPr(const int ic, const int id, const int ist, const int ex) const
Definition: aindex_eo.h:126
AIndex_eo< REALTYPE, ACCEL >::idxh_SPi
int idxh_SPi(const int ic, const int id, const int ist, const int ex) const
Definition: aindex_eo.h:130
AIndex_eo< REALTYPE, ACCEL >::idx_SP
int idx_SP(const int in, const int ist, const int ex) const
Definition: aindex_eo.h:109
AIndex_eo< REALTYPE, ACCEL >::siteh
int siteh(const int x2, const int y, const int z, const int t) const
Definition: aindex_eo.h:149
AIndex_eo< REALTYPE, ACCEL >::Nx2
int Nx2
Definition: aindex_eo.h:73
AIndex_eo_accel::idxh
int idxh(const int in, const int Nin, const int ist2, const int Nvol2, const int ex)
Definition: aindex_eo.h:37
AIndex_eo< REALTYPE, ACCEL >::leo
int leo(const int y, const int z, const int t) const
Definition: aindex_eo.h:156
AIndex_eo< REALTYPE, ACCEL >::idx_Gr
int idx_Gr(const int ic1, const int ic2, const int ist, const int ex) const
Definition: aindex_eo.h:101
AIndex_eo< REALTYPE, ACCEL >::AIndex_eo
AIndex_eo()
constructor.
Definition: aindex_eo.h:86
AIndex_eo< REALTYPE, ACCEL >::nvol_pad
int nvol_pad() const
Definition: aindex_eo.h:153
split
void split(real_t *RESTRICT ve, real_t *RESTRICT vo, real_t *RESTRICT w, int ieo_origin, int nin, int *Nsize)
Definition: index_eo_alt_openacc-inc.h:14
AIndex_eo_accel::idx
int idx(const int in, const int Nin, const int ist, const int leo, const int Nvol2, const int ex)
Definition: aindex_eo.h:28
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, ACCEL >::idx
int idx(const int in, const int Nin, const int ist, const int ex) const
Definition: aindex_eo.h:92
AIndex_eo< REALTYPE, ACCEL >::site
int site(const int is, const int ieo) const
Definition: aindex_eo.h:146
AIndex_eo< REALTYPE, ACCEL >::class_name
static const std::string class_name
Definition: aindex_eo.h:69
aindex_lex.h
AIndex_eo_accel::idxh< float >
int idxh< float >(const int in, const int Nin, const int ist2, const int Nvol2, const int ex)
Definition: aindex_eo.h:52
AIndex_eo_accel
Definition: aindex_eo.h:25
AIndex_eo< REALTYPE, ACCEL >::idxh_SP
int idxh_SP(const int in, const int ist2, const int ex) const
Definition: aindex_eo.h:123
AIndex_eo< REALTYPE, ACCEL >::m_ieo_origin
int m_ieo_origin
parity of local origin site
Definition: aindex_eo.h:75
AIndex_eo< REALTYPE, ACCEL >::idx_SPi
int idx_SPi(const int ic, const int id, const int ist, const int ex) const
Definition: aindex_eo.h:119
ACCEL
@ ACCEL
Definition: alt_impl.h:15
AIndex_eo< REALTYPE, ACCEL >::idxh_Gr
int idxh_Gr(const int ic1, const int ic2, const int ist, const int ex) const
Definition: aindex_eo.h:134
NWP
#define NWP
Definition: define_params.h:32
AIndex_eo< REALTYPE, ACCEL >::site
int site(const int x2, const int y, const int z, const int t, const int ieo) const
Definition: aindex_eo.h:142
commonParameters.h
define_params.h
AIndex_eo< REALTYPE, ACCEL >::idx_Gi
int idx_Gi(const int ic1, const int ic2, const int ist, const int ex) const
Definition: aindex_eo.h:105
Field
Container of Field-type object.
Definition: field.h:46
AIndex_eo< REALTYPE, ACCEL >::m_vl
Bridge::VerboseLevel m_vl
Definition: aindex_eo.h:79
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:45
AIndex_eo< REALTYPE, ACCEL >::Leo
std::vector< int > Leo
Definition: aindex_eo.h:78
aindex_eo_base.h
AIndex_eo< REALTYPE, ACCEL >::Nvcd
int Nvcd
Definition: aindex_eo.h:74
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:572
AIndex_eo
Definition: aindex_eo_base.h:17
AIndex_eo< REALTYPE, ACCEL >::idx_SPr
int idx_SPr(const int ic, const int id, const int ist, const int ex) const
Definition: aindex_eo.h:115