Bridge++  Ver. 1.3.x
index_eo.h
Go to the documentation of this file.
1 
14 #ifndef INDEX_EO_INCLUDED
15 #define INDEX_EO_INCLUDED
16 
17 #include "field_G.h"
18 #include "index_lex.h"
19 
20 #include "bridgeIO.h"
21 using Bridge::vout;
22 
24 
38 class Index_eo {
39  private:
40  int Nx, Ny, Nz, Nt, Nvol;
41  int Nx2, Nvol2;
42  std::valarray<int> Leo;
43  std::valarray<int> Site_up;
44  std::valarray<int> Site_dn;
46 
48  public:
50  Nx(CommonParameters::Nx()),
51  Ny(CommonParameters::Ny()),
52  Nz(CommonParameters::Nz()),
53  Nt(CommonParameters::Nt()),
54  Nvol(CommonParameters::Nvol()),
55  Nx2(CommonParameters::Nx() / 2),
56  Nvol2(CommonParameters::Nvol() / 2),
57  m_vl(CommonParameters::Vlevel())
58  {
59  if ((Nx % 2) == 1) {
60  vout.crucial(m_vl, "Error at Index_eo: Nx is not even\n");
61  exit(EXIT_FAILURE);
62  }
63 
64  Leo.resize(Ny * Nz * Nt);
65  Site_up.resize(Nx2 * Ny * Nz * Nt * 2);
66  Site_dn.resize(Nx2 * Ny * Nz * Nt * 2);
67 
68  for (int t = 0; t < Nt; ++t) {
69  for (int z = 0; z < Nz; ++z) {
70  for (int y = 0; y < Ny; ++y) {
71  int t2 = Communicator::ipe(3) * Nt + t;
72  int z2 = Communicator::ipe(2) * Nz + z;
73  int y2 = Communicator::ipe(1) * Ny + y;
74  Leo[y + Ny * (z + Nz * t)] = (y2 + z2 + t2) % 2;
75  }
76  }
77  }
78 
79  for (int t = 0; t < Nt; ++t) {
80  for (int z = 0; z < Nz; ++z) {
81  for (int y = 0; y < Ny; ++y) {
82  int yzt = y + Ny * (z + Nz * t);
83  // int t2 = t;
84  // int z2 = z;
85  // int y2 = y;
86  for (int x2 = 0; x2 < Nx2; ++x2) {
87  int s = x2 + Nx2 * (y + Ny * (z + Nz * t));
88  Site_up[s] = ((x2 + Leo[yzt]) % Nx2) + Nx2 * (y + Ny * (z + Nz * t));
89  Site_up[s + Nvol2] = ((x2 + 1 - Leo[yzt]) % Nx2) + Nx2 * (y + Ny * (z + Nz * t));
90  Site_dn[s] = ((x2 - 1 + Leo[yzt] + Nx2) % Nx2) + Nx2 * (y + Ny * (z + Nz * t));
91  Site_dn[s + Nvol2] = ((x2 - Leo[yzt] + Nx2) % Nx2) + Nx2 * (y + Ny * (z + Nz * t));
92  }
93  }
94  }
95  }
96  }
97 
98  int leo(const int y, const int z, const int t) const
99  {
100  return Leo[y + Ny * (z + Nz * t)];
101  }
102 
103  int site(const int x2, const int y, const int z, const int t,
104  const int ieo) const
105  {
106  return x2 + Nx2 * (y + Ny * (z + Nz * t)) + Nvol2 * ieo;
107  }
108 
109  int site(const int is, const int ieo) const
110  {
111  return is + Nvol2 * ieo;
112  }
113 
114  int site_up(const int x2, const int y, const int z, const int t,
115  const int ieo) const
116  {
117  int s = x2 + Nx2 * (y + Ny * (z + Nz * t)) + Nvol2 * ieo;
118 
119  return Site_up[s] + Nvol2 * (1 - ieo);
120  }
121 
122  int site_xup(const int x2, const int y, const int z, const int t,
123  const int ieo) const
124  {
125  int s = x2 + Nx2 * (y + Ny * (z + Nz * t)) + Nvol2 * ieo;
126 
127  return Site_up[s] + Nvol2 * (1 - ieo);
128  }
129 
130  int site_dn(const int x2, const int y, const int z, const int t,
131  const int ieo) const
132  {
133  int s = x2 + Nx2 * (y + Ny * (z + Nz * t)) + Nvol2 * ieo;
134 
135  return Site_dn[s] + Nvol2 * (1 - ieo);
136  }
137 
138  int site_xdn(const int x2, const int y, const int z, const int t,
139  const int ieo) const
140  {
141  int s = x2 + Nx2 * (y + Ny * (z + Nz * t)) + Nvol2 * ieo;
142 
143  return Site_dn[s] + Nvol2 * (1 - ieo);
144  }
145 
146  int siteh(const int x2, const int y, const int z, const int t)
147  const
148  {
149  return x2 + Nx2 * (y + Ny * (z + Nz * t));
150  }
151 
152  int siteh_up(const int x2, const int y, const int z, const int t,
153  const int ieo) const
154  {
155  int s = x2 + Nx2 * (y + Ny * (z + Nz * t)) + Nvol2 * ieo;
156 
157  return Site_up[s];
158  }
159 
160  int siteh_xup(const int x2, const int y, const int z, const int t,
161  const int ieo) const
162  {
163  int s = x2 + Nx2 * (y + Ny * (z + Nz * t)) + Nvol2 * ieo;
164 
165  return Site_up[s];
166  }
167 
168  int siteh_dn(const int x2, const int y, const int z, const int t,
169  const int ieo) const
170  {
171  int s = x2 + Nx2 * (y + Ny * (z + Nz * t)) + Nvol2 * ieo;
172 
173  return Site_dn[s];
174  }
175 
176  int siteh_xdn(const int x2, const int y, const int z, const int t,
177  const int ieo) const
178  {
179  int s = x2 + Nx2 * (y + Ny * (z + Nz * t)) + Nvol2 * ieo;
180 
181  return Site_dn[s];
182  }
183 
184  void convertField(Field& eo, const Field& lex);
185  void convertField(Field& eo, const Field& lex, const int ieo);
186 
187  void reverseField(Field& lex, const Field& eo);
188  void reverseField(Field& lex, const Field& eo, const int ieo);
189 
190  void splitField(Field& e, Field& o, const Field& eo);
191 
192  void mergeField(Field& eo, const Field& e, const Field& o);
193 };
194 #endif
Index_eo()
Definition: index_eo.h:49
BridgeIO vout
Definition: bridgeIO.cpp:278
int site_xup(const int x2, const int y, const int z, const int t, const int ieo) const
Definition: index_eo.h:122
int siteh(const int x2, const int y, const int z, const int t) const
Definition: index_eo.h:146
int site(const int is, const int ieo) const
Definition: index_eo.h:109
Container of Field-type object.
Definition: field.h:39
int site(const int x2, const int y, const int z, const int t, const int ieo) const
Definition: index_eo.h:103
int site_up(const int x2, const int y, const int z, const int t, const int ieo) const
Definition: index_eo.h:114
static int ipe(const int dir)
logical coordinate of current proc.
Even-odd site index.
Definition: index_eo.h:38
void convertField(Field &eo, const Field &lex)
Definition: index_eo.cpp:20
int leo(const int y, const int z, const int t) const
Definition: index_eo.h:98
int Nt
Definition: index_eo.h:40
void mergeField(Field &eo, const Field &e, const Field &o)
Definition: index_eo.cpp:168
int siteh_up(const int x2, const int y, const int z, const int t, const int ieo) const
Definition: index_eo.h:152
int siteh_xup(const int x2, const int y, const int z, const int t, const int ieo) const
Definition: index_eo.h:160
int Nvol2
Definition: index_eo.h:41
int siteh_xdn(const int x2, const int y, const int z, const int t, const int ieo) const
Definition: index_eo.h:176
int Nx2
Definition: index_eo.h:41
int site_xdn(const int x2, const int y, const int z, const int t, const int ieo) const
Definition: index_eo.h:138
Common parameter class: provides parameters as singleton.
Lexical site index.
Definition: index_lex.h:34
int Nx
Definition: index_eo.h:40
Bridge::VerboseLevel m_vl
Definition: index_eo.h:47
std::valarray< int > Site_up
Definition: index_eo.h:43
int site_dn(const int x2, const int y, const int z, const int t, const int ieo) const
Definition: index_eo.h:130
std::valarray< int > Site_dn
Definition: index_eo.h:44
void crucial(const char *format,...)
Definition: bridgeIO.cpp:48
Index_lex m_index_lex
Definition: index_eo.h:45
VerboseLevel
Definition: bridgeIO.h:39
int siteh_dn(const int x2, const int y, const int z, const int t, const int ieo) const
Definition: index_eo.h:168
void reverseField(Field &lex, const Field &eo)
Definition: index_eo.cpp:110
void splitField(Field &e, Field &o, const Field &eo)
Definition: index_eo.cpp:140
std::valarray< int > Leo
Definition: index_eo.h:42
int Nz
Definition: index_eo.h:40
int Nvol
Definition: index_eo.h:40
int Ny
Definition: index_eo.h:40