11 int main(
int,
char *[])
17 ret = stat(
"map.bin", &statbuff);
19 printf(
"Can't stat file map.bin (%s)\n", strerror(errno));
23 int sz = statbuff.st_size;
24 uint *buff = (uint *)malloc(sz);
25 float *fbuff = (
float *)buff;
28 printf(
"Can't allocate %d bytes\n",sz);
32 int fd = open(
"map.bin", O_RDONLY);
34 printf(
"Can't open file map.bin (%s)\n", strerror(errno));
38 ret = read(fd, buff, sz);
40 printf(
"Only read %d of %d bytes\n",ret,sz);
47 int head_words = buff[1];
50 for(
int i=0;i<head_words;i++) {
51 printf(
"Head[%d] = %d (%f)\n",i,buff[i],fbuff[i]);
56 float dpad = fbuff[3];
58 float maxtb = fbuff[5];
60 int npgrid = (int) ceil(182./dpad);
61 int ntbgrid = (int) ceil(maxtb/dtb);
63 typedef float map_t[45][npgrid+1][ntbgrid+1][3];
64 map_t *map = (map_t *)&buff[head_words+1];
69 for(
int pg=0;pg<npgrid;pg++) {
70 for(
int tg=0;tg<ntbgrid;tg++) {
71 float x = map[sector][pr][pg][tg][0];
72 float y = map[sector][pr][pg][tg][1];
73 float z = map[sector][pr][pg][tg][2];
75 printf(
"%f %f\n",y,z);