--- ray/src/hd/rholo3.c 1997/11/26 21:34:28 3.11 +++ ray/src/hd/rholo3.c 1997/12/01 16:35:02 3.12 @@ -50,31 +50,31 @@ int nents; if (complist == NULL) goto memerr; bcopy((char *)clist, (char *)complist, nents*sizeof(PACKHEAD)); - complen = nents; - listpos = 0; - lastin = -1; /* flag for initial sort */ + complen = nents; /* finish initialization below */ break; case BS_ADD: /* add to computation set */ case BS_ADJ: /* adjust set quantities */ if (nents <= 0) return; /* merge any common members */ - for (i = 0; i < complen; i++) { - for (n = 0; n < nents; n++) + for (n = 0; n < nents; n++) { + for (i = 0; i < complen; i++) if (clist[n].bi == complist[i].bi && clist[n].hd == complist[i].hd) { + int oldnr = complist[i].nr; if (op == BS_ADD) complist[i].nr += clist[n].nr; else /* op == BS_ADJ */ complist[i].nr = clist[n].nr; clist[n].nr = 0; - clist[n].nc = 1; - lastin = -1; /* flag full sort */ + clist[n].nc = complist[i].nc; + if (complist[i].nr != oldnr) + lastin = -1; /* flag sort */ break; } - if (n >= nents) - clist[i].nc = bnrays(hdlist[clist[i].hd], - clist[i].bi); + if (i >= complen) + clist[n].nc = bnrays(hdlist[clist[n].hd], + clist[n].bi); } /* sort updated list */ sortcomplist(); @@ -149,6 +149,8 @@ int nents; for (i = 0; i < complen; i++) /* ...get number computed */ complist[i].nc = bnrays(hdlist[complist[i].hd], complist[i].bi); + listpos = 0; + lastin = -1; /* flag for initial sort */ } return; memerr: @@ -249,12 +251,12 @@ init_global() /* initialize global ray computation * wtotal += complist[k++].nr; } /* adjust weights */ - if (vdef(DISKSPACE)) { + if (vdef(DISKSPACE)) frac = 1024.*1024.*vflt(DISKSPACE) / (wtotal*sizeof(RAYVAL)); - if (frac < 0.95 | frac > 1.05) - while (k--) - complist[k].nr = frac * complist[k].nr; - } + else + frac = 1024.*1024.*16384. / (wtotal*sizeof(RAYVAL)); + while (k--) + complist[k].nr = frac * complist[k].nr; listpos = 0; lastin = -1; /* flag initial sort */ }