10 #ifndef QXS_AINDEX_BLOCK_LEX_INCLUDED
11 #define QXS_AINDEX_BLOCK_LEX_INCLUDED
18 #include "lib_alt_QXS/inline/define_vlen.h"
19 #include "lib_alt_QXS/inline/define_params.h"
30 template<
typename REALTYPE>
34 int m_coarse_lattice[4];
35 int m_fine_lattice[4];
47 std::vector<int> fine_lattice(4);
52 init(coarse_lattice, fine_lattice);
56 const std::vector<int>& fine_lattice)
57 { init(coarse_lattice, fine_lattice); }
62 {
return m_coarse_lattice[mu]; }
65 {
return m_fine_lattice[mu]; }
68 {
return m_block_size[mu]; }
77 {
return m_block_eo[block_idx]; }
80 const int block_idx)
const
82 int idx_tmp = block_idx;
83 ibx = idx_tmp % m_coarse_lattice[0];
84 idx_tmp = idx_tmp / m_coarse_lattice[0];
85 iby = idx_tmp % m_coarse_lattice[1];
86 idx_tmp = idx_tmp / m_coarse_lattice[1];
87 ibz = idx_tmp % m_coarse_lattice[2];
88 ibt = idx_tmp / m_coarse_lattice[2];
93 void init(
const std::vector<int>& coarse_lattice,
94 const std::vector<int>& fine_lattice)
99 for (
int mu = 0; mu < 4; ++mu) {
100 m_coarse_lattice[mu] = coarse_lattice[mu];
101 m_fine_lattice[mu] = fine_lattice[mu];
102 if (m_fine_lattice[mu] % m_coarse_lattice[mu] != 0) {
107 m_block_size[mu] = fine_lattice[mu] / coarse_lattice[mu];
108 m_coarse_nvol *= m_coarse_lattice[mu];
109 m_fine_nvol *= m_fine_lattice[mu];
110 m_block_nvol *= m_block_size[mu];
115 if (
sizeof(REALTYPE) == 4) {
117 }
else if (
sizeof(REALTYPE) == 8) {
120 vout.
crucial(
"index_block_lex_alt: unkown REALTYPE\n");
123 if (m_coarse_nvol % vlen != 0) {
124 vout.
crucial(
"index_block_lex_alt: bad coarse_novl (too small?), must be multiple of VLEN\n");
125 vout.
crucial(
" coarse_nvol=%d, coarse_lattice = %d %d %d %d\n", m_coarse_nvol, m_coarse_lattice[0], m_coarse_lattice[1], m_coarse_lattice[2], m_coarse_lattice[3]);
129 m_block_eo.resize(m_coarse_nvol);
130 int NBx = m_coarse_lattice[0];
131 int NBy = m_coarse_lattice[1];
132 int NBz = m_coarse_lattice[2];
133 int NBt = m_coarse_lattice[3];
138 int Ieo = (NBx * ipex + NBy * ipey + NBz * ipez + NBt * ipet) % 2;
139 for (
int block_idx = 0; block_idx < m_coarse_nvol; ++block_idx) {
141 get_coarse_coord(kx, ky, kz, kt, block_idx);
142 m_block_eo[block_idx] = (Ieo + kx + ky + kz + kt) % 2;