ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapooc.h
Revision: 1.1
Committed: Wed May 18 08:22:45 2016 UTC (8 years ago) by rschregle
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R2, rad5R1
Log Message:
Added missing sources of iC and ooC pmap

File Contents

# User Rev Content
1 rschregle 1.1 /*
2     ==================================================================
3     Photon map interface to out-of-core octree
4    
5     Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
6     (c) Lucerne University of Applied Sciences and Arts,
7     supported by the Swiss National Science Foundation (SNSF, #147053)
8     ==================================================================
9    
10     $Id: pmapooc.h,v 1.2 2015/11/13 17:33:53 taschreg Exp taschreg $
11     */
12    
13    
14    
15     #ifndef PMAPOOC_H
16     #define PMAPOOC_H
17    
18     #include "oocnn.h"
19    
20    
21    
22     /* Suffixes for octree filenames */
23     /* #define PMAP_OOC_NODESUFFIX ".node"
24     #define PMAP_OOC_HEAPSUFFIX ".heap" */
25     #define PMAP_OOC_LEAFSUFFIX ".leaf"
26    
27     /* Out-of-core octree constants */
28     #define PMAP_OOC_NUMBLK 32 /* Num blocks for external sort */
29     #define PMAP_OOC_BLKSIZE 1e8 /* Block size for external sort */
30     #define PMAP_OOC_LEAFMAX (OOC_OCTCNT_MAX) /* Max photons per leaf */
31     #define PMAP_OOC_MAXDEPTH (OOC_MORTON_BITS) /* Max octree depth */
32    
33    
34    
35     typedef OOC_SearchQueueNode PhotonSearchQueueNode;
36     typedef OOC_SearchQueue PhotonSearchQueue;
37     typedef OOC_Octree PhotonStorage;
38     typedef unsigned PhotonIdx;
39    
40     /* Forward declarations to break dependency loop with pmapdata.h */
41     struct PhotonMap;
42    
43    
44    
45     void OOC_BuildPhotonMap (struct PhotonMap *pmap, unsigned numProc);
46     /* Build out-of-core octree pmap -> store from photons in unsorted
47     * heapfile pmap -> heap and generate nodes and leaf file with prefix
48     * pmap -> fileName. Photon map construction may be parallelised if
49     * numProc > 1, if supported. The heap is destroyed on return. */
50    
51     int OOC_SavePhotons (const struct PhotonMap *pmap, FILE *out);
52     /* Save photons in out-of-core octree to file. Return -1 on error,
53     * else 0 */
54    
55     int OOC_LoadPhotons (struct PhotonMap *pmap, FILE *in);
56     /* Load photons in out-of-core octree from file. Return -1 on error,
57     * else 0 */
58    
59     void OOC_InitFindPhotons (struct PhotonMap *pmap);
60     /* Initialise NN search queue prior to calling kdT_FindPhotons() */
61    
62     void OOC_FindPhotons (struct PhotonMap* pmap, const FVECT pos,
63     const FVECT norm);
64     /* Locate pmap -> squeue.len nearest photons to pos with similar normal
65     * (NULL for volume photons) and return in search queue pmap -> squeue,
66     * starting with the further photon at pmap -> squeue.node */
67    
68     void OOC_Find1Photon (struct PhotonMap* pmap, const FVECT pos,
69     const FVECT norm, Photon *photon);
70     /* Locate single nearest photon to pos with similar normal */
71    
72     int OOC_GetPhoton (struct PhotonMap *pmap, PhotonIdx idx,
73     Photon *photon);
74     /* Retrieve photon referenced by idx from leaf file and return 0 on
75     * success, else -1. */
76    
77     Photon *OOC_GetNearestPhoton (const PhotonSearchQueue *squeue,
78     PhotonIdx idx);
79     /* Retrieve photon from NN search queue after OOC_FindPhotons() */
80    
81     PhotonIdx OOC_FirstPhoton (const struct PhotonMap* pmap);
82     /* Return index to first photon in octree */
83     #endif