Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
index_eo.cpp
Go to the documentation of this file.
1 
15 #include "index_eo.h"
16 
17 #include <assert.h>
18 
19 //====================================================================
20 void Index_eo::convertField(Field& field_eo, const Field& field_lex)
21 {
22  assert(field_eo.nin() == field_lex.nin());
23  assert(field_eo.nex() == field_lex.nex());
24  assert(m_Nvol == field_lex.nvol());
25  assert(m_Nvol == field_eo.nvol());
26 
27  const int Nin = field_lex.nin();
28  const int Nex = field_lex.nex();
29 
30  for (int t = 0; t < m_Nt; ++t) {
31  for (int z = 0; z < m_Nz; ++z) {
32  for (int y = 0; y < m_Ny; ++y) {
33  for (int x = 0; x < m_Nx; ++x) {
34  int x2 = x / 2;
35  int ieo = (x + y + z + t + m_node_eo) % 2;
36  for (int ex = 0; ex < Nex; ex++) {
37  for (int in = 0; in < Nin; in++) {
38  field_eo.set(in, site(x2, y, z, t, ieo), ex,
39  field_lex.cmp(in, m_index_lex.site(x, y, z, t), ex));
40  }
41  }
42  }
43  }
44  }
45  }
46 }
47 
48 
49 //====================================================================
50 void Index_eo::convertField(Field& field_eo, const Field& field_lex,
51  const int ieo)
52 {
53  assert(field_eo.nin() == field_lex.nin());
54  assert(field_eo.nex() == field_lex.nex());
55  assert(m_Nvol == field_lex.nvol());
56  assert(m_Nvol2 == field_eo.nvol());
57 
58  const int Nin = field_lex.nin();
59  const int Nex = field_lex.nex();
60 
61  for (int t = 0; t < m_Nt; ++t) {
62  for (int z = 0; z < m_Nz; ++z) {
63  for (int y = 0; y < m_Ny; ++y) {
64  for (int x2 = 0; x2 < m_Nx2; ++x2) {
65  int x = 2 * x2 + ((y + z + t + m_node_eo + ieo) % 2);
66 
67  for (int ex = 0; ex < Nex; ex++) {
68  for (int in = 0; in < Nin; in++) {
69  field_eo.set(in, siteh(x2, y, z, t), ex,
70  field_lex.cmp(in, m_index_lex.site(x, y, z, t), ex));
71  }
72  }
73  }
74  }
75  }
76  }
77 }
78 
79 
80 //====================================================================
81 void Index_eo::reverseField(Field& field_lex, const Field& field_eo,
82  const int ieo)
83 {
84  assert(field_eo.nin() == field_lex.nin());
85  assert(field_eo.nex() == field_lex.nex());
86  assert(m_Nvol == field_lex.nvol());
87  assert(m_Nvol2 == field_eo.nvol());
88 
89  const int Nin = field_lex.nin();
90  const int Nex = field_lex.nex();
91 
92  for (int t = 0; t < m_Nt; ++t) {
93  for (int z = 0; z < m_Nz; ++z) {
94  for (int y = 0; y < m_Ny; ++y) {
95  for (int x2 = 0; x2 < m_Nx2; ++x2) {
96  int x = 2 * x2 + ((y + z + t + m_node_eo + ieo) % 2);
97 
98  for (int ex = 0; ex < Nex; ex++) {
99  for (int in = 0; in < Nin; in++) {
100  field_lex.set(in, m_index_lex.site(x, y, z, t), ex,
101  field_eo.cmp(in, siteh(x2, y, z, t), ex));
102  }
103  }
104  }
105  }
106  }
107  }
108 }
109 
110 
111 //====================================================================
112 void Index_eo::reverseField(Field& field_lex, const Field& field_eo)
113 {
114  assert(field_eo.nin() == field_lex.nin());
115  assert(field_eo.nex() == field_lex.nex());
116  assert(m_Nvol == field_lex.nvol());
117  assert(m_Nvol == field_eo.nvol());
118 
119  const int Nin = field_lex.nin();
120  const int Nex = field_lex.nex();
121 
122  for (int t = 0; t < m_Nt; ++t) {
123  for (int z = 0; z < m_Nz; ++z) {
124  for (int y = 0; y < m_Ny; ++y) {
125  for (int x = 0; x < m_Nx; ++x) {
126  int x2 = x / 2;
127  int ieo = (x + y + z + t + m_node_eo) % 2;
128 
129  for (int ex = 0; ex < Nex; ex++) {
130  for (int in = 0; in < Nin; in++) {
131  field_lex.set(in, m_index_lex.site(x, y, z, t), ex,
132  field_eo.cmp(in, site(x2, y, z, t, ieo), ex));
133  }
134  }
135  }
136  }
137  }
138  }
139 }
140 
141 
142 //====================================================================
143 void Index_eo::splitField(Field& field_e, Field& field_o,
144  const Field& field_eo)
145 {
146  const int Nin = field_eo.nin();
147  const int Nex = field_eo.nex();
148 
149  assert(field_e.nin() == Nin);
150  assert(field_e.nex() == Nex);
151 
152  assert(field_o.nin() == Nin);
153  assert(field_o.nex() == Nex);
154 
155  const int Nvol2 = field_eo.nvol() / 2;
156 
157  for (int iex = 0; iex < Nex; ++iex) {
158  for (int ivol = 0; ivol < Nvol2; ++ivol) {
159  for (int iin = 0; iin < Nin; ++iin) {
160  field_e.set(iin, ivol, iex,
161  field_eo.cmp(iin, ivol, iex));
162  field_o.set(iin, ivol, iex,
163  field_eo.cmp(iin, ivol + Nvol2, iex));
164  }
165  }
166  }
167 }
168 
169 
170 //====================================================================
172  const Field& field_e, const Field& field_o)
173 {
174  const int Nin = field_eo.nin();
175  const int Nex = field_eo.nex();
176 
177  assert(field_e.nin() == Nin);
178  assert(field_e.nex() == Nex);
179 
180  assert(field_o.nin() == Nin);
181  assert(field_o.nex() == Nex);
182 
183  const int Nvol2 = field_eo.nvol() / 2;
184 
185  for (int iex = 0; iex < Nex; ++iex) {
186  for (int ivol = 0; ivol < Nvol2; ++ivol) {
187  for (int iin = 0; iin < Nin; ++iin) {
188  field_eo.set(iin, ivol, iex,
189  field_e.cmp(iin, ivol, iex));
190  field_eo.set(iin, ivol + Nvol2, iex,
191  field_o.cmp(iin, ivol, iex));
192  }
193  }
194  }
195 }
196 
197 
198 //====================================================================
199 //============================================================END=====
int m_Ny
Definition: index_eo.h:42
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
int site(const int &x, const int &y, const int &z, const int &t) const
Definition: index_lex.h:53
int siteh(const int x2, const int y, const int z, const int t) const
Definition: index_eo.h:157
int m_Nx
Definition: index_eo.h:42
Container of Field-type object.
Definition: field.h:45
int nvol() const
Definition: field.h:127
double cmp(const int jin, const int site, const int jex) const
Definition: field.h:143
int site(const int x2, const int y, const int z, const int t, const int ieo) const
Definition: index_eo.h:114
void convertField(Field &eo, const Field &lex)
Definition: index_eo.cpp:20
int nin() const
Definition: field.h:126
void mergeField(Field &eo, const Field &e, const Field &o)
Definition: index_eo.cpp:171
int m_Nt
Definition: index_eo.h:42
int m_node_eo
Definition: index_eo.h:48
int nex() const
Definition: field.h:128
int m_Nvol
Definition: index_eo.h:42
Index_lex m_index_lex
Definition: index_eo.h:47
void reverseField(Field &lex, const Field &eo)
Definition: index_eo.cpp:112
void splitField(Field &e, Field &o, const Field &eo)
Definition: index_eo.cpp:143
int m_Nvol2
Definition: index_eo.h:43
int m_Nz
Definition: index_eo.h:42
int m_Nx2
Definition: index_eo.h:43