IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7765


Ignore:
Timestamp:
Jun 29, 2006, 3:57:46 PM (20 years ago)
Author:
Paul Price
Message:

Removed macros to create static variables.
Removed PS_IMAGE_SET macros: use psImageInit.

File:
1 edited

Legend:

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

    r7763 r7765  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.91 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-06-30 01:06:29 $
     8 *  @version $Revision: 1.92 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-06-30 01:57:46 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2424 */
    2525
    26 #include<math.h> // for M_PI
    27 
    28 /*****************************************************************************
    29 These constants are used by various functions in the psLib.
    30  *****************************************************************************/
    31 #define PS_DETERMINE_BRACKET_STEP_SIZE 0.10
    32 #define PS_MAX_LMM_ITERATIONS 100
    33 #define PS_MAX_MINIMIZE_ITERATIONS 100
    34 #define PS_LEFT_SPLINE_DERIV 0.0
    35 #define PS_RIGHT_SPLINE_DERIV 0.0
     26#include <math.h> // for M_PI
     27
    3628/*****************************************************************************
    3729These are common mathimatical constants used by various functions in the psLib.
     
    387379} \
    388380
    389 // The following macros declare and allocate a static polynomial of the
    390 // specified order and type.
    391 
    392 #define PS_POLY_1D_DECLARE_ALLOC_STATIC(NAME, ORDER, TYPE) \
    393 static psPolynomial1D *(NAME) = NULL; \
    394 if ((NAME) == NULL) { \
    395     (NAME) = psPolynomial1DAlloc(TYPE, ORDER); \
    396     p_psMemSetPersistent((NAME), true); \
    397     p_psMemSetPersistent((NAME)->coeff, true); \
    398     p_psMemSetPersistent((NAME)->coeffErr, true); \
    399     p_psMemSetPersistent((NAME)->mask, true); \
    400 } \
    401 
    402 #define PS_POLY_1D_D_DECLARE_ALLOC_STATIC(NAME, ORDER, TYPE) \
    403 static psPolynomial1D *(NAME) = NULL; \
    404 if ((NAME) == NULL) { \
    405     (NAME) = psPolynomial1DAlloc(TYPE, ORDER); \
    406     p_psMemSetPersistent((NAME), true); \
    407 } \
    408 
    409381#define PS_POLY_PRINT_1D(NAME) \
    410382printf("Poly %s: (nX) is (%d)\n", #NAME, NAME->nX);\
     
    515487}\
    516488
    517 #define PS_IMAGE_SET_U8(NAME, VALUE) \
    518 for (int i = 0 ; i < (NAME)->numRows ; i++) { \
    519     for (int j = 0 ; j < (NAME)->numCols ; j++) { \
    520         (NAME)->data.U8[i][j] = (VALUE); \
    521     } \
    522 }\
    523 
    524 #define PS_IMAGE_SET_U16(NAME, VALUE) \
    525 for (int i = 0 ; i < (NAME)->numRows ; i++) { \
    526     for (int j = 0 ; j < (NAME)->numCols ; j++) { \
    527         (NAME)->data.U16[i][j] = (VALUE); \
    528     } \
    529 }\
    530 
    531 #define PS_IMAGE_SET_U32(NAME, VALUE) \
    532 for (int i = 0 ; i < (NAME)->numRows ; i++) { \
    533     for (int j = 0 ; j < (NAME)->numCols ; j++) { \
    534         (NAME)->data.U32[i][j] = (VALUE); \
    535     } \
    536 }\
    537 
    538 #define PS_IMAGE_SET_U64(NAME, VALUE) \
    539 for (int i = 0 ; i < (NAME)->numRows ; i++) { \
    540     for (int j = 0 ; j < (NAME)->numCols ; j++) { \
    541         (NAME)->data.U64[i][j] = (VALUE); \
    542     } \
    543 }\
    544 
    545 #define PS_IMAGE_SET_S8(NAME, VALUE) \
    546 for (int i = 0 ; i < (NAME)->numRows ; i++) { \
    547     for (int j = 0 ; j < (NAME)->numCols ; j++) { \
    548         (NAME)->data.S8[i][j] = (VALUE); \
    549     } \
    550 }\
    551 
    552 #define PS_IMAGE_SET_S16(NAME, VALUE) \
    553 for (int i = 0 ; i < (NAME)->numRows ; i++) { \
    554     for (int j = 0 ; j < (NAME)->numCols ; j++) { \
    555         (NAME)->data.S16[i][j] = (VALUE); \
    556     } \
    557 }\
    558 
    559 #define PS_IMAGE_SET_S32(NAME, VALUE) \
    560 for (int i = 0 ; i < (NAME)->numRows ; i++) { \
    561     for (int j = 0 ; j < (NAME)->numCols ; j++) { \
    562         (NAME)->data.S32[i][j] = (VALUE); \
    563     } \
    564 }\
    565 
    566 #define PS_IMAGE_SET_S64(NAME, VALUE) \
    567 for (int i = 0 ; i < (NAME)->numRows ; i++) { \
    568     for (int j = 0 ; j < (NAME)->numCols ; j++) { \
    569         (NAME)->data.S64[i][j] = (VALUE); \
    570     } \
    571 }\
    572 
    573 #define PS_IMAGE_SET_F32(NAME, VALUE) \
    574 for (int i = 0 ; i < (NAME)->numRows ; i++) { \
    575     for (int j = 0 ; j < (NAME)->numCols ; j++) { \
    576         (NAME)->data.F32[i][j] = (VALUE); \
    577     } \
    578 }\
    579 
    580 #define PS_IMAGE_SET_F64(NAME, VALUE) \
    581 for (int i = 0 ; i < (NAME)->numRows ; i++) { \
    582     for (int j = 0 ; j < (NAME)->numCols ; j++) { \
    583         (NAME)->data.F64[i][j] = (VALUE); \
    584     } \
    585 }\
    586 
    587489/*****************************************************************************
    588490    Misc. macros:
     
    597499((A) * (A))
    598500
    599 #define PRINT_MEMLEAKS(NUM) \
    600 printf("A: ---------------------------------------- (ID: %d)\n", NUM); \
    601 memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false); \
    602 printf("B: ---------------------------------------- (%d)\n", memLeaks); \
    603 
    604501# define PS_SWAP(X,Y) {double tmp=(X); (X) = (Y); (Y) = tmp;}
Note: See TracChangeset for help on using the changeset viewer.