Bridge++  Ver. 2.0.2
aindex_eo-inc.h
Go to the documentation of this file.
1 
10 #include <assert.h>
11 
14 
15 //====================================================================
16 template<typename REALTYPE>
17 template<typename AFIELD>
19  AFIELD& field_o,
20  const AFIELD& field_lex)
21 {
22  int Nin = field_lex.nin();
23  int Nex = field_lex.nex();
24  int Nvol = field_lex.nvol();
25  int Nvol2 = Nvol / 2;
26 
27  assert(field_e.check_size(Nin, Nvol2, Nex));
28  assert(field_o.check_size(Nin, Nvol2, Nex));
29 
30  AIndex_lex<REALTYPE, QXS> index_lex;
31 
32  for (int ex = 0; ex < Nex; ++ex) {
33  for (int ist = 0; ist < Nvol; ++ist) {
34  int ix = ist % Nx;
35  int iyzt = ist / Nx;
36  int ist2 = ist / 2;
37  int ieo = (ix + Leo[iyzt]) % 2;
38  if (ieo == 0) {
39  for (int in = 0; in < Nin; ++in) {
40  int index1 = index_lex.idx(in, Nin, ist, ex);
41  int index2 = idxh(in, Nin, ist2, ex);
42  field_e.set(index2, field_lex.cmp(index1));
43  }
44  } else {
45  for (int in = 0; in < Nin; ++in) {
46  int index1 = index_lex.idx(in, Nin, ist, ex);
47  int index2 = idxh(in, Nin, ist2, ex);
48  field_o.set(index2, field_lex.cmp(index1));
49  }
50  }
51  }
52  }
53 }
54 
55 
56 //====================================================================
57 template<typename REALTYPE>
58 template<typename AFIELD>
60  const AFIELD& field_e,
61  const AFIELD& field_o)
62 {
63  int Nin = field_lex.nin();
64  int Nex = field_lex.nex();
65  int Nvol = field_lex.nvol();
66  int Nvol2 = Nvol / 2;
67 
68  assert(field_e.check_size(Nin, Nvol2, Nex));
69  assert(field_o.check_size(Nin, Nvol2, Nex));
70 
71  AIndex_lex<REALTYPE, QXS> index_lex;
72 
73  for (int ex = 0; ex < Nex; ++ex) {
74  for (int ist = 0; ist < Nvol; ++ist) {
75  int ix = ist % Nx;
76  int iyzt = ist / Nx;
77  int ist2 = ist / 2;
78  int ieo = (ix + Leo[iyzt]) % 2;
79  if (ieo == 0) {
80  for (int in = 0; in < Nin; ++in) {
81  int index1 = index_lex.idx(in, Nin, ist, ex);
82  int index2 = idxh(in, Nin, ist2, ex);
83  field_lex.set(index1, field_e.cmp(index2));
84  }
85  } else {
86  for (int in = 0; in < Nin; ++in) {
87  int index1 = index_lex.idx(in, Nin, ist, ex);
88  int index2 = idxh(in, Nin, ist2, ex);
89  field_lex.set(index1, field_o.cmp(index2));
90  }
91  }
92  }
93  }
94 }
95 
96 
97 //============================================================END=====
afield.h
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
Field::set
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
Field::nex
int nex() const
Definition: field.h:128
Field::check_size
bool check_size(const int nin, const int nvol, const int nex) const
checking size parameters. [23 May 2016 H.Matsufuru]
Definition: field.h:135
Field::nin
int nin() const
Definition: field.h:126
aindex_eo.h
Field::nvol
int nvol() const
Definition: field.h:127
AIndex_lex< REALTYPE, QXS >
Lexical site index.
Definition: aindex_lex.h:80
AIndex_lex< REALTYPE, QXS >::idx
int idx(const int in, const int Nin, const int ist, const int ex) const
Definition: aindex_lex.h:125
Field::cmp
double cmp(const int jin, const int site, const int jex) const
Definition: field.h:143
Field
Container of Field-type object.
Definition: field.h:46
AIndex_eo
Definition: aindex_eo_base.h:17