GLAC  1.0
index.h
Go to the documentation of this file.
1 
11 #ifndef INDEX_H
12 #define INDEX_H
13 
14 #include <vector>
15 
16 namespace Parallel {
17  class Index
18  {
19  private:
20  static std::vector<unsigned int> m_N;
21  static std::vector<long long> m_NTot;
22  public:
23  Index();
24  ~Index();
25 
26  // Index getter
27  static inline unsigned long cubeIndex(unsigned long int i, unsigned long int j, unsigned long int k, unsigned long int Ni, unsigned long int Nj) {
28  return i + Ni*(j + Nj*k);
29  }
30 
31  static inline unsigned long getIndex(unsigned int i, unsigned int j, unsigned int k, unsigned int l) {
32  return i + m_N[0]*(j + m_N[1]*(k + m_N[2]*l));
33  }
34 
35  static inline long long getGlobalIndex(long long i, long long j, long long k, long long l) {
36  return i + m_NTot[0]*(j + m_NTot[1]*(k + m_NTot[2]*l)); // column-major
37  }
38 
39  // Setters
40  static void setN(std::vector<unsigned int> N);
41  static void setNTot(unsigned int NSpatial, unsigned int NTemporal);
42  };
43 }
44 #endif // INDEX_H
static unsigned long cubeIndex(unsigned long int i, unsigned long int j, unsigned long int k, unsigned long int Ni, unsigned long int Nj)
Definition: index.h:27
static unsigned long getIndex(unsigned int i, unsigned int j, unsigned int k, unsigned int l)
Definition: index.h:31
~Index()
Definition: index.cpp:13
Index()
Definition: index.cpp:6
Definition: index.h:17
Parallel contains all of the relevant methods for communicating between the lattices.
Definition: communicator.h:17
static long long getGlobalIndex(long long i, long long j, long long k, long long l)
Definition: index.h:35
static void setNTot(unsigned int NSpatial, unsigned int NTemporal)
Parallel::Index::setNTot sets the total lattice dimensionality.
Definition: index.cpp:39
static void setN(std::vector< unsigned int > N)
Parallel::Index::setN sets the sub lattice dimensionality.
Definition: index.cpp:24