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$ |
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 |
|
|
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); |
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; |
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); |
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) |
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 |
|
} |
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) */ |