forked from lhayward/ON_Model
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hyperrectangle.h
63 lines (54 loc) · 2.34 KB
/
Hyperrectangle.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**********************************************************************************************
************************************ OPE COEFFICIENTS CODE ************************************
***********************************************************************************************
* Lauren E. Hayward Sierens
***********************************************************************************************
* File: Hyperrectangle.h
* Description: Note that L_[0] == Lx = lattice length along x
* L_[1] == Ly = lattice length along y
* .
* .
* .
*
* The vertices are labelled along the x-direction, followed by the
* y-direction, etc.
* So for example, the first Lx*Ly vertices (in the x-y plane in D>=2) are:
* (Lx*Ly - Lx) (Lx*Ly - Lx + 1) . . . (Lx*Ly - 1)
* . . .
* . . .
* . . .
* Lx Lx+1 . . . 2Lx - 1
* 0 1 . . . Lx-1
**********************************************************************************************/
#ifndef HYPERRECTANGLE_H
#define HYPERRECTANGLE_H
#include <cmath>
#include <fstream>
class Hyperrectangle
{
public:
typedef unsigned int uint;
private:
uint N_; //total number of lattice sites
uint z_; //number of nearest neighbouring sites for each site
uint D_; //dimension
uint* L_; //length in each dimension
uint** neighbours_; //coordinates of each vertex's nearest neighbours
void initNeighbours();
int round(double num);
//void trimWhiteSpace(std::string* word);
uint nextInDir(uint dir); //used by initNeighbours method
uint uintPower(uint base, uint exp);
public:
Hyperrectangle(std::ifstream* fin, std::string fileName);
virtual ~Hyperrectangle();
uint getNeighbour(uint i, uint j);
void printParams();
void printNeighbours();
//getter methods:
uint getN();
uint getZ();
uint getD();
uint* getL();
};
#endif // HYPERRECTANGLE_H