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

Comparing ray/src/util/eplus_adduvf.c (file contents):
Revision 2.6 by greg, Tue Feb 11 22:01:44 2014 UTC vs.
Revision 2.7 by greg, Tue Feb 11 23:44:11 2014 UTC

# Line 16 | Line 16 | static const char RCSid[] = "$Id$";
16   #include "rtprocess.h"
17  
18   #ifndef NSAMPLES
19 < #define NSAMPLES        80000                   /* number of samples to use */
19 > #define NSAMPLES        80000                   /* default number of samples */
20   #endif
21  
22   char            *progname;                      /* global argv[0] */
23  
24 + int             nsamps = NSAMPLES;              /* number of samples to use */
25 +
26   char            temp_octree[128];               /* temporary octree */
27  
28   const char      UVF_PNAME[] =
# Line 43 | Line 45 | const SURF_PTYPE       surf_type[] = {
45                  {"RoofCeiling:Detailed", 3, 9},
46                  {"Wall:Detailed", 3, 9},
47                  {NULL}
48 <        };
48 >        };                              /* IDF surface types */
49  
50   typedef struct s_zone {
51          const char      *zname;                 /* zone name */
# Line 57 | Line 59 | ZONE           *zone_list = NULL;      /* our list of zones */
59  
60   IDF_LOADED      *our_idf = NULL;        /* loaded/modified IDF */
61  
62 + typedef struct {
63 +        FVECT           sdir[3];        /* UVW unit sampling vectors */
64 +        double          poff;           /* W-offset for plane of polygon */
65 +        double          area_left;      /* area left to sample */
66 +        int             samp_left;      /* remaining samples */
67 +        int             wd;             /* output file descriptor */
68 + } POLYSAMP;             /* structure for polygon sampling */
69 +
70   /* Create a new zone and push to top of our list */
71   static ZONE *
72   new_zone(const char *zname, IDF_PARAMETER *param)
# Line 168 | Line 178 | start_rcontrib(SUBPROC *pd, ZONE *zp)
178                  return(0);
179          for (i = 0; i < BASE_AC; i++)
180                  av[i] = base_av[i];
181 <        sprintf(cbuf, "%d", NSAMPLES);
181 >        sprintf(cbuf, "%d", nsamps);
182          av[i++] = "-c";
183          av[i++] = cbuf;                         /* add modifier arguments */
184          for (n = zp->nsurf, pptr = zp->pfirst; n--; pptr = pptr->dnext) {
# Line 200 | Line 210 | start_rcontrib(SUBPROC *pd, ZONE *zp)
210   #undef BASE_AC
211   }
212  
203 typedef struct {
204        FVECT           sdir[3];        /* XYZ unit sampling vectors */
205        double          poff;           /* Z-offset for plane of polygon */
206        double          area_left;      /* area left to sample */
207        int             samp_left;      /* remaining samples */
208        int             wd;             /* output file descriptor */
209 } POLYSAMP;             /* structure for polygon sampling */
210
213   /* Initialize polygon sampling */
214   static Vert2_list *
215   init_poly(POLYSAMP *ps, IDF_FIELD *f0, int nv)
# Line 349 | Line 351 | sample_surface(IDF_PARAMETER *param, int wd)
351                                  idf_getfield(param,NAME_FLD)->val);
352                  return(0);
353          }
354 <        psamp.samp_left = NSAMPLES;     /* assign samples & destination */
354 >        psamp.samp_left = nsamps;       /* assign samples & destination */
355          psamp.wd = wd;
356                                          /* sample each subtriangle */
357          if (!polyTriangulate(vlist2, &sample_triangle))
# Line 467 | Line 469 | main(int argc, char *argv[])
469          IDF_PARAMETER   *pptr;
470          int             i;
471  
472 <        progname = argv[0];
473 <        if (argc > 2 && !strcmp(argv[1], "-c")) {
474 <                incl_comments = -1;             /* output header only */
475 <                ++argv; --argc;
476 <        }
477 <        if ((argc < 2) | (argc > 3)) {
478 <                fputs("Usage: ", stderr);
479 <                fputs(progname, stderr);
480 <                fputs(" [-c] Model.idf [Revised.idf]\n", stderr);
481 <                return(1);
482 <        }
483 <        origIDF = argv[1];
484 <        revIDF = (argc == 2) ? argv[1] : argv[2];
472 >        progname = *argv++; argc--;             /* get options if any */
473 >        while (argc > 1 && argv[0][0] == '-')
474 >                switch (argv[0][1]) {
475 >                case 'c':                       /* elide comments */
476 >                        incl_comments = -1;             /* header only */
477 >                        argv++; argc--;
478 >                        continue;
479 >                case 's':                       /* samples */
480 >                        nsamps = 1000*atoi(*++argv);
481 >                        argv++; argc -= 2;
482 >                        continue;
483 >                default:
484 >                        fputs(progname, stderr);
485 >                        fputs(": unknown option '", stderr);
486 >                        fputs(argv[0], stderr);
487 >                        fputs("'\n", stderr);
488 >                        goto userr;
489 >                }
490 >        if ((argc < 1) | (argc > 2))
491 >                goto userr;
492 >        origIDF = argv[0];
493 >        revIDF = (argc == 1) ? argv[0] : argv[1];
494                                                  /* load Input Data File */
495          our_idf = idf_load(origIDF);
496          if (our_idf == NULL) {
# Line 530 | Line 541 | main(int argc, char *argv[])
541                  return(1);
542          }
543          return(0);                              /* finito! */
544 + userr:
545 +        fputs("Usage: ", stderr);
546 +        fputs(progname, stderr);
547 +        fputs(" [-c][-s Ksamps] Model.idf [Revised.idf]\n", stderr);
548 +        return(1);
549   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines