IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9540


Ignore:
Timestamp:
Oct 13, 2006, 12:04:58 PM (20 years ago)
Author:
Paul Price
Message:

Fixing psTraceGetLevel to use same convention as for psTrace

Location:
trunk/psLib/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psCoord.c

    r9538 r9540  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.124 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2006-10-13 21:13:47 $
     12*  @version $Revision: 1.125 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2006-10-13 22:04:58 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    612612{
    613613    psTrace("psLib.astro", 3, "---- %s() begin ----\n", __func__);
    614     psTrace("psLib.astro", 3, "tracelevel(%s) is %d\n", __func__, psTraceGetLevel(__func__));
     614    psTrace("psLib.astro", 3, "tracelevel(%s) is %d\n", __func__, psTraceGetLevel("psLib.astro"));
    615615
    616616    PS_ASSERT_PTR_NON_NULL(trans1, NULL);
     
    620620    psTrace("psLib.astro", 5, "trans2->x is (%d, %d) order.\n", trans2->x->nX, trans2->x->nY);
    621621    psTrace("psLib.astro", 5, "trans2->y is (%d, %d) order.\n", trans2->y->nX, trans2->y->nY);
    622     if (psTraceGetLevel(__func__) >= 6) {
     622    if (psTraceGetLevel("psLib.astro") >= 6) {
    623623        PS_POLY_PRINT_2D(trans1->x);
    624624        PS_POLY_PRINT_2D(trans1->y);
     
    703703                psPolynomial2D *newPoly = multiplyDPoly2D(trans1XPolys[t2x], trans1YPolys[t2y]);
    704704
    705                 if (psTraceGetLevel(__func__) >= 6) {
     705                if (psTraceGetLevel("psLib.astro") >= 6) {
    706706                    PS_POLY_PRINT_2D(newPoly);
    707707                }
     
    714714                }
    715715
    716                 if (psTraceGetLevel(__func__) >= 6) {
     716                if (psTraceGetLevel("psLib.astro") >= 6) {
    717717                    PS_POLY_PRINT_2D(myPT->x);
    718718                }
     
    721721        }
    722722    }
    723     if (psTraceGetLevel(__func__) >= 6) {
     723    if (psTraceGetLevel("psLib.astro") >= 6) {
    724724        psTrace("psLib.astro", 6, "The final x-polynomial\n");
    725725        PS_POLY_PRINT_2D(myPT->x);
     
    737737                psPolynomial2D *newPoly = multiplyDPoly2D(trans1XPolys[t2x], trans1YPolys[t2y]);
    738738
    739                 if (psTraceGetLevel(__func__) >= 6) {
     739                if (psTraceGetLevel("psLib.astro") >= 6) {
    740740                    PS_POLY_PRINT_2D(newPoly);
    741741                }
     
    747747                    }
    748748                }
    749                 if (psTraceGetLevel(__func__) >= 6) {
     749                if (psTraceGetLevel("psLib.astro") >= 6) {
    750750                    PS_POLY_PRINT_2D(myPT->x);
    751751                }
     
    754754        }
    755755    }
    756     if (psTraceGetLevel(__func__) >= 6) {
     756    if (psTraceGetLevel("psLib.astro") >= 6) {
    757757        psTrace("psLib.astro", 6, "The final y-polynomial\n");
    758758        PS_POLY_PRINT_2D(myPT->y);
  • trunk/psLib/src/math/psMinimizeLMM.c

    r9538 r9540  
    1010 *  @author EAM, IfA
    1111 *
    12  *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-10-13 21:13:48 $
     12 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-10-13 22:04:58 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    409409    }
    410410    // dump some useful info if trace is defined
    411     if (psTraceGetLevel(__func__) >= 6) {
     411    if (psTraceGetLevel("psLib.math") >= 6) {
    412412        p_psImagePrint(psTraceGetDestination(), alpha, "alpha guess (0)");
    413413        p_psVectorPrint(psTraceGetDestination(), beta, "beta guess (0)");
     
    438438
    439439        // dump some useful info if trace is defined
    440         if (psTraceGetLevel(__func__) >= 6) {
     440        if (psTraceGetLevel("psLib.math") >= 6) {
    441441            p_psImagePrint(psTraceGetDestination(), Alpha, "alpha guess (1)");
    442442            p_psVectorPrint(psTraceGetDestination(), Beta, "beta guess (1)");
    443443            p_psVectorPrint(psTraceGetDestination(), Params, "params guess (1)");
    444444        }
    445         if (psTraceGetLevel(__func__) >= 6) {
     445        if (psTraceGetLevel("psLib.math") >= 6) {
    446446            if (psTraceGetLevel (__func__) >= 6) {
    447447                psTrace("psLib.math", 6, "The current Param vector: \n");
     
    470470
    471471        // dump some useful info if trace is defined
    472         if (psTraceGetLevel(__func__) >= 6) {
     472        if (psTraceGetLevel("psLib.math") >= 6) {
    473473            p_psImagePrint(psTraceGetDestination(), Alpha, "alpha guess (2)");
    474474            p_psVectorPrint(psTraceGetDestination(), Beta, "beta guess (2)");
  • trunk/psLib/src/math/psMinimizePolyFit.c

    r8627 r9540  
    1010 *  @author EAM, IfA
    1111 *
    12  *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-08-26 04:34:28 $
     12 *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-10-13 22:04:58 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    397397    psFree(sums);
    398398
    399     if (psTraceGetLevel(__func__) >= 6) {
     399    if (psTraceGetLevel("psLib.math") >= 6) {
    400400        PS_IMAGE_PRINT_F64(A);
    401401        PS_VECTOR_PRINT_F64(B);
     
    487487    }
    488488
    489     if (psTraceGetLevel(__func__) >= 6) {
     489    if (psTraceGetLevel("psLib.math") >= 6) {
    490490        psTrace("psLib.math", 6, "VectorFitPolynomial1D()\n");
    491491        for (psS32 i = 0; i < f->n; i++) {
     
    579579    psFree(xSums);
    580580
    581     if (psTraceGetLevel(__func__) >= 4) {
     581    if (psTraceGetLevel("psLib.math") >= 4) {
    582582        printf("Least-squares vector:\n");
    583583        for (int i = 0; i < nTerm; i++) {
     
    818818        psTrace("psLib.math", 6, "Loop iteration %d.  Calling psVectorFitPolynomial1D()\n", N);
    819819        psS32 Nkeep = 0;
    820         if (psTraceGetLevel(__func__) >= 6) {
     820        if (psTraceGetLevel("psLib.math") >= 6) {
    821821            if (mask != NULL) {
    822822                for (psS32 i = 0 ; i < mask->n ; i++) {
     
    847847            }
    848848        }
    849         if (psTraceGetLevel(__func__) >= 6) {
     849        if (psTraceGetLevel("psLib.math") >= 6) {
    850850            if (mask != NULL) {
    851851                for (psS32 i = 0 ; i < mask->n ; i++) {
     
    12521252        psTrace("psLib.math", 6, "Loop iteration %d.  Calling psVectorFitPolynomial1D()\n", N);
    12531253        psS32 Nkeep = 0;
    1254         if (psTraceGetLevel(__func__) >= 6) {
     1254        if (psTraceGetLevel("psLib.math") >= 6) {
    12551255            if (mask != NULL) {
    12561256                for (psS32 i = 0 ; i < mask->n ; i++) {
     
    12821282        }
    12831283
    1284         if (psTraceGetLevel(__func__) >= 6) {
     1284        if (psTraceGetLevel("psLib.math") >= 6) {
    12851285            if (mask != NULL) {
    12861286                for (psS32 i = 0 ; i < mask->n ; i++) {
     
    17721772        psTrace("psLib.math", 6, "Loop iteration %d.  Calling psVectorFitPolynomial1D()\n", N);
    17731773        psS32 Nkeep = 0;
    1774         if (psTraceGetLevel(__func__) >= 6) {
     1774        if (psTraceGetLevel("psLib.math") >= 6) {
    17751775            if (mask != NULL) {
    17761776                for (psS32 i = 0 ; i < mask->n ; i++) {
     
    18011801        }
    18021802
    1803         if (psTraceGetLevel(__func__) >= 6) {
     1803        if (psTraceGetLevel("psLib.math") >= 6) {
    18041804            if (mask != NULL) {
    18051805                for (psS32 i = 0 ; i < mask->n ; i++) {
     
    23402340        psTrace("psLib.math", 6, "Loop iteration %d.  Calling psVectorFitPolynomial4D()\n", N);
    23412341        psS32 Nkeep = 0;
    2342         if (psTraceGetLevel(__func__) >= 6) {
     2342        if (psTraceGetLevel("psLib.math") >= 6) {
    23432343            if (mask != NULL) {
    23442344                for (psS32 i = 0 ; i < mask->n ; i++) {
     
    23702370        }
    23712371
    2372         if (psTraceGetLevel(__func__) >= 6) {
     2372        if (psTraceGetLevel("psLib.math") >= 6) {
    23732373            if (mask != NULL) {
    23742374                for (psS32 i = 0 ; i < mask->n ; i++) {
  • trunk/psLib/src/math/psMinimizePowell.c

    r8245 r9540  
    1111 *  NOTE: XXX: The SDR is silent about data types.  F32 is implemented here.
    1212 *
    13  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2006-08-09 02:26:44 $
     13 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-10-13 22:04:58 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    380380    }
    381381
    382     if (6 <= psTraceGetLevel(__func__)) {
     382    if (6 <= psTraceGetLevel("psLib.math")) {
    383383        for (i=0;i<params->n;i++) {
    384384            psTrace("psLib.math", 6, "(params, paramMask, line)[%d] is (%f %d %f)\n", i,
  • trunk/psLib/src/math/psPolynomial.c

    r9538 r9540  
    77*  polynomials.  It also contains a Gaussian functions.
    88*
    9 *  @version $Revision: 1.150 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2006-10-13 21:13:48 $
     9*  @version $Revision: 1.151 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2006-10-13 22:04:58 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    189189    }
    190190
    191     if (psTraceGetLevel(__func__) >= 6) {
     191    if (psTraceGetLevel("psLib.math") >= 6) {
    192192        for (psS32 j = 0; j < numPolys; j++) {
    193193            PS_POLY_PRINT_1D(chebPolys[j]);
  • trunk/psLib/src/math/psSpline.c

    r9538 r9540  
    66*  This file contains the routines that allocate, free, and evaluate splines.
    77*
    8 *  @version $Revision: 1.154 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2006-10-13 21:13:48 $
     8*  @version $Revision: 1.155 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2006-10-13 22:04:58 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    120120{
    121121    psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
    122     if (psTraceGetLevel(__func__) >= 6) {
     122    if (psTraceGetLevel("psLib.math") >= 6) {
    123123        p_psVectorPrint(1, (psVector *) x, "x");
    124124        p_psVectorPrint(1, (psVector *) y, "y");
     
    406406    PS_ASSERT_VECTOR_NON_NULL(x, NULL);
    407407    PS_ASSERT_VECTOR_TYPE_F32_OR_F64(x, NULL);
    408     if (psTraceGetLevel(__func__) >= 6) {
     408    if (psTraceGetLevel("psLib.math") >= 6) {
    409409        PS_VECTOR_PRINT_F32(x);
    410410        PS_PRINT_SPLINE2((psSpline1D *) spline);
  • trunk/psLib/src/math/psStats.c

    r9538 r9540  
    1616 * use ->min and ->max (PS_STAT_USE_RANGE)
    1717 *
    18  *  @version $Revision: 1.186 $ $Name: not supported by cvs2svn $
    19  *  @date $Date: 2006-10-13 21:13:48 $
     18 *  @version $Revision: 1.187 $ $Name: not supported by cvs2svn $
     19 *  @date $Date: 2006-10-13 22:04:58 $
    2020 *
    2121 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    480480    PS_ASSERT_PTR_NON_NULL(histogram->bounds, NULL);
    481481    PS_ASSERT_PTR_NON_NULL(histogram->nums, NULL);
    482     if (psTraceGetLevel(__func__) >= 8) {
     482    if (psTraceGetLevel("psLib.math") >= 8) {
    483483        PS_VECTOR_PRINT_F32(histogram->nums);
    484484    }
     
    561561    }
    562562
    563     if (psTraceGetLevel(__func__) >= 8) {
     563    if (psTraceGetLevel("psLib.math") >= 8) {
    564564        PS_VECTOR_PRINT_F32(smooth);
    565565    }
     
    705705{
    706706    psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
    707     psTrace("psLib.math", 4, "Trace level is %d\n", psTraceGetLevel(__func__));
     707    psTrace("psLib.math", 4, "Trace level is %d\n", psTraceGetLevel("psLib.math"));
    708708
    709709    // Ensure that stats->clipIter is within the proper range.
     
    886886    psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
    887887    psTrace("psLib.math", 5, "binNum, yVal is (%d, %f)\n", binNum, yVal);
    888     if (psTraceGetLevel(__func__) >= 8) {
     888    if (psTraceGetLevel("psLib.math") >= 8) {
    889889        PS_VECTOR_PRINT_F32(xVec);
    890890        PS_VECTOR_PRINT_F32(yVec);
     
    10581058{
    10591059    psTrace("psLib.math", 4, "---- %s() begin ----\n", __func__);
    1060     if (psTraceGetLevel(__func__) >= 8) {
     1060    if (psTraceGetLevel("psLib.math") >= 8) {
    10611061        PS_VECTOR_PRINT_F32(myVector);
    10621062    }
     
    11411141        histogram = psHistogramAlloc(min, max, numBins);
    11421142        histogram = psVectorHistogram(histogram, myVector, errors, mask, maskVal);
    1143         if (psTraceGetLevel(__func__) >= 8) {
     1143        if (psTraceGetLevel("psLib.math") >= 8) {
    11441144            PS_VECTOR_PRINT_F32(histogram->bounds);
    11451145            PS_VECTOR_PRINT_F32(histogram->nums);
     
    11521152            cumulative->nums->data.F32[i] = cumulative->nums->data.F32[i-1] + histogram->nums->data.F32[i];
    11531153        }
    1154         if (psTraceGetLevel(__func__) >= 8) {
     1154        if (psTraceGetLevel("psLib.math") >= 8) {
    11551155            PS_VECTOR_PRINT_F32(cumulative->bounds);
    11561156            PS_VECTOR_PRINT_F32(cumulative->nums);
     
    14171417        psHistogram *histogram = psHistogramAlloc(min, max, numBins); // A new histogram (without outliers)
    14181418        histogram = psVectorHistogram(histogram, myVector, errors, mask, maskVal);
    1419         if (psTraceGetLevel(__func__) >= 8) {
     1419        if (psTraceGetLevel("psLib.math") >= 8) {
    14201420            PS_VECTOR_PRINT_F32(histogram->nums);
    14211421        }
     
    14231423        // Smooth the resulting histogram with a Gaussian with sigma_s = 1 bin.
    14241424        psVector *smoothed = vectorSmoothHistGaussian(histogram, newBinSize); // Smoothed histogram
    1425         if (psTraceGetLevel(__func__) >= 8) {
     1425        if (psTraceGetLevel("psLib.math") >= 8) {
    14261426            PS_VECTOR_PRINT_F32(smoothed);
    14271427        }
     
    14961496            x->data[j] = ordinate;
    14971497        }
    1498         if (psTraceGetLevel(__func__) >= 8) {
     1498        if (psTraceGetLevel("psLib.math") >= 8) {
    14991499            // XXX: Print the x array somehow.
    15001500            PS_VECTOR_PRINT_F32(y);
     
    15251525        params->data.F32[0] = stats->robustMedian;
    15261526        params->data.F32[1] = sigma;
    1527         if (psTraceGetLevel(__func__) >= 8) {
     1527        if (psTraceGetLevel("psLib.math") >= 8) {
    15281528            PS_VECTOR_PRINT_F32(params);
    15291529            PS_VECTOR_PRINT_F32(y);
     
    15401540            return false;
    15411541        }
    1542         if (psTraceGetLevel(__func__) >= 8) {
     1542        if (psTraceGetLevel("psLib.math") >= 8) {
    15431543            PS_VECTOR_PRINT_F32(params);
    15441544        }
  • trunk/psLib/src/sys/psTrace.c

    r8601 r9540  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.78 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-08-25 22:01:29 $
     11 *  @version $Revision: 1.79 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-10-13 22:04:58 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6969static void componentFree(p_psComponent* comp);
    7070static p_psComponent* componentAlloc(const char *name, int level);
     71static int getLevel(const char *facil);
    7172
    7273/*****************************************************************************
     
    122123    }
    123124}
     125
     126// Append the function name to the facility
     127// NB: declares TARGET!
     128#define FACILITY(TARGET, FUNC, FACIL) \
     129size_t _facilLength = strlen(FACIL); /* Length of facility name */ \
     130size_t _funcLength = strlen(FUNC);   /* Length of function name */ \
     131char TARGET[_facilLength + _funcLength + 2]; /* facility + the function name */ \
     132strcpy(&TARGET[0], FACIL); \
     133TARGET[_facilLength] = '.'; \
     134strcpy(&TARGET[_facilLength + 1], FUNC);
     135
    124136
    125137/*****************************************************************************
     
    283295        compName = (char *) comp;
    284296    }
    285     prevLevel = psTraceGetLevel(compName);
     297    prevLevel = getLevel(compName);
    286298    // Add the new component to the component tree.
    287299    if ( !componentAdd(compName, level) ) {
     
    385397}
    386398
    387 /*****************************************************************************
    388     psTraceLevelGet()
     399
     400/*****************************************************************************
     401    getLevel()
    389402 Return a trace level of "name" in the root component tree.  If the
    390403 exact string of components in "name" does not exist in the root
    391404 tree, we return the deepest level of the match.
    392     Input:
    393  name
    394     Output:
    395  none
    396     Return:
    397  The level of "name" in the root component tree.
    398  *****************************************************************************/
    399 int psTraceGetLevel(const char *name)
    400 {
    401     PS_ASSERT_PTR_NON_NULL(name, 0);
    402 
    403     psS32 traceLevel;
    404 
     405 *****************************************************************************/
     406static int getLevel(const char *name)
     407{
    405408    if (cRoot == NULL) {
    406409        return (PS_UNKNOWN_TRACE_LEVEL);
    407410    }
     411
     412    psS32 traceLevel;
    408413
    409414    // If the component name has no leading dot, then supply it.
     
    430435
    431436    return(traceLevel);
     437}
     438
     439int p_psTraceGetLevel(const char *file,
     440                      int lineno,
     441                      const char *func,
     442                      const char *name)
     443{
     444    PS_ASSERT_PTR_NON_NULL(name, 0);
     445    PS_ASSERT_PTR_NON_NULL(func, 0);
     446
     447    FACILITY(facility, func, name);
     448    return getLevel(facility);
    432449}
    433450
     
    520537    // Only display this message if it's trace level is less than the level
    521538    // of it's associatedcomponent.
    522     if (level <= psTraceGetLevel(comp)) {
     539    if (level <= getLevel(comp)) {
    523540
    524541        char clevel = 0;                    // letter-name for level
     
    641658    PS_ASSERT_PTR_NON_NULL(format, );
    642659
    643     // XXX file & lineo are currently unused
    644 
    645     // Append the function name to the facility
    646     size_t facilLength = strlen(facil); // Length of facility name
    647     size_t funcLength = strlen(func);   // Length of function name
    648     char fullFacil[facilLength + funcLength + 2]; // Full facility name is the facility + the function name
    649     strcpy(&fullFacil[0], facil);
    650     fullFacil[facilLength] = '.';
    651     strcpy(&fullFacil[facilLength + 1], func);
     660    FACILITY(name, func, facil);
    652661
    653662    va_list ap;
    654663    va_start(ap, format);
    655     psTraceV(fullFacil, level, format, ap);
     664    psTraceV(name, level, format, ap);
    656665    va_end(ap);
    657666}
  • trunk/psLib/src/sys/psTrace.h

    r8627 r9540  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-08-26 04:34:28 $
     11 *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-10-13 22:04:58 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8989);
    9090
     91/** Get the trace level
     92 *
     93 *  @return int:    Trace Level
     94 */
     95int psTraceGetLevel(
     96    const char *facil                  ///< facilty of interest
     97);
     98
    9199#else // DOXYGEN
    92100#ifdef __GNUC__
     
    112120);
    113121#endif // __GNUC__
     122
     123/** Get the trace level
     124 *
     125 *  @return int:    Trace Level
     126 */
     127int p_psTraceGetLevel(
     128    const char* file,                  ///< file name
     129    int lineno,                        ///< line number in file
     130    const char *func,                  ///< function name
     131    const char *facil                  ///< facilty of interest
     132);
     133
    114134#ifndef SWIG
    115135#define psTrace(facil, level, ...) p_psTrace(__FILE__,__LINE__,__func__,facil, level, __VA_ARGS__)
     136#define psTraceGetLevel(facil) p_psTraceGetLevel(__FILE__,__LINE__,__func__,facil)
    116137/** Sends a trace message. */
    117138void psTraceV(
     
    131152    const char *facil,                 ///< facilty of interest
    132153    int level                          ///< desired trace level
    133 );
    134 
    135 /** Get the trace level
    136  *
    137  *  @return int:    Trace Level
    138  */
    139 int psTraceGetLevel(
    140     const char *facil                  ///< facilty of interest
    141154);
    142155
Note: See TracChangeset for help on using the changeset viewer.