ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/oocsort.h
Revision: 2.3
Committed: Tue May 17 17:39:47 2016 UTC (8 years ago) by rschregle
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad5R3, rad5R1, HEAD
Changes since 2.2: +33 -30 lines
Log Message:
Initial import of ooC photon map

File Contents

# User Rev Content
1 greg 2.1 /*
2 rschregle 2.3 ======================================================================
3     Header for N-way out-of-core merge sort for records with 3D keys.
4 greg 2.1
5     Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
6 rschregle 2.3 (c) Lucerne University of Applied Sciences and Arts,
7     supported by the Swiss National Science Foundation (SNSF, #147053)
8     ======================================================================
9 greg 2.1
10 rschregle 2.3 $Id: oocsort.h,v 1.16 2015/09/15 13:33:22 taschreg Exp taschreg $
11 greg 2.1 */
12    
13     #ifndef OOC_SORT_H
14 rschregle 2.3 #define OOC_SORT_H
15 greg 2.1
16 rschregle 2.3 #include "fvect.h"
17     #include <stdio.h>
18 greg 2.1
19    
20 rschregle 2.3 /* Sort records in inFile and append to outFile by subdividing inFile
21     * into small blocks, sorting these in-core, and merging them out-of-core
22     * via a priority queue.
23     *
24     * This is implemented as a recursive (numBlk)-way sort; the input is
25     * successively split into numBlk smaller blocks until these are of size
26     * <= blkSize, i.e. small enough for in-core sorting, then merging the
27     * sorted blocks as the stack unwinds. The in-core sort is parallelised
28     * over numProc processes.
29     *
30     * Parameters are as follows:
31     * inFile Opened input file containing unsorted records
32     * outFile Opened output file containing sorted records
33     * numBlk Number of blocks to divide into / merge from
34     * blkSize Max block size and size of in-core sort buffer, in bytes
35     * numProc Number of parallel processes for in-core sort
36     * recSize Size of input records in bytes
37     * bbOrg Origin of bounding box containing record keys for Morton code
38     * bbSize Extent of bounding box containing record keys for Morton code
39     * key Callback to access 3D coords from records for Morton code
40     */
41     int OOC_Sort (FILE *inFile, FILE *outFile, unsigned numBlk,
42     unsigned long blkSize, unsigned numProc, unsigned recSize,
43     FVECT bbOrg, RREAL bbSize, RREAL *(*key)(const void*));
44 greg 2.1 #endif