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 (DFG) |
13 |
+ |
as part of the FARESYS project |
14 |
|
(c) Lucerne University of Applied Sciences and Arts, |
15 |
|
supported by the Swiss National Science Foundation (SNSF, #147053) |
16 |
+ |
(c) Tokyo University of Science, |
17 |
+ |
supported by the Japan Society for the Promotion of Science (JSPS) |
18 |
+ |
under the Grants-in-Aid for Scientific Research Program (KAKENHI), |
19 |
+ |
grant number JP19KK0115. |
20 |
|
====================================================================== |
21 |
|
|
22 |
|
$Id$ |
276 |
|
#ifdef PMAP_OOC |
277 |
|
/* Open leaf file with filename derived from pmap, replace pmapFile |
278 |
|
* (which is currently the node file) */ |
279 |
< |
strncpy(leafFname, argv [arg], 1024); |
280 |
< |
strncat(leafFname, PMAP_OOC_LEAFSUFFIX, 1024); |
279 |
> |
strncpy(leafFname, argv [arg], sizeof(leafFname) - 1); |
280 |
> |
strncat(leafFname, PMAP_OOC_LEAFSUFFIX, sizeof(leafFname) - 1); |
281 |
|
fclose(pmapFile); |
282 |
|
if (!(pmapFile = fopen(leafFname, "rb"))) { |
283 |
|
sprintf(errmsg, "cannot open leaf file %s", leafFname); |
311 |
|
for (j = 0; j < 4; j++) |
312 |
|
p.flux [j] = getint(1, pmapFile); |
313 |
|
#endif |
314 |
+ |
|
315 |
+ |
|
316 |
|
|
317 |
|
/* Skip primary ray index */ |
318 |
|
getint(sizeof(p.primary), pmapFile); |
323 |
|
|
324 |
|
/* Dump photon probabilistically acc. to target sphere count */ |
325 |
|
if (frandom() <= dumpRatio) { |
326 |
< |
if (fluxCol) |
326 |
> |
if (fluxCol) { |
327 |
|
/* Get photon flux */ |
328 |
|
getPhotonFlux(&p, col); |
329 |
+ |
/* Scale by dumpRatio for energy conservation */ |
330 |
+ |
scalecolor(col, 1.0 / dumpRatio); |
331 |
+ |
} |
332 |
|
|
333 |
|
if (!points) { |
334 |
|
if (fluxCol) { |