| 30 |
|
|
| 31 |
|
static void |
| 32 |
|
initeyelim( /* initialize grid coordinate limits */ |
| 33 |
< |
register struct gclim *gcl, |
| 34 |
< |
register HOLO *hp, |
| 33 |
> |
struct gclim *gcl, |
| 34 |
> |
HOLO *hp, |
| 35 |
|
GCOORD *gc |
| 36 |
|
) |
| 37 |
|
{ |
| 38 |
< |
register RREAL *v; |
| 39 |
< |
register int i; |
| 38 |
> |
RREAL *v; |
| 39 |
> |
int i; |
| 40 |
|
|
| 41 |
|
if (hp != NULL) { |
| 42 |
|
hdgrid(gcl->egp, gcl->hp = hp, myeye.vpt); |
| 54 |
|
|
| 55 |
|
static void |
| 56 |
|
groweyelim( /* grow grid limits about eye point */ |
| 57 |
< |
register struct gclim *gcl, |
| 57 |
> |
struct gclim *gcl, |
| 58 |
|
GCOORD *gc, |
| 59 |
|
double r0, |
| 60 |
|
double r1, |
| 107 |
|
f = wallpos*(wallpos*sqcoef[gw] + licoef[gw]) + cnst; |
| 108 |
|
for (i = 0; i < 2; i++) { |
| 109 |
|
if (i) { /* swap x and y coefficients */ |
| 110 |
< |
register double t; |
| 110 |
> |
double t; |
| 111 |
|
t = a; a = c; c = t; |
| 112 |
|
t = d; d = e; e = t; |
| 113 |
|
} |
| 156 |
|
|
| 157 |
|
static int |
| 158 |
|
clipeyelim( /* clip eye limits to grid cell */ |
| 159 |
< |
register short rrng[2][2], |
| 160 |
< |
register struct gclim *gcl |
| 159 |
> |
short rrng[2][2], |
| 160 |
> |
struct gclim *gcl |
| 161 |
|
) |
| 162 |
|
{ |
| 163 |
|
int incell = 1; |
| 164 |
< |
register int i; |
| 164 |
> |
int i; |
| 165 |
|
|
| 166 |
|
for (i = 0; i < 2; i++) { |
| 167 |
|
if (gcl->gmin[i] < gcl->gc.i[i]) |
| 181 |
|
} |
| 182 |
|
|
| 183 |
|
|
| 184 |
< |
extern void |
| 184 |
> |
void |
| 185 |
|
packrays( /* pack ray origins and directions */ |
| 186 |
< |
register float *rod, |
| 187 |
< |
register PACKET *p |
| 186 |
> |
float *rod, |
| 187 |
> |
PACKET *p |
| 188 |
|
) |
| 189 |
|
{ |
| 190 |
|
#if 0 |
| 198 |
|
GCOORD gc[2]; |
| 199 |
|
FVECT ro, rd; |
| 200 |
|
double d; |
| 201 |
< |
register int i; |
| 201 |
> |
int i; |
| 202 |
|
|
| 203 |
|
if (!hdbcoord(gc, hdlist[p->hd], p->bi)) |
| 204 |
|
error(CONSISTENCY, "bad beam index in packrays"); |
| 216 |
|
retry: |
| 217 |
|
if (useyelim) { |
| 218 |
|
initeyelim(&eyelim, NULL, gc+1); |
| 219 |
< |
p->ra[i].r[0][0] = (int)(frandom()*rrng0[0][1]) |
| 220 |
< |
+ rrng0[0][0]; |
| 221 |
< |
p->ra[i].r[0][1] = (int)(frandom()*rrng0[1][1]) |
| 222 |
< |
+ rrng0[1][0]; |
| 219 |
> |
p->ra[i].r[0][0] = irandom(rrng0[0][1]) + rrng0[0][0]; |
| 220 |
> |
p->ra[i].r[0][1] = irandom(rrng0[1][1]) + rrng0[1][0]; |
| 221 |
|
groweyelim(&eyelim, gc, |
| 222 |
|
(1./256.)*(p->ra[i].r[0][0]+.5), |
| 223 |
|
(1./256.)*(p->ra[i].r[0][1]+.5), 1); |
| 230 |
|
#endif |
| 231 |
|
goto retry; |
| 232 |
|
} |
| 233 |
< |
p->ra[i].r[1][0] = (int)(frandom()*rrng1[0][1]) |
| 234 |
< |
+ rrng1[0][0]; |
| 237 |
< |
p->ra[i].r[1][1] = (int)(frandom()*rrng1[1][1]) |
| 238 |
< |
+ rrng1[1][0]; |
| 233 |
> |
p->ra[i].r[1][0] = irandom(rrng1[0][1]) + rrng1[0][0]; |
| 234 |
> |
p->ra[i].r[1][1] = irandom(rrng1[1][1]) + rrng1[1][0]; |
| 235 |
|
} else { |
| 236 |
< |
p->ra[i].r[0][0] = frandom() * 256.; |
| 237 |
< |
p->ra[i].r[0][1] = frandom() * 256.; |
| 238 |
< |
p->ra[i].r[1][0] = frandom() * 256.; |
| 239 |
< |
p->ra[i].r[1][1] = frandom() * 256.; |
| 236 |
> |
p->ra[i].r[0][0] = random() & 0xff; |
| 237 |
> |
p->ra[i].r[0][1] = random() & 0xff; |
| 238 |
> |
p->ra[i].r[1][0] = random() & 0xff; |
| 239 |
> |
p->ra[i].r[1][1] = random() & 0xff; |
| 240 |
|
} |
| 241 |
|
d = hdray(ro, rd, hdlist[p->hd], gc, p->ra[i].r); |
| 242 |
|
#if 0 |
| 261 |
|
} |
| 262 |
|
|
| 263 |
|
|
| 264 |
< |
extern void |
| 264 |
> |
void |
| 265 |
|
donerays( /* encode finished ray computations */ |
| 266 |
< |
register PACKET *p, |
| 267 |
< |
register float *rvl |
| 266 |
> |
PACKET *p, |
| 267 |
> |
float *rvl |
| 268 |
|
) |
| 269 |
|
{ |
| 270 |
|
double d; |
| 271 |
< |
register int i; |
| 271 |
> |
int i; |
| 272 |
|
|
| 273 |
|
for (i = 0; i < p->nr; i++) { |
| 274 |
|
setcolr(p->ra[i].v, rvl[0], rvl[1], rvl[2]); |
| 282 |
|
} |
| 283 |
|
|
| 284 |
|
|
| 285 |
< |
extern int |
| 285 |
> |
int |
| 286 |
|
done_rtrace(void) /* clean up and close rtrace calculation */ |
| 287 |
|
{ |
| 288 |
|
int status; |
| 304 |
|
} |
| 305 |
|
|
| 306 |
|
|
| 307 |
< |
extern void |
| 307 |
> |
void |
| 308 |
|
new_rtrace(void) /* restart rtrace calculation */ |
| 309 |
|
{ |
| 310 |
|
char combuf[128]; |
| 316 |
|
if (vdef(TIME)) /* reset end time */ |
| 317 |
|
endtime = starttime + vflt(TIME)*3600. + .5; |
| 318 |
|
if (vdef(RIF)) { /* rerun rad to update octree */ |
| 319 |
< |
sprintf(combuf, "rad -v 0 -s -w %s", vval(RIF)); |
| 319 |
> |
sprintf(combuf, "rad -v 0 -s -w -N %d %s", |
| 320 |
> |
ncprocs, vval(RIF)); |
| 321 |
|
if (system(combuf)) |
| 322 |
|
error(WARNING, "error running rad"); |
| 323 |
|
} |
| 330 |
|
} |
| 331 |
|
|
| 332 |
|
|
| 333 |
< |
extern int |
| 333 |
> |
int |
| 334 |
|
getradfile(void) /* run rad and get needed variables */ |
| 335 |
|
{ |
| 336 |
|
static short mvar[] = {OCTREE,EYESEP,-1}; |
| 338 |
|
char tf2[64]; |
| 339 |
|
char combuf[256]; |
| 340 |
|
char *pippt = NULL; |
| 341 |
< |
register int i; |
| 342 |
< |
register char *cp; |
| 341 |
> |
int i; |
| 342 |
> |
char *cp; |
| 343 |
|
/* check if rad file specified */ |
| 344 |
|
if (!vdef(RIF)) |
| 345 |
|
return(0); |
| 347 |
|
mktemp(tf1); |
| 348 |
|
sprintf(tf2, "%s.rif", tf1); |
| 349 |
|
sprintf(combuf, |
| 350 |
< |
"rad -v 0 -s -e -w %s OPTFILE=%s | egrep '^[ \t]*(NOMATCH", |
| 351 |
< |
vval(RIF), tf1); |
| 350 |
> |
"rad -v 0 -s -e -w -N %d %s OPTFILE=%s | egrep '^[ \t]*(NOMATCH", |
| 351 |
> |
ncprocs, vval(RIF), tf1); |
| 352 |
|
cp = combuf; |
| 353 |
|
while (*cp){ |
| 354 |
|
if (*cp == '|') pippt = cp; |
| 380 |
|
} |
| 381 |
|
|
| 382 |
|
|
| 383 |
< |
extern void |
| 383 |
> |
void |
| 384 |
|
report( /* report progress so far */ |
| 385 |
|
time_t t |
| 386 |
|
) |