ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/oocsort.h
(Generate patch)

Comparing ray/src/rt/oocsort.h (file contents):
Revision 2.1 by greg, Tue Feb 24 19:39:26 2015 UTC vs.
Revision 2.4 by greg, Tue Sep 17 16:36:04 2024 UTC

# Line 1 | Line 1
1   /*
2 <   ==================================================================
3 <   Header for N-way hybrid out-of-core merge sort
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) Fraunhofer Institute for Solar Energy Systems,
7 <       Lucerne University of Applied Sciences & Arts  
8 <   ==================================================================
6 >   (c) Lucerne University of Applied Sciences and Arts,
7 >       supported by the Swiss National Science Foundation (SNSF, #147053)
8 >   ======================================================================  
9    
10 <   $Id $
10 >   $Id$
11   */
12  
13   #ifndef OOC_SORT_H
14 < #define OOC_SORT_H
15 <   #include <stdint.h>
14 >   #define OOC_SORT_H
15    
16 <   #define OOC_SORT_BUFSIZE (1 << 13)     /* 8kb */
16 >   #include "fvect.h"
17 >   #include <stdio.h>  
18    
19 <   typedef uint64_t OOC_Sort_Key;
19 > #ifdef __cplusplus
20 > extern "C" {
21 > #endif
22  
23 < #if 0  
24 <   int OOC_Sort (const char *inFile, const char *outFile,
25 <                 unsigned long blkSize, unsigned recSize,
26 <                 OOC_Sort_Key (*priority)(const void *));                
27 <   /* Sort records in inFile and output to outFile by (a) internally
28 <    * quicksorting block of blkSize bytes at a time, then (b) merging them
29 <    * via a priority queue.  RecSize specifies the size in bytes of each
30 <    * data record.  The priority() callback evaluates a record's priority
31 <    * and must be supplied by the caller.  */
32 < #else    
33 <   int OOC_Sort (const char *inFile, const char *outFile,
34 <                 unsigned numBlocks, unsigned recSize,
35 <                 OOC_Sort_Key (*priority)(const void *));                
36 <   /* Sort records in inFile and output to outFile by (a) internally
37 <    * quicksorting numBlocks blocks at a time, then (b) merging them
38 <    * via a priority queue.  RecSize specifies the size in bytes of each
39 <    * data record.  The priority() callback evaluates a record's priority
40 <    * (ordinal index) and must be supplied by the caller.  */
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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines