22 static int m_processRank;
24 static int m_Nx, m_Ny, m_Nz, m_Nt;
26 static void generateNeighbourList();
27 static std::vector<NeighbourList> m_neighbourLists;
39 static inline int getXPlusOne(
int Np) {
40 if (((Np + 1) % m_Nx) == 0) {
41 return (Np/m_Nx) * m_Nx;
47 static inline int getXMinusOne(
int Np) {
48 int x_count = (Np - 1 + m_Nx) % m_Nx;
49 int y_count = (Np/m_Nx) * m_Nx;
50 return x_count + y_count;
53 static inline int getYPlusOne(
int Np) {
54 if ((((Np / m_Nx) + 1) % m_Ny) == 0) {
55 int x_count = Np % m_Nx;
56 int y_count = (Np / (m_Ny*m_Nx)) * (m_Nx*m_Ny);
57 return x_count + y_count;
63 static inline int getYMinusOne(
int Np) {
64 int x_count = Np % m_Nx;
65 int y_count = (((Np/m_Nx) - 1 + m_Ny) % m_Ny) * m_Nx;
66 int z_count = (Np/(m_Nx * m_Ny)) * (m_Nx*m_Ny);
67 return x_count + y_count + z_count;
70 static inline int getZPlusOne(
int Np) {
71 if (((Np/(m_Nx*m_Ny) + 1) % m_Nz) == 0) {
72 int x_count = Np % m_Nx;
73 int y_count = ((Np/m_Nx) % m_Ny) * m_Nx;
74 int t_count = ((Np/(m_Nx*m_Ny*m_Nz)) % m_Nt) * (m_Nx*m_Ny*m_Nz);
75 return x_count + y_count + t_count;
77 return Np + m_Nx*m_Ny;
81 static inline int getZMinusOne(
int Np) {
82 int x_count = Np % m_Nx;
83 int y_count = ((Np/m_Nx) % m_Ny) * m_Nx;
84 int z_count = ((Np/(m_Nx*m_Ny) - 1 + m_Nz) % m_Nz) * (m_Nx*m_Ny);
85 int t_count = (Np/(m_Nx*m_Ny*m_Nz)) * (m_Nx*m_Ny*m_Nz);
86 return x_count + y_count + z_count + t_count;
89 static inline int getTPlusOne(
int Np) {
90 if ((((Np/(m_Nx*m_Ny*m_Nz)) + 1) % m_Nt) == 0) {
91 int x_count = Np % m_Nx;
92 int y_count = ((Np/m_Nx) % m_Ny) * m_Nx;
93 int z_count = (Np/(m_Nx*m_Ny) % m_Nz) * (m_Nx*m_Ny);
94 return x_count + y_count + z_count;
96 return Np + m_Nx*m_Ny*m_Nz;
100 static inline int getTMinusOne(
int Np) {
101 int x_count = Np % m_Nx;
102 int y_count = ((Np/m_Nx) % m_Ny) * m_Nx;
103 int z_count = (Np/(m_Nx*m_Ny) % m_Nz) * (m_Nx*m_Ny);
104 int t_count = ((Np/(m_Nx*m_Ny*m_Nz) - 1 + m_Nt) % m_Nt) * (m_Nx*m_Ny*m_Nz);
105 return x_count + y_count + z_count + t_count;
111 static void initialize(
int processRank,
int numproc,
int * processorsPerDim);
118 static int get(
int iProcDir) {
return m_neighbourLists[m_processRank][iProcDir]; }
127 #endif // NEIGHBOURS_H static NeighbourList * getNeighbours(int Np)
Parallel::Neighbours::getNeighbours returns a reference to the neighbour list of given process rank.
Definition: neighbours.cpp:71
Definition: neighbourlist.h:22
static int get(int iProcDir)
get returns the neighbourlist for the the calling processor/rank and the direction given py iProcDir.
Definition: neighbours.h:118
Neighbours()
Definition: neighbours.cpp:12
Parallel contains all of the relevant methods for communicating between the lattices.
Definition: communicator.h:17
static void initialize(int processRank, int numproc, int *processorsPerDim)
Parallel::Neighbours::initialize initializes.
Definition: neighbours.cpp:26
Definition: neighbours.h:19
static int getListLength()
Definition: neighbours.h:122
static long getProcessorDimensionPosition(int dim)
Definition: neighbours.h:123
~Neighbours()
Definition: neighbours.cpp:16