/* ====================================================================== Header for N-way out-of-core merge sort of precomputed photon contributions. Roland Schregle (roland.schregle@{hslu.ch, gmail.com}) (c) Lucerne University of Applied Sciences and Arts, supported by the Swiss National Science Foundation (SNSF #179067, "Light Fields for Spatio-Temporal Glare Assessment") ====================================================================== $Id$ */ #ifndef _PMAPCONTRIB_SORT_H #define _PMAPCONTRIB_SORT_H #include "pmapdata.h" int contribPhotonSort ( const PhotonMap *pmap, FILE *leafFile, FVECT bbOrg, RREAL bbSize, unsigned numBlk, unsigned long blkSize, unsigned numProc ); /* Sort photons and their corresponding binned contributions by * subdividing input files into small blocks, sorting these in-core, and * merging them out-of-core via a priority queue. This code is adapted * from oocsort.{h,c} * * The sort is implemented as a recursive (numBlk)-way sort; the input * files are successively split into numBlk smaller blocks until these * are of size <= blkSize, i.e. small enough for in-core sorting, then * merging the sorted blocks as the stack unwinds. The in-core sort is * parallelised over numProc processes. * * Parameters are as follows: * pmap Photon Map with opened photon heap and precomputed * contributions * leafFile Opened output file for sorted photons (=OOC octree leaves) * numBlk Number of blocks to divide into / merge from * blkSize Max block size and size of in-core sort buffer, in bytes * numProc Number of parallel processes for in-core sort * bbOrg Origin of bounding box containing photons * bbSize Extent of bounding box containing photons */ #endif