ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/oocsort.h
Revision: 2.4
Committed: Tue Sep 17 16:36:04 2024 UTC (7 months, 2 weeks ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 2.3: +9 -1 lines
Log Message:
chore: Added extern "C" to headers to avoid C++ name mangling

File Contents

# Content
1 /*
2 ======================================================================
3 Header for N-way out-of-core merge sort for records with 3D keys.
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: oocsort.h,v 2.3 2016/05/17 17:39:47 rschregle Exp $
11 */
12
13 #ifndef OOC_SORT_H
14 #define OOC_SORT_H
15
16 #include "fvect.h"
17 #include <stdio.h>
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 /* Sort records in inFile and append to outFile by subdividing inFile
24 * into small blocks, sorting these in-core, and merging them out-of-core
25 * via a priority queue.
26 *
27 * This is implemented as a recursive (numBlk)-way sort; the input is
28 * successively split into numBlk smaller blocks until these are of size
29 * <= blkSize, i.e. small enough for in-core sorting, then merging the
30 * sorted blocks as the stack unwinds. The in-core sort is parallelised
31 * over numProc processes.
32 *
33 * Parameters are as follows:
34 * inFile Opened input file containing unsorted records
35 * outFile Opened output file containing sorted records
36 * numBlk Number of blocks to divide into / merge from
37 * blkSize Max block size and size of in-core sort buffer, in bytes
38 * numProc Number of parallel processes for in-core sort
39 * recSize Size of input records in bytes
40 * bbOrg Origin of bounding box containing record keys for Morton code
41 * bbSize Extent of bounding box containing record keys for Morton code
42 * key Callback to access 3D coords from records for Morton code
43 */
44 int OOC_Sort (FILE *inFile, FILE *outFile, unsigned numBlk,
45 unsigned long blkSize, unsigned numProc, unsigned recSize,
46 FVECT bbOrg, RREAL bbSize, RREAL *(*key)(const void*));
47
48 #ifdef __cplusplus
49 }
50 #endif
51
52 #endif