305 |
|
samp = (float *)malloc(sizeof(float)*6*ns); |
306 |
|
if (samp == NULL) |
307 |
|
return(0); |
308 |
< |
for (i = ns; i--; ) { |
308 |
> |
for (i = ns; i--; ) { /* stratified Monte Carlo sampling */ |
309 |
|
double sv[4]; |
310 |
|
multisamp(sv, 4, (i+frandom())/(double)ns); |
311 |
|
sv[0] *= sv[1] = sqrt(sv[1]); |
379 |
|
return(0); |
380 |
|
/* UVFs from each surface */ |
381 |
|
for (n = zp->nsurf, pptr = zp->pfirst; n--; pptr = pptr->dnext) { |
382 |
+ |
double vfsum = 0; |
383 |
|
/* send samples to rcontrib */ |
384 |
|
if (!sample_surface(pptr, pd->w)) |
385 |
|
return(0); |
393 |
|
/* append UVF fields */ |
394 |
|
for (m = 0, pptr1 = zp->pfirst; |
395 |
|
m < zp->nsurf; m++, pptr1 = pptr1->dnext) { |
396 |
+ |
vfsum += uvfa[3*m + 1]; |
397 |
|
if (pptr1 == pptr) { |
398 |
|
if (uvfa[3*m + 1] > .001) |
399 |
|
fprintf(stderr, |
415 |
|
return(0); |
416 |
|
} |
417 |
|
} |
418 |
+ |
if (vfsum < 0.95) |
419 |
+ |
fprintf(stderr, |
420 |
+ |
"%s: warning - missing %.1f%% of energy from surface '%s'\n", |
421 |
+ |
progname, 100.*(1.-vfsum), |
422 |
+ |
idf_getfield(pptr,NAME_FLD)->val); |
423 |
|
} |
424 |
|
free(uvfa); /* clean up and return */ |
425 |
|
return(1); |