forked from zarch/distdrop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.c
91 lines (76 loc) · 2.1 KB
/
test.c
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include <math.h>
#include "test.h"
/* define sample road map */
short int road[NROWS][NCOLS] =
{ /* 0 1 2 3 4 5 6 7 8 9 0 1 */
{0,0,0,0,0,0,0,0,0,0,0}, /* 0*/
{0,0,0,0,0,0,0,0,1,0,0}, /* 1*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 2*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 3*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 4*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 5*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 6*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 7*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 8*/
{0,0,1,0,0,0,0,0,0,0,0}, /* 9*/
};
/* define sample compute domain map */
short int domain[NROWS][NCOLS] =
{ /* 0 1 2 3 4 5 6 7 8 9 0 1*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 0*/
{0,0,0,0,0,0,0,0,1,0,0}, /* 1*/
{0,0,0,0,0,0,0,0,1,0,0}, /* 2*/
{0,0,0,0,0,0,0,1,1,0,0}, /* 3*/
{0,0,0,0,0,1,1,0,0,0,0}, /* 4*/
{0,0,0,0,1,0,0,0,0,0,0}, /* 5*/
{0,0,0,0,1,1,0,0,0,0,0}, /* 6*/
{0,0,0,1,0,0,1,1,0,0,0}, /* 7*/
{0,0,1,0,0,0,0,0,1,1,0}, /* 8*/
{0,0,1,0,0,0,0,0,0,0,0}, /* 9*/
};
/* define sample elevation map */
float elevation[NROWS][NCOLS] =
{
/* 0 1 2 3 4 5 6 7 8 9 0 1 */
{0,0,0,0,0,0,0,0,0,0,0}, /* 0*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 1*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 2*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 3*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 4*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 5*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 6*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 7*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 8*/
{0,0,0,0,0,0,0,0,0,0,0}, /* 9*/
};
/* ===================================== */
/* initialize distance */
double rdist[NROWS][NCOLS];
/* initialize distance */
short int rdir[NROWS][NCOLS];
/* initialize drop_up */
float rdrop_up[NROWS][NCOLS];
/* initialize drop_dw */
float rdrop_dw[NROWS][NCOLS];
/* initialize not_used */
short int not_used[NROWS][NCOLS];
/* Movement & Direction
-1 0 1
|1|2|3| -1
|4| |6| 0
|7|8|9| 1
*/
short int mv[8][2] =
{ { 1, 1}, /* 1 */
{ 1, 0}, /* 2 */
{ 1, -1}, /* 3 */
{ 0, 1}, /* 4 */
{ 0, -1}, /* 6 */
{-1, 1}, /* 7 */
{-1, 0}, /* 8 */
{-1, -1}, /* 9 */
};
short int dir[8] = {1, 2, 3, 4, 6, 7, 8, 9};
/* dist[8] = {1, 1, 1, 1, 1, 1, 1, 1}; */
double dist[8] = {M_SQRT2, 1, M_SQRT2, 1, 1, M_SQRT2, 1, M_SQRT2};
move movement = {8, mv[0], dir, dist};