45 |
|
static void comp_sensor(char *sfile); |
46 |
|
|
47 |
|
static void |
48 |
< |
print_defaults() |
48 |
> |
over_options() /* overriding options */ |
49 |
|
{ |
50 |
+ |
directvis = (ndsamps <= 0); |
51 |
+ |
do_irrad = 0; |
52 |
+ |
} |
53 |
+ |
|
54 |
+ |
static void |
55 |
+ |
print_defaults() /* print out default parameters */ |
56 |
+ |
{ |
57 |
+ |
over_options(); |
58 |
|
printf("-n %-9d\t\t\t# number of processes\n", nprocs); |
59 |
|
printf("-rd %-9ld\t\t\t# ray directions\n", nsamps); |
60 |
|
/* printf("-rs %-9ld\t\t\t# ray super-samples\n", nssamps); */ |
76 |
|
) |
77 |
|
{ |
78 |
|
int doheader = 1; |
79 |
+ |
int optwarn = 0; |
80 |
|
int i, rval; |
81 |
|
|
82 |
|
progname = argv[0]; |
87 |
|
directrelay = 3; |
88 |
|
ambounce = 1; |
89 |
|
maxdepth = -10; |
81 |
– |
/* just asking defaults? */ |
82 |
– |
if (argc == 2 && !strcmp(argv[1], "-defaults")) { |
83 |
– |
print_defaults(); |
84 |
– |
return(0); |
85 |
– |
} |
86 |
– |
/* check octree */ |
87 |
– |
if (argc < 2 || argv[argc-1][0] == '-') |
88 |
– |
error(USER, "missing octree argument"); |
90 |
|
/* get options from command line */ |
91 |
< |
for (i = 1; i < argc-1; i++) { |
91 |
> |
for (i = 1; i < argc; i++) { |
92 |
|
while ((rval = expandarg(&argc, &argv, i)) > 0) |
93 |
|
; |
94 |
|
if (rval < 0) { |
95 |
|
sprintf(errmsg, "cannot expand '%s'", argv[i]); |
96 |
|
error(SYSTEM, errmsg); |
97 |
|
} |
98 |
< |
if (argv[i][0] != '-') { /* process a sensor file */ |
98 |
> |
if (argv[i][0] != '-') { |
99 |
> |
if (i >= argc-1) |
100 |
> |
break; /* final octree argument */ |
101 |
|
if (!ray_pnprocs) { |
102 |
< |
/* overriding options */ |
100 |
< |
directvis = (ndsamps <= 0); |
101 |
< |
do_irrad = 0; |
102 |
> |
over_options(); |
103 |
|
if (doheader) { /* print header */ |
104 |
|
printargs(argc, argv, stdout); |
105 |
|
fputformat("ascii", stdout); |
108 |
|
/* start process(es) */ |
109 |
|
ray_pinit(argv[argc-1], nprocs); |
110 |
|
} |
111 |
< |
comp_sensor(argv[i]); |
111 |
> |
comp_sensor(argv[i]); /* process a sensor file */ |
112 |
|
continue; |
113 |
|
} |
114 |
|
if (argv[i][1] == 'r') { /* sampling options */ |
151 |
|
sprintf(errmsg, "bad view option at '%s'", argv[i]); |
152 |
|
error(USER, errmsg); |
153 |
|
} |
154 |
< |
if (!strcmp(argv[i], "-w")) { /* turn off warnings */ |
155 |
< |
nowarn = 1; |
154 |
> |
if (!strcmp(argv[i], "-w")) { /* toggle warnings */ |
155 |
> |
nowarn = !nowarn; |
156 |
|
continue; |
157 |
|
} |
158 |
|
if (ray_pnprocs) { |
159 |
< |
error(WARNING, |
159 |
> |
if (!optwarn++) |
160 |
> |
error(WARNING, |
161 |
|
"rendering options should appear before first sensor"); |
162 |
|
} else if (!strcmp(argv[i], "-defaults")) { |
163 |
|
print_defaults(); |
180 |
|
} |
181 |
|
i += rval; |
182 |
|
} |
183 |
+ |
if (!ray_pnprocs) |
184 |
+ |
error(USER, i<argc ? "missing sensor file" : "missing octree"); |
185 |
|
quit(0); |
186 |
|
} |
187 |
|
|
374 |
|
"code error 2 in init_ptable()"); |
375 |
|
frac1 = 1. + prob/((1.-frac)*rowp[p]/rowsum[t] |
376 |
|
+ frac*rowp1[p]/rowsum[t+1]); |
373 |
– |
if (p <= 0 || frac1 > 0.5) |
374 |
– |
frac1 -= 0.5; |
375 |
– |
else if (p >= sntp[1]-1 || frac1 < 0.5) { |
376 |
– |
frac1 += 0.5; |
377 |
– |
--p; |
378 |
– |
} |
377 |
|
pvals[i*(nphi+1) + j] = (1.-frac1)*phdiv[p] + |
378 |
|
frac1*phdiv[p+1]; |
379 |
|
} |