Changeset 450 for trunk/psLib/src/collections/psSort.h
- Timestamp:
- Apr 19, 2004, 10:10:46 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/collections/psSort.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psSort.h
r437 r450 1 /** @file psSort.h 2 * 3 * @brief Sorts arrays 4 * 5 * The psSort functions use the qsort() stdlib function with a user-defined callback to sort an array of 6 * floats. The qsort function requires the starting point of the array, number of elements in the array, size 7 * of each element, and a pointer to a callback comparison function. Once called, qsort() will sort the array 8 * contents in ascending order according to the comparison function. The comparison function is called with 9 * two arguments that point to the objects being compared - in this case two floats. The comparison function 10 * must return an integer less than, equal to, or greater than zero if the first argument is considered to be 11 * respectively less than, equal to, or greater than the second. If two members compare as equal, their order 12 * in the sorted array is undefined. 13 * 14 * @author Ross Harman, MHPCC 15 * 16 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-04-19 20:10:46 $ 18 * 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 20 */ 21 22 #ifndef PSSORT_H 23 #define PSSORT_H 24 25 /******************************************************************************/ 26 /* DEFINE STATEMENTS */ 27 /******************************************************************************/ 28 29 // None 30 31 /******************************************************************************/ 32 /* TYPE DEFINITIONS */ 33 /******************************************************************************/ 34 35 // None 36 37 /*****************************************************************************/ 38 /* FUNCTION PROTOTYPES */ 39 /*****************************************************************************/ 40 41 /** Sort an array of floats. 42 * 43 * Sorts an array of floats in ascendin order with the qsort() stdlib function. 44 * 45 * @return psFloatArray*: Pointer to sorted psFloatArray. 46 */ 47 1 48 psFloatArray *psSort(psFloatArray *restrict out, const psFloatArray *restrict inArray); 49 50 /** Creates an array of indices based on sort odred of float array. 51 * 52 * Sorts an array of floats and creates an integer array holding indices of sorted float values based on 53 * pre-sort index positions. 54 * 55 * @return psIntArray*: Pointer to psIntArray of sorted indices. 56 */ 57 2 58 psIntArray *psSortIndex(psIntArray *restrict out, const psFloatArray *restrict inArray); 59 60 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
