-
Notifications
You must be signed in to change notification settings - Fork 9
/
positionfcns.mod
60 lines (53 loc) · 1.47 KB
/
positionfcns.mod
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
NEURON {
SUFFIX nothing
}
: gmin - the starting gid for this type of cell
FUNCTION get_x_pos(gid, gmin, BinNumX, BinNumYZ, binSizeX) {
LOCAL CellNum, tmp
CellNum=gid - gmin+1
tmp = floor((CellNum-1)/BinNumYZ)
get_x_pos = fmod(tmp,BinNumX)*binSizeX+binSizeX/2.0
:printf("---get_x_pos=%f\n", get_x_pos)
}
FUNCTION get_y_pos(gid, gmin, BinNumY, BinNumZ, binSizeY) {
LOCAL CellNum, tmp, pos
CellNum=gid - gmin+1
tmp = floor((CellNum-1)/BinNumZ)
get_y_pos = fmod(tmp,BinNumY)*binSizeY+binSizeY/2.0
}
FUNCTION get_z_pos(gid, gmin, BinNumZ, binSizeZ, ZHeight) {
LOCAL CellNum, pos
CellNum=gid - gmin+1
get_z_pos = fmod((CellNum-1),BinNumZ)*binSizeZ+binSizeZ/2+ZHeight
}
COMMENT
VERBATIM
static double get_x_pos (int gid, int gmin, int BinNumX, int BinNumYZ, int binSizeX) {
double pos;
int CellNum, tmp;
CellNum=gid - gmin+1;
tmp = floor((CellNum-1)/BinNumYZ);
pos = (tmp%BinNumX)*binSizeX+binSizeX/2.0;
return pos;
}
ENDVERBATIM
VERBATIM
static double get_y_pos (int gid, int gmin, int BinNumY, int BinNumZ, int binSizeY) {
double pos;
int CellNum, tmp;
CellNum=gid - gmin+1;
tmp = floor((CellNum-1)/BinNumZ);
pos = (tmp%BinNumY)*binSizeY+binSizeY/2.0;
return pos;
}
ENDVERBATIM
VERBATIM
static double get_z_pos (int gid, int gmin, int BinNumZ, int binSizeZ, int ZHeight) {
double pos;
int CellNum;
CellNum=gid - gmin+1;
pos = ((CellNum-1)%BinNumZ)*binSizeZ+binSizeZ/2+ZHeight;
return pos;
}
ENDVERBATIM
ENDCOMMENT