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

Comparing ray/src/rt/pmapdump.c (file contents):
Revision 2.14 by rschregle, Tue Jan 22 18:28:23 2019 UTC vs.
Revision 2.18 by rschregle, Thu Feb 18 17:08:50 2021 UTC

# Line 9 | Line 9 | static const char RCSid[] = "$Id$";
9  
10     Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
11     (c) Fraunhofer Institute for Solar Energy Systems,
12 +       supported by the German Research Foundation
13 +       (DFG LU-204/10-2, "Fassadenintegrierte Regelsysteme FARESYS")
14     (c) Lucerne University of Applied Sciences and Arts,
15 <       supported by the Swiss National Science Foundation (SNSF, #147053)
15 >       supported by the Swiss National Science Foundation
16 >       (SNSF #147053, "Daylight Redirecting Components")
17 >   (c) Tokyo University of Science,
18 >       supported by the JSPS Grants-in-Aid for Scientific Research
19 >       (KAKENHI JP19KK0115, "Three-Dimensional Light Flow")  
20     ======================================================================
21    
22     $Id$
# Line 215 | Line 221 | int main (int argc, char** argv)
221              fputc('\n', stdout);
222           }
223        }
218      
219      /* Get number of photons */
220      pm.numPhotons = getint(sizeof(pm.numPhotons), pmapFile);
224  
225 +      /* Get number of photons as fixed size, which possibly results in
226 +       * padding of MSB with 0 on some platforms.  Unlike sizeof() however,
227 +       * this ensures portability since this value may span 32 or 64 bits
228 +       * depending on platform.  */
229 +      pm.numPhotons = getint(PMAP_LONGSIZE, pmapFile);      
230 +
231        /* Skip avg photon flux */
232        for (j = 0; j < 3; j++)
233           getflt(pmapFile);
# Line 270 | Line 279 | int main (int argc, char** argv)
279   #ifdef PMAP_OOC
280        /* Open leaf file with filename derived from pmap, replace pmapFile
281         * (which is currently the node file) */
282 <      strncpy(leafFname, argv [arg], 1024);
283 <      strncat(leafFname, PMAP_OOC_LEAFSUFFIX, 1024);
282 >      strncpy(leafFname, argv [arg], sizeof(leafFname) - 1);
283 >      strncat(leafFname, PMAP_OOC_LEAFSUFFIX, sizeof(leafFname) - 1);
284        fclose(pmapFile);
285        if (!(pmapFile = fopen(leafFname, "rb"))) {
286           sprintf(errmsg, "cannot open leaf file %s", leafFname);
# Line 305 | Line 314 | int main (int argc, char** argv)
314           for (j = 0; j < 4; j++)
315              p.flux [j] = getint(1, pmapFile);
316     #endif
317 +  
318 +        
319  
320           /* Skip primary ray index */
321           getint(sizeof(p.primary), pmapFile);
# Line 315 | Line 326 | int main (int argc, char** argv)
326  
327           /* Dump photon probabilistically acc. to target sphere count */
328           if (frandom() <= dumpRatio) {
329 <            if (fluxCol)
329 >            if (fluxCol) {
330                 /* Get photon flux */
331                 getPhotonFlux(&p, col);
332 +               /* Scale by dumpRatio for energy conservation */
333 +               scalecolor(col, 1.0 / dumpRatio);
334 +            }
335              
336              if (!points) {
337                 if (fluxCol) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines