16#include "plumbing/lattice.h"
18#if defined(NODE_LAYOUT_TRIVIAL)
25 hila::out0 <<
"Node remapping: NODE_LAYOUT_TRIVIAL (no reordering)\n";
26 lattice->nodes.map_array =
nullptr;
27 lattice->nodes.map_inverse =
nullptr;
34int lattice_struct::allnodes::inverse_remap(
int i)
const {
39#elif defined(NODE_LAYOUT_BLOCK)
65 while (found && nblocks > 1) {
71 for (div = 2; div <= 5; div++)
72 if (nblocks % div == 0 && blockdivs[d] % div == 0)
83 hila::out0 <<
"Node block size " << blocksize <<
" block division " << blockdivs <<
'\n';
88 this->map_array = (
int *)memalloc(this->number *
sizeof(
int));
89 this->map_inverse = (
int *)memalloc(this->number *
sizeof(
int));
97 for (
int i = 0; i < this->number; i++) {
103 lcoord[d] = idiv % this->n_divisions[d];
104 idiv /= this->n_divisions[d];
106 bcoord[d] = lcoord[d] / blocksize[d];
107 icoord[d] = lcoord[d] % blocksize[d];
116 ii += icoord[d] * im;
119 bi += bcoord[d] * bm;
126 this->map_array[i] = bi * nblocks + ii;
127 this->map_inverse[bi * nblocks + ii] = i;
135 return this->map_array[i];
138int lattice_struct::allnodes::inverse_remap(
int i)
const {
140 return this->map_inverse[i];
const auto & fill(const S rhs)
Matrix fill.
#define foralldir(d)
Macro to loop over (all) Direction(s)
This file defines all includes for HILA.
int number_of_nodes()
how many nodes there are
std::ostream out0
This writes output only from main process (node 0)
#define NODE_LAYOUT_BLOCK
int remap(int i) const
And the call interface for remapping.