--- ray/src/hd/rhinfo.c 1998/12/31 16:25:26 3.1 +++ ray/src/hd/rhinfo.c 2003/05/29 16:26:22 3.6 @@ -1,9 +1,6 @@ -/* Copyright (c) 1998 Silicon Graphics, Inc. */ - #ifndef lint -static char SCCSid[] = "$SunId$ SGI"; +static const char RCSid[] = "$Id: rhinfo.c,v 3.6 2003/05/29 16:26:22 greg Exp $"; #endif - /* * Get general information on holodeck file */ @@ -16,7 +13,9 @@ static char SCCSid[] = "$SunId$ SGI"; char *progname; /* global argv[0] */ +long beamtot, samptot; /* total beams and samples */ + main(argc, argv) int argc; char *argv[]; @@ -38,7 +37,6 @@ gethdinfo(fname, fout) /* get information on holodeck char *fname; FILE *fout; { - extern long ftell(); FILE *fp; HOLO *hdsect; int fd; @@ -58,13 +56,16 @@ FILE *fout; nextloc = ftell(fp); /* get stdio position */ fclose(fp); /* done with stdio */ for (n = 0; nextloc > 0L; n++) { /* get the section(s) */ - lseek(fd, (long)nextloc, 0); + lseek(fd, (off_t)nextloc, 0); read(fd, (char *)&nextloc, sizeof(nextloc)); + fprintf(fout, "Section %d:\n", n); hdsect = hdinit(fd, NULL); /* load section directory */ - fprintf(fout,"Section %d:\n",n); psectstats(hdsect, fout); /* print section statistics */ } nextloc = hdfilen(fd); /* print global statistics */ + fputs("=====================================================\n", fout); + fprintf(fout, "Total samples/beams: %ld/%ld (%.2f samples/beam)\n", + samptot, beamtot, (double)samptot/beamtot); fprintf(fout, "%.1f Mbyte file, %.1f%% fragmentation\n", nextloc/(1024.*1024.), 100.*(nextloc-hdfiluse(fd,1))/nextloc); @@ -82,14 +83,19 @@ FILE *fp; { int scount[NHBINS]; int minsamp = 10000, maxsamp = 0; + FVECT vt; double sqrtmaxp; int bmin, bmax, cnt; register int i; + fcross(vt, hp->xv[0], hp->xv[1]); + fprintf(fp, "\tWorld volume: %g\n", fabs(DOT(vt,hp->xv[2]))); fprintf(fp, "\tGrid resolution: %d x %d x %d\n", hp->grid[0], hp->grid[1], hp->grid[2]); - fprintf(fp, "\tNumber of beams: %d\n", nbeams(hp)); - fprintf(fp, "\tNumber of ray samples: %d\n", biglob(hp)->nrd); + fprintf(fp, "\tNumber of beams: %ld\n", (long)nbeams(hp)); + beamtot += nbeams(hp); + fprintf(fp, "\tNumber of ray samples: %ld\n", (long)biglob(hp)->nrd); + samptot += biglob(hp)->nrd; if (biglob(hp)->nrd <= 0) return; /* no samples to stat! */ for (i = nbeams(hp); i > 0; i--) {