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