IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 29, 2006, 4:20:43 PM (20 years ago)
Author:
Paul Price
Message:

Moved PS_ASSERT functions into appropriate places. Created psAssert.h for general PS_ASSERT functions. Vector-specific assertions went to psVector.h; image-specific assertions went to psImage.h, etc. psConstants.h remains, but only contains specific math constants and functions, as the name implies.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psPolynomial.h

    r6348 r7766  
    1111 *  @author GLG, MHPCC
    1212 *
    13  *  @version $Revision: 1.62 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2006-02-07 23:36:15 $
     13 *  @version $Revision: 1.63 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-06-30 02:20:06 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    307307
    308308
     309/*****************************************************************************
     310    PS_POLY macros:
     311*****************************************************************************/
     312#define PS_ASSERT_POLY1D(NAME, RVAL) \
     313if (false == psMemCheckPolynomial1D(NAME)) { \
     314    psError(PS_ERR_BAD_PARAMETER_NULL, true, \
     315            "Unallowable operation: argument %s is not a psPolynomial1D struct.\n",\
     316            #NAME); \
     317    return(RVAL); \
     318} \
     319
     320#define PS_ASSERT_POLY_NON_NULL(NAME, RVAL) \
     321if ((NAME) == NULL || (NAME)->coeff == NULL) { \
     322    psError(PS_ERR_BAD_PARAMETER_NULL, true, \
     323            "Unallowable operation: polynomial %s or its coeffs is NULL.", \
     324            #NAME); \
     325    return(RVAL); \
     326} \
     327
     328#define PS_ASSERT_POLY_TYPE(NAME, TYPE, RVAL) \
     329if ((NAME)->type != TYPE) { \
     330    psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
     331            "Unallowable operation: polynomial %s has wrong type.", #NAME); \
     332    return(RVAL); \
     333} \
     334
     335#define PS_POLY_PRINT_1D(NAME) \
     336printf("Poly %s: (nX) is (%d)\n", #NAME, NAME->nX);\
     337for (psS32 i = 0 ; i < NAME->nX+1 ; i++) {\
     338    printf("%s->coeff[%d] is %f\n", #NAME, i, NAME->coeff[i]); \
     339}\
     340
     341#define PS_POLY_PRINT_2D(NAME) \
     342printf("Poly %s: (nX, nY) is (%d, %d)\n", #NAME, NAME->nX, NAME->nY);\
     343for (psS32 i = 0 ; i < NAME->nX+1 ; i++) {\
     344    for (psS32 j = 0 ; j < NAME->nY+1 ; j++) {\
     345        printf("%s->coeff[%d][%d] is %f\n", #NAME, i, j, NAME->coeff[i][j]); \
     346    }\
     347}\
    309348
    310349/** \} */ // End of MathGroup Functions
Note: See TracChangeset for help on using the changeset viewer.