ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/rmatrix.c
(Generate patch)

Comparing ray/src/util/rmatrix.c (file contents):
Revision 2.79 by greg, Sun May 19 15:32:24 2024 UTC vs.
Revision 2.80 by greg, Tue Jun 4 21:23:11 2024 UTC

# Line 31 | Line 31 | rmx_new(int nr, int nc, int n)
31          if (!dnew)
32                  return(NULL);
33  
34 <        dnew->dtype = DTdouble;
34 >        dnew->dtype = DTrmx_native;
35          dnew->nrows = nr;
36          dnew->ncols = nc;
37          dnew->ncomp = n;
# Line 225 | Line 225 | rmx_load_float(double *drp, const RMATRIX *rm, FILE *f
225   static int
226   rmx_load_double(double *drp, const RMATRIX *rm, FILE *fp)
227   {
228 +        if (DTrmx_native != DTdouble)
229 +                return(0);
230          if (getbinary(drp, sizeof(*drp)*rm->ncomp, rm->ncols, fp) != rm->ncols)
231                  return(0);
232          if (rm->pflags & RMF_SWAPIN)
# Line 338 | Line 340 | rmx_load_data(RMATRIX *rm, FILE *fp)
340          int     i;
341   #ifdef MAP_FILE
342          long    pos;            /* map memory for file > 1MB if possible */
343 <        if ((rm->dtype == DTdouble) & !(rm->pflags & RMF_SWAPIN) &&
343 >        if ((rm->dtype == DTrmx_native) & !(rm->pflags & RMF_SWAPIN) &&
344                          rmx_array_size(rm) >= 1L<<20 &&
345                          (pos = ftell(fp)) >= 0 && !(pos % sizeof(double))) {
346                  rm->mapped = mmap(NULL, rmx_array_size(rm)+pos, PROT_READ|PROT_WRITE,
# Line 591 | Line 593 | rmx_write_data(const double *dp, int nc, int len, int
593                  return(rmx_write_ascii(dp, nc, len, fp));
594          case DTfloat:
595                  return(rmx_write_float(dp, nc*len, fp));
596 <        case DTdouble:
596 >        case DTrmx_native:
597                  return(putbinary(dp, sizeof(*dp)*nc, len, fp) == len);
598          case DTrgbe:
599          case DTxyze:
# Line 615 | Line 617 | rmx_write(const RMATRIX *rm, int dtype, FILE *fp)
617   #ifdef getc_unlocked
618          flockfile(fp);
619   #endif
620 <        if (dtype == DTdouble)                  /* write all at once? */
620 >        if (dtype == DTrmx_native)              /* write all at once? */
621                  ok = rmx_write_data(rm->mtx, rm->ncomp,
622                                  rm->nrows*rm->ncols, dtype, fp);
623          else                                    /* else row by row */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines