-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCreateInitQTBlocks.m
More file actions
58 lines (43 loc) · 905 Bytes
/
CreateInitQTBlocks.m
File metadata and controls
58 lines (43 loc) · 905 Bytes
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
function CreateInitQTBlocks(nx,ny,drawfig)
%CREATEINITBLOCKS -- initial uniform block creation
QTGlobals
fprintf('Creating initial blocks ...')
dx = QTXmax/nx;
dy = QTYmax/ny;
k = 1;
for j=1:ny
y = (j-0.5)*dy;
for i = 1:nx
if j == 1
kdown = 0;
else
kdown = k-nx;
end
if j == ny
kup = 0;
else
kup = k+nx;
end
if i == 1
kleft = 0;
else
kleft = k-1;
end
if i == nx
kright = 0;
else
kright = k+1;
end
x = (i-0.5)*dx;
Blocks{k} = CreateQTBlock(x,y,dx,dy,k,kup,kdown,kleft,kright);
k = k+1;
end
end
nBlocks = k-1;
if drawfig
figure
DrawQTBlocks(1,0,1,1,1)
title('Initial blocks');
end
fprintf('\n');
end