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

Comparing ray/src/rt/pmap.c (file contents):
Revision 2.1 by greg, Tue Feb 24 19:39:26 2015 UTC vs.
Revision 2.4 by rschregle, Thu Apr 23 20:02:04 2015 UTC

# Line 4 | Line 4
4  
5     Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
6     (c) Fraunhofer Institute for Solar Energy Systems,
7 <       Lucerne University of Applied Sciences & Arts  
7 >   (c) Lucerne University of Applied Sciences and Arts,
8 >   supported by the Swiss National Science Foundation (SNSF, #147053)
9     ==================================================================
10    
11     $Id$
# Line 20 | Line 21
21   #include "pmapbias.h"
22   #include "pmapdiag.h"
23   #include "otypes.h"
23 #include <signal.h>
24   #include <time.h>
25   #include <sys/stat.h>
26  
# Line 65 | Line 65 | void loadPmaps (PhotonMap **pmaps, const PhotonMapPara
65     for (t = 0; t < NUM_PMAP_TYPES; t++)
66        if (setPmapParam(&pm, parm + t)) {        
67           /* Check if photon map newer than octree */
68 <         if (!stat(pm -> fileName, &pmstat) && !stat(octname, &octstat) &&
68 >         if (pm -> fileName && octname &&
69 >             !stat(pm -> fileName, &pmstat) && !stat(octname, &octstat) &&
70               octstat.st_mtime > pmstat.st_mtime) {
71              sprintf(errmsg, "photon map in file %s may be stale",
72                      pm -> fileName);
# Line 264 | Line 265 | static void preComputeGlobal (PhotonMap *pmap)
265    
266     /* Record start time, baby */
267     repStartTime = time(NULL);
268 <   signal(SIGCONT, pmapPreCompReport);
268 >   #ifdef SIGCONT
269 >      signal(SIGCONT, pmapPreCompReport);
270 >   #endif
271     repProgress = 0;
272 <   bcopy(pmap -> heap, nuHeap, nuHeapSize * sizeof(Photon));
272 >   memcpy(nuHeap, pmap -> heap, nuHeapSize * sizeof(Photon));
273    
274     for (i = 0, p = nuHeap; i < nuHeapSize; i++, p++) {
275        ray.ro = NULL;
# Line 285 | Line 288 | static void preComputeGlobal (PhotonMap *pmap)
288        
289        if (photonRepTime > 0 && time(NULL) >= repLastTime + photonRepTime)
290           pmapPreCompReport();
291 < #ifndef BSD
292 <      else signal(SIGCONT, pmapPreCompReport);
293 < #endif
291 >      #ifdef SIGCONT
292 >         else signal(SIGCONT, pmapPreCompReport);
293 >      #endif
294     }
295    
296 <   signal(SIGCONT, SIG_DFL);
296 >   #ifdef SIGCONT  
297 >      signal(SIGCONT, SIG_DFL);
298 >   #endif
299    
300     /* Replace & rebuild heap */
301     free(pmap -> heap);
# Line 401 | Line 406 | void distribPhotons (PhotonMap **pmaps)
406  
407     /* Record start time and enable progress report signal handler */
408     repStartTime = time(NULL);
409 <   signal(SIGCONT, pmapDistribReport);
409 >   #ifdef SIGCONT
410 >      signal(SIGCONT, pmapDistribReport);
411 >   #endif
412     repProgress = prePassCnt = 0;
413    
414     if (photonRepTime)
# Line 561 | Line 568 | void distribPhotons (PhotonMap **pmaps)
568                    if (photonRepTime > 0 &&
569                        time(NULL) >= repLastTime + photonRepTime)
570                       pmapDistribReport();
571 <                  #ifndef BSD
571 >                  #ifdef SIGCONT
572                       else signal(SIGCONT, pmapDistribReport);
573                    #endif
574                 }
# Line 591 | Line 598 | void distribPhotons (PhotonMap **pmaps)
598     /* ===================================================================
599      * POST-DISTRIBUTION - Set photon flux and build kd-tree, etc.
600      * =================================================================== */
601 <   signal(SIGCONT, SIG_DFL);
601 >   #ifdef SIGCONT    
602 >      signal(SIGCONT, SIG_DFL);
603 >   #endif
604     free(emap.samples);
605    
606     /* Set photon flux (repProgress is total num emitted) */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines