-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGrid.java
More file actions
42 lines (32 loc) · 1.12 KB
/
Grid.java
File metadata and controls
42 lines (32 loc) · 1.12 KB
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
package simulation;
import java.awt.Point;
public abstract class Grid {
protected double[][] _points;
protected double _ß = 1; // Inverse temperature
protected int _D; // Dimension of the grid
public double getß(){
return _ß;
}
public void setß(double ß){
_ß = ß;
}
public Point getRandomPosition(){
int x = (int)Math.round( (Math.random()*(_D)) - .5 );
int y = (int)Math.round( (Math.random()*(_D)) - .5 );
return new Point(x,y);
}
public int getSize(){
return _D;
}
public void setValue(int x, int y, double value){
_points[x][y] = value;
}
public double getValue(int x, int y){
return _points[x][y];
}
public abstract void clusterUpdate();
public abstract void metropolisUpdate();
public abstract double getMagnetization();
public abstract double getHamiltonian();
public abstract Grid getBlockedGrid(); // Returns a new grid of smaller dimension whose configuration is determined by this Grid via a specified blocking procedure. This allows for the determination of scaling laws and renormalization group flow on the statistical system.
}