10#include "plumbing/lattice.h"
16static int prime[NPRIMES] = {2, 3, 5, 7, 11, 13, 17, 19, 23};
22void lattice_struct::setup_layout() {
23 int i, msize, dir, nfactors[NPRIMES], nodesiz[NDIM];
25 hila::out0 <<
"Standard lattice layout:\n " << NDIM <<
" dimensions\n";
39 for (
int n = 0; n < NPRIMES; n++) {
41 while (i % prime[n] == 0) {
48 << prime[NPRIMES - 1] <<
'\n';
52 for (i = 0; i < NDIM; i++) {
54 nodes.n_divisions[i] = 1;
57 for (
int n = NPRIMES - 1; n >= 0; n--)
58 for (i = 0; i < nfactors[n]; i++) {
66 for (msize = 1, dir = 0; dir < NDIM; dir++)
67 if (nodesiz[dir] > msize && nodesiz[dir] % prime[n] == 0)
79 for (dir = NDIM - 1; dir >= 0; dir--)
80 if (nodesiz[dir] == msize && nodes.n_divisions[dir] > 1 &&
81 nodesiz[dir] % prime[n] == 0)
86 for (dir = NDIM - 1; dir >= 0; dir--)
87 if (nodesiz[dir] == msize && nodesiz[dir] % prime[n] == 0)
92 hila::out0 <<
"CANNOT HAPPEN! in setup_layout_simple\n";
97 nodesiz[dir] /= prime[n];
98 nodes.n_divisions[dir] *= prime[n];
104 nodes.divisors[dir].resize(nodes.n_divisions[dir] + 1);
106 for (
int i = 0; i <= nodes.n_divisions[dir]; i++)
107 nodes.divisors[dir].at(i) = i * nodesiz[dir];
#define foralldir(d)
Macro to loop over (all) Direction(s)
This file defines all includes for HILA.
int myrank()
rank of this node
int number_of_nodes()
how many nodes there are
std::ostream out0
This writes output only from main process (node 0)
void finishrun()
Normal, controlled exit - all nodes must call this. Prints timing information and information about c...