IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 450


Ignore:
Timestamp:
Apr 19, 2004, 10:10:46 AM (22 years ago)
Author:
harman
Message:

Changed print statements to logging statements

Location:
trunk/psLib/src/collections
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/collections/psSort.c

    r438 r450  
    1 /** @file  psSort.h
    2  *
    3  *  @brief Sorts an array of floats
     1/** @file  psSort.c
     2 *
     3 *  @brief Sorts arrays
    44 *
    55 *  The psSort functions use the qsort() stdlib function with a user-defined callback to sort an array of
     
    1414 *  @author Ross Harman, MHPCC
    1515 *   
    16  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    17  *  @date $Date: 2004-04-17 02:43:59 $
     16 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     17 *  @date $Date: 2004-04-19 20:10:46 $
    1818 *
    1919 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3232#include "psArray.h"
    3333#include "psSort.h"
     34#include "psError.h"
    3435
    3536/******************************************************************************/
     
    8081   
    8182    if(x == NULL || y == NULL) {
    82         printf("Null input argument\n");
     83        psError(__func__, " : Line %d - Null input argument: x=%d y=%d\n", __LINE__, x, y);
    8384    }
    8485   
     
    8788   
    8889    if(item1 == NULL || item2 == NULL) {
    89         printf("Improper cast to float\n");
     90        psError(__func__, " : Line %d - Improper cast to float: item1=%d item2=%d\n", __LINE__, item1, item2);
    9091    }
    9192   
     
    101102}
    102103
    103 /** Sort an array of floats.
    104  *
    105  *  Sorts an array of floats in ascendin order with the qsort() stdlib function.
    106  *
    107  *  @return  psFloatArray*: Pointer to sorted psFloatArray.
    108  */
    109  
     104/*****************************************************************************/
     105/* FUNCTION IMPLEMENTATION - PUBLIC                                          */
     106/*****************************************************************************/
     107
    110108psFloatArray *psSort(
    111109    psFloatArray *restrict outArray,        /**< Sorted output array. */
     
    121119
    122120    if(outArray == NULL) {
    123         printf("NULL output array n");
     121        psError(__func__, " : Line %d - Null output array\n", __LINE__);
    124122        return outArray;
    125123    }
    126124   
    127125    if(inArray == NULL) {
    128         printf("NULL input array\n");
     126        psError(__func__, " : Line %d - Null input array\n", __LINE__);
    129127        return outArray;
    130128    }
     
    138136   
    139137    if(inN != outN) {
    140         printf("Input and output array sizes are not equal");
     138        psError(__func__, " : Line %d - Input and output array sizes are not equal: in=%d out=%d\n", __LINE__,
     139                inN, outN);
    141140        return outArray;
    142141    }
     
    152151    return outArray;
    153152}
    154 
    155 /** Creates an array of indices based on sort odred of float array.
    156  *
    157  *  Sorts an array of floats and creates an integer array holding indices of sorted float values based on
    158  *  pre-sort index positions.
    159  *
    160  *  @return  psIntArray*: Pointer to psIntArray of sorted indices.
    161  */
    162153
    163154psIntArray *psSortIndex(
     
    177168   
    178169    if(outArray == NULL) {
    179         printf("NULL output array n");
     170        psError(__func__, " : Line %d - Null output array\n", __LINE__);
    180171        return outArray;
    181172    }
    182173   
    183174    if(inArray == NULL) {
    184         printf("NULL input array\n");
     175        psError(__func__, " : Line %d - Null input array\n", __LINE__);
    185176        return outArray;
    186177    }
     
    193184
    194185    if(inN != outN) {
    195         printf("Input and output array sizes are not equal");
     186        psError(__func__, " : Line %d - Input and output array sizes are not equal: in=%d out=%d\n", __LINE__,
     187                inN, outN);
    196188        return outArray;
    197189    }
  • 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
    148psFloatArray *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
    258psIntArray *psSortIndex(psIntArray *restrict out, const psFloatArray *restrict inArray);
     59
     60#endif
Note: See TracChangeset for help on using the changeset viewer.