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

Comparing ray/src/rt/mkpmap.c (file contents):
Revision 2.4 by greg, Mon Mar 21 19:06:08 2016 UTC vs.
Revision 2.5 by rschregle, Tue May 17 17:39:47 2016 UTC

# Line 1 | Line 1
1 + #ifndef lint
2 + static const char RCSid[] = "$Id$";
3 + #endif
4 +
5   /*
6 <   ==================================================================
6 >   ======================================================================
7     Photon map generator
8    
9     Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
10     (c) Fraunhofer Institute for Solar Energy Systems,
11         Lucerne University of Applied Sciences & Arts
12 <   ==================================================================
12 >   (c) Lucerne University of Applied Sciences and Arts,
13 >       supported by the Swiss National Science Foundation (SNSF, #147053)
14 >   ======================================================================
15    
16     $Id$    
17   */
# Line 29 | Line 35 | extern char VersionID [];
35  
36  
37  
38 < char* progname;                         /* argv[0] */
39 < int  dimlist [MAXDIM];                  /* sampling dimensions */
40 < int  ndims = 0;                         /* number of sampling dimenshunns */
41 < char* octname = NULL;                   /* octree name */
42 < CUBE thescene;                          /* scene top-level octree */
43 < OBJECT nsceneobjs;                      /* number of objects in scene */
44 < double srcsizerat = 0.01;               /* source partition size ratio */
45 < int backvis = 1;                        /* back face visibility */
46 < int clobber = 0;                        /* overwrite output */
47 < COLOR cextinction = BLKCOLOR;           /* global extinction coefficient */
48 < COLOR salbedo = BLKCOLOR;               /* global scattering albedo */
49 < double seccg = 0;                       /* global scattering eccentricity */
50 < int ambincl = -1;                       /* photon port flag */
51 < char *amblist [AMBLLEN + 1];            /* photon port list */
52 < char *diagFile = NULL;                  /* diagnostics output file */
53 < int rand_samp = 1;                      /* uncorrelated random sampling */
38 > char*    progname;                  /* argv[0] */
39 > int      dimlist [MAXDIM];          /* sampling dimensions */
40 > int      ndims = 0;                 /* number of sampling dimenshunns */
41 > char*    octname = NULL;            /* octree name */
42 > CUBE     thescene;                  /* scene top-level octree */
43 > OBJECT   nsceneobjs;                /* number of objects in scene */
44 > double   srcsizerat = 0.01;         /* source partition size ratio */
45 > int      backvis = 1;               /* back face visibility */
46 > int      clobber = 0;               /* overwrite output */
47 > COLOR    cextinction = BLKCOLOR;    /* global extinction coefficient */
48 > COLOR    salbedo = BLKCOLOR;        /* global scattering albedo */
49 > double   seccg = 0;                 /* global scattering eccentricity */
50 > int      ambincl = -1;              /* photon port flag */
51 > char     *amblist [AMBLLEN + 1];    /* photon port list */
52 > char     *diagFile = NULL;          /* diagnostics output file */
53 > int      rand_samp = 1;             /* uncorrelated random sampling */
54 > unsigned nproc = 1;                 /* number of parallel processes */
55 > #ifdef EVALDRC_HACK
56 >   char  *angsrcfile = NULL;        /* angular source file for EvalDRC */
57 > #endif
58  
59  
60 +
61   /* Dummies for linkage */
62  
63   COLOR ambval = BLKCOLOR;
# Line 92 | Line 103 | void printdefaults()
103     printf("-e   %s\t\t\t# diagnostics output file\n", diagFile);
104     printf(clobber ? "-fo+\t\t\t\t# force overwrite"
105                    : "-fo-\t\t\t\t# do not overwrite\n");
106 + #if 0
107 +   /* Heap size increment now fixed & defined by macro in pmapkdt.c */
108     printf("-i   %-9ld\t\t\t# photon heap size increment\n",
109            photonHeapSizeInc);
110 + #endif          
111     printf("-ma  %.2f %.2f %.2f\t\t# scattering albedo\n",
112            colval(salbedo,RED), colval(salbedo,GRN), colval(salbedo,BLU));
113     printf("-me  %.2e %.2e %.2e\t# extinction coefficient\n",
114            colval(cextinction,RED), colval(cextinction,GRN),
115            colval(cextinction,BLU));          
116     printf("-mg  %.2f\t\t\t# scattering eccentricity\n", seccg);
117 +   printf("-n   %d\t\t\t\t# number of parallel processes\n", nproc);
118     printf("-t   %-9d\t\t\t# time between reports\n", photonRepTime);
119  
120   #ifdef PMAP_ROI
# Line 108 | Line 123 | void printdefaults()
123            pmapROI [0], pmapROI [1], pmapROI [2], pmapROI [3],
124            pmapROI [4], pmapROI [5]);
125   #endif  
126 +
127 + #ifdef EVALDRC_HACK
128 +   /* ... and ziss one... */
129 +   puts("-A\t\t\t\t# angular source file");
130 + #endif
131   }
132  
133  
# Line 298 | Line 318 | int main (int argc, char* argv [])
318                 if (argv[i][3] == 'O') {
319                    /* Get port modifiers file */
320                    rval = wordfile(portLp, AMBLLEN-(portLp-amblist),
321 <                                getpath(argv [++i], getrlibpath(), R_OK));
321 >                                  getpath(argv [++i], getrlibpath(), R_OK));
322 >                                  
323                    if (rval < 0) {
324                        sprintf(errmsg, "cannot open photon port file %s",
325                                argv [i]);
# Line 329 | Line 350 | int main (int argc, char* argv [])
350                 if (argv[i][3] == 'S') {
351                    /* Get sensor modifiers from file */
352                    rval = wordfile(sensLp, MAXSET-(sensLp-photonSensorList),
353 <                                getpath(argv [++i], getrlibpath(), R_OK));
353 >                                  getpath(argv [++i], getrlibpath(), R_OK));
354 >                                  
355                    if (rval < 0) {
356                        sprintf(errmsg, "cannot open antimatter sensor file %s",
357                                argv [i]);
# Line 387 | Line 409 | int main (int argc, char* argv [])
409                    
410              else goto badopt;
411              break;
412 <            
412 >
413 > #if 0
414 >         /* Heap size increment now fixed & defined by macro in pmapkdt.c */            
415           case 'i': /* Photon heap size increment */
416              check(2, "i");
417              photonHeapSizeInc = atol(argv [++i]);
418              break;
419 + #endif            
420                    
421           case 'm': /* Medium */
422              switch (argv[i][2]) {
# Line 417 | Line 442 | int main (int argc, char* argv [])
442                 default: goto badopt;
443              }                  
444              break;
445 <                  
445 >
446 >         case 'n': /* Num parallel processes */
447 >            check(2, "i");
448 >            nproc = atoi(argv [++i]);
449 >            
450 >            if (nproc > PMAP_MAXPROC) {
451 >               nproc = PMAP_MAXPROC;
452 >               sprintf(errmsg, "too many parallel processes, clamping to "
453 >                       "%d\n", nproc);
454 >               error(WARNING, errmsg);
455 >            }
456 >            
457 >            break;                  
458 >            
459           case 't': /* Timer */
460              check(2, "i");
461              photonRepTime = atoi(argv [++i]);
462              break;
463 +
464 + #ifdef EVALDRC_HACK
465 +         case 'A':   /* Angular source file */
466 +            check(2,"s");
467 +            angsrcfile = argv[++i];
468 +            break;                  
469 + #endif
470                    
471           default: goto badopt;
472        }
# Line 462 | Line 507 | int main (int argc, char* argv [])
507        error(USER, "no photon maps specified");
508    
509     readoct(octname, loadflags, &thescene, NULL);
510 +
511 + #ifdef EVALDRC_HACK  
512 +   if (angsrcfile)
513 +      readobj(angsrcfile);    /* load angular sources */
514 + #endif      
515 +      
516     nsceneobjs = nobjects;
517    
518     /* Get sources */
# Line 470 | Line 521 | int main (int argc, char* argv [])
521     /* Do forward pass and build photon maps */
522     if (contribPmap)
523        /* Just build contrib pmap, ignore others */
524 <      distribPhotonContrib(contribPmap);
524 >      distribPhotonContrib(contribPmap, nproc);
525     else
526 <      distribPhotons(photonMaps);
526 >      distribPhotons(photonMaps, nproc);
527    
528     /* Save photon maps; no idea why GCC needs an explicit cast here... */
529     savePmaps((const PhotonMap**)photonMaps, argc, argv);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines