| 26 |
|
|
| 27 |
|
int nowarn = 0; /* turn warnings off? */ |
| 28 |
|
|
| 29 |
– |
double expval = 1.; /* global exposure value */ |
| 30 |
– |
|
| 29 |
|
int ncprocs = 0; /* desired number of compute processes */ |
| 30 |
|
|
| 31 |
|
char *outdev = NULL; /* output device name */ |
| 113 |
|
creatholo(&hdg); |
| 114 |
|
} else { /* else load holodeck */ |
| 115 |
|
loadholo(); |
| 116 |
< |
if (vdef(RIF)) /* load RIF if any */ |
| 116 |
> |
/* check settings */ |
| 117 |
> |
checkvalues(); |
| 118 |
> |
/* load RIF if any */ |
| 119 |
> |
if (vdef(RIF)) |
| 120 |
|
getradfile(vval(RIF)); |
| 121 |
+ |
/* set defaults */ |
| 122 |
+ |
setdefaults(NULL); |
| 123 |
|
} |
| 124 |
|
/* initialize */ |
| 125 |
|
initrholo(); |
| 126 |
< |
/* run */ |
| 126 |
> |
/* main loop */ |
| 127 |
|
while (rholo()) |
| 128 |
|
; |
| 129 |
|
/* done */ |
| 338 |
|
sprintf(errmsg, "ignoring all but first %s", vnam(SECTION)); |
| 339 |
|
error(WARNING, errmsg); |
| 340 |
|
} |
| 338 |
– |
if (sscanf(vval(SECTION), |
| 339 |
– |
"%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf", |
| 340 |
– |
&gp->orig[0], &gp->orig[1], &gp->orig[2], |
| 341 |
– |
&gp->xv[0][0], &gp->xv[0][1], &gp->xv[0][2], |
| 342 |
– |
&gp->xv[1][0], &gp->xv[1][1], &gp->xv[1][2], |
| 343 |
– |
&gp->xv[2][0], &gp->xv[2][1], &gp->xv[2][2]) != 12) |
| 344 |
– |
badvalue(SECTION); |
| 345 |
– |
maxlen = 0.; |
| 346 |
– |
for (i = 0; i < 3; i++) |
| 347 |
– |
if ((len[i] = VLEN(gp->xv[i])) > maxlen) |
| 348 |
– |
maxlen = len[i]; |
| 349 |
– |
if (!vdef(GRID)) { |
| 350 |
– |
sprintf(buf, "%.4f", maxlen/8.); |
| 351 |
– |
vval(GRID) = savqstr(buf); |
| 352 |
– |
vdef(GRID)++; |
| 353 |
– |
} |
| 354 |
– |
if ((d = vflt(GRID)) <= FTINY) |
| 355 |
– |
badvalue(GRID); |
| 356 |
– |
for (i = 0; i < 3; i++) |
| 357 |
– |
gp->grid[i] = len[i]/d + (1.-FTINY); |
| 358 |
– |
if (!vdef(EXPOSURE)) { |
| 359 |
– |
sprintf(errmsg, "%s must be defined", vnam(EXPOSURE)); |
| 360 |
– |
error(USER, errmsg); |
| 361 |
– |
} |
| 362 |
– |
expval = vval(EXPOSURE)[0] == '-' || vval(EXPOSURE)[0] == '+' ? |
| 363 |
– |
pow(2., vflt(EXPOSURE)) : vflt(EXPOSURE); |
| 341 |
|
if (!vdef(OCTREE)) { |
| 342 |
|
if ((vval(OCTREE) = bmalloc(strlen(froot)+5)) == NULL) |
| 343 |
|
error(SYSTEM, "out of memory"); |
| 359 |
|
/* append rendering options */ |
| 360 |
|
if (vdef(RENDER)) |
| 361 |
|
rtargc += wordstring(rtargv+rtargc, vval(RENDER)); |
| 362 |
+ |
|
| 363 |
+ |
if (gp == NULL) /* already initialized? */ |
| 364 |
+ |
return; |
| 365 |
+ |
/* set grid parameters */ |
| 366 |
+ |
if (sscanf(vval(SECTION), |
| 367 |
+ |
"%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf", |
| 368 |
+ |
&gp->orig[0], &gp->orig[1], &gp->orig[2], |
| 369 |
+ |
&gp->xv[0][0], &gp->xv[0][1], &gp->xv[0][2], |
| 370 |
+ |
&gp->xv[1][0], &gp->xv[1][1], &gp->xv[1][2], |
| 371 |
+ |
&gp->xv[2][0], &gp->xv[2][1], &gp->xv[2][2]) != 12) |
| 372 |
+ |
badvalue(SECTION); |
| 373 |
+ |
maxlen = 0.; |
| 374 |
+ |
for (i = 0; i < 3; i++) |
| 375 |
+ |
if ((len[i] = VLEN(gp->xv[i])) > maxlen) |
| 376 |
+ |
maxlen = len[i]; |
| 377 |
+ |
if (!vdef(GRID)) { |
| 378 |
+ |
sprintf(buf, "%.4f", maxlen/8.); |
| 379 |
+ |
vval(GRID) = savqstr(buf); |
| 380 |
+ |
vdef(GRID)++; |
| 381 |
+ |
} |
| 382 |
+ |
if ((d = vflt(GRID)) <= FTINY) |
| 383 |
+ |
badvalue(GRID); |
| 384 |
+ |
for (i = 0; i < 3; i++) |
| 385 |
+ |
gp->grid[i] = len[i]/d + (1.-FTINY); |
| 386 |
|
} |
| 387 |
|
|
| 388 |
|
|
| 500 |
|
getradfile(rfargs) /* run rad and get needed variables */ |
| 501 |
|
char *rfargs; |
| 502 |
|
{ |
| 503 |
< |
static short mvar[] = {OCTREE,EXPOSURE,-1}; |
| 503 |
> |
static short mvar[] = {OCTREE,-1}; |
| 504 |
|
static char tf1[] = TEMPLATE; |
| 505 |
|
char tf2[64]; |
| 506 |
|
char combuf[256]; |