--- ray/src/rt/pmap.c 2015/02/24 19:39:26 2.1 +++ ray/src/rt/pmap.c 2015/04/23 20:02:04 2.4 @@ -4,10 +4,11 @@ Roland Schregle (roland.schregle@{hslu.ch, gmail.com}) (c) Fraunhofer Institute for Solar Energy Systems, - Lucerne University of Applied Sciences & Arts + (c) Lucerne University of Applied Sciences and Arts, + supported by the Swiss National Science Foundation (SNSF, #147053) ================================================================== - $Id: pmap.c,v 2.1 2015/02/24 19:39:26 greg Exp $ + $Id: pmap.c,v 2.4 2015/04/23 20:02:04 rschregle Exp $ */ @@ -20,7 +21,6 @@ #include "pmapbias.h" #include "pmapdiag.h" #include "otypes.h" -#include #include #include @@ -28,7 +28,7 @@ extern char *octname; -static char PmapRevision [] = "$Revision: 2.1 $"; +static char PmapRevision [] = "$Revision: 2.4 $"; @@ -65,7 +65,8 @@ void loadPmaps (PhotonMap **pmaps, const PhotonMapPara for (t = 0; t < NUM_PMAP_TYPES; t++) if (setPmapParam(&pm, parm + t)) { /* Check if photon map newer than octree */ - if (!stat(pm -> fileName, &pmstat) && !stat(octname, &octstat) && + if (pm -> fileName && octname && + !stat(pm -> fileName, &pmstat) && !stat(octname, &octstat) && octstat.st_mtime > pmstat.st_mtime) { sprintf(errmsg, "photon map in file %s may be stale", pm -> fileName); @@ -264,9 +265,11 @@ static void preComputeGlobal (PhotonMap *pmap) /* Record start time, baby */ repStartTime = time(NULL); - signal(SIGCONT, pmapPreCompReport); + #ifdef SIGCONT + signal(SIGCONT, pmapPreCompReport); + #endif repProgress = 0; - bcopy(pmap -> heap, nuHeap, nuHeapSize * sizeof(Photon)); + memcpy(nuHeap, pmap -> heap, nuHeapSize * sizeof(Photon)); for (i = 0, p = nuHeap; i < nuHeapSize; i++, p++) { ray.ro = NULL; @@ -285,12 +288,14 @@ static void preComputeGlobal (PhotonMap *pmap) if (photonRepTime > 0 && time(NULL) >= repLastTime + photonRepTime) pmapPreCompReport(); -#ifndef BSD - else signal(SIGCONT, pmapPreCompReport); -#endif + #ifdef SIGCONT + else signal(SIGCONT, pmapPreCompReport); + #endif } - signal(SIGCONT, SIG_DFL); + #ifdef SIGCONT + signal(SIGCONT, SIG_DFL); + #endif /* Replace & rebuild heap */ free(pmap -> heap); @@ -401,7 +406,9 @@ void distribPhotons (PhotonMap **pmaps) /* Record start time and enable progress report signal handler */ repStartTime = time(NULL); - signal(SIGCONT, pmapDistribReport); + #ifdef SIGCONT + signal(SIGCONT, pmapDistribReport); + #endif repProgress = prePassCnt = 0; if (photonRepTime) @@ -561,7 +568,7 @@ void distribPhotons (PhotonMap **pmaps) if (photonRepTime > 0 && time(NULL) >= repLastTime + photonRepTime) pmapDistribReport(); - #ifndef BSD + #ifdef SIGCONT else signal(SIGCONT, pmapDistribReport); #endif } @@ -591,7 +598,9 @@ void distribPhotons (PhotonMap **pmaps) /* =================================================================== * POST-DISTRIBUTION - Set photon flux and build kd-tree, etc. * =================================================================== */ - signal(SIGCONT, SIG_DFL); + #ifdef SIGCONT + signal(SIGCONT, SIG_DFL); + #endif free(emap.samples); /* Set photon flux (repProgress is total num emitted) */