Actual source code: const.h

  1: /*$Id: const.h,v 1.4 2001/04/11 03:22:17 balay Exp $*/
  2: /**********************************const.h*************************************
  3: SPARSE GATHER-SCATTER PACKAGE: bss_malloc bss_malloc ivec error comm gs queue

  5: Author: Henry M. Tufo III

  7: e-mail: hmt@cs.brown.edu

  9: snail-mail:
 10: Division of Applied Mathematics
 11: Brown University
 12: Providence, RI 02912

 14: Last Modification: 
 15: 6.21.97
 16: ***********************************const.h************************************/

 18: /**********************************const.h*************************************
 19: File Description:
 20: -----------------

 22: ***********************************const.h************************************/
 23: #include <limits.h>


 26: #define X          0
 27: #define Y          1
 28: #define Z          2
 29: #define XY         3
 30: #define XZ         4
 31: #define YZ         5


 34: #define THRESH          0.2
 35: #define N_HALF          4096
 36: #define PRIV_BUF_SZ     45

 38: /*4096 8192 32768 65536 1048576 */
 39: #define MAX_MSG_BUF     32768

 41: /* fortran gs limit */
 42: #define MAX_GS_IDS      100

 44: #define FULL          2
 45: #define PARTIAL       1
 46: #define NONE          0

 48: #define BYTE                8
 49: #define BIT_0                0x1
 50: #define BIT_1                0x2
 51: #define BIT_2                0x4
 52: #define BIT_3                0x8
 53: #define BIT_4                0x10
 54: #define BIT_5                0x20
 55: #define BIT_6                0x40
 56: #define BIT_7                0x80
 57: #define TOP_BIT         INT_MIN
 58: #define ALL_ONES        -1

 60: #define FALSE                0
 61: #define TRUE                1

 63: #define C                0
 64: #define FORTRAN         1


 67: #define MAX_VEC                1674
 68: #define FORMAT                30
 69: #define MAX_COL_LEN            100
 70: #define MAX_LINE        FORMAT*MAX_COL_LEN
 71: #define   DELIM         " \n \t"
 72: #define LINE                12
 73: #define C_LINE                80





 79: #define PTR_LEN                (int)sizeof(void *)
 80: #define INT             int
 81: #define INT_PTR_LEN        (int)sizeof(int *)
 82: #define INT_LEN                (int)sizeof(int)
 83: #define CHAR_LEN        (int)sizeof(char)

 85: /* assuming LP64 for 64bit systems and standard sizeof(long) = 32 for
 86:    32bit systems as well as sizeof(int) = sizeof(long) = 64 on _CRAYMPP
 87:    we can assume sizeof(long) = sizeof(void *) and therefore pointer
 88:    arithmetic can always be done with longs with no loss of accuracy */
 89: #define PTRINT          long

 91: #ifdef MPISRC
 92: #define INT_TYPE        MPI_INT
 93: #else
 94: #define INT_TYPE        1
 95: #endif


 98: #if defined(MPISRC) && defined(r8)
 99: #define REAL_TYPE        MPI_DOUBLE
100: #elif MPISRC
101: #define REAL_TYPE        MPI_FLOAT
102: #else
103: #define REAL_TYPE        2
104: #endif

106: #ifdef MPISRC
107: #define DATA_TYPE        MPI_Datatype
108: #else
109: #define DATA_TYPE        INT
110: #endif


113: #define REAL                 float
114: #define REAL_LEN        (int)sizeof(float)
115: #define REAL_MAX        FLT_MAX
116: #define REAL_MIN        FLT_MIN




121: /* -Dr8 as compile line arg for c compiler */
122: #ifdef  r8
123: #undef  REAL
124: #undef  REAL_LEN 
125: #undef  REAL_MAX
126: #undef  REAL_MIN
127: #define REAL            double
128: #define REAL_LEN        (int)sizeof(double)
129: #define REAL_MAX        DBL_MAX
130: #define REAL_MIN        DBL_MIN
131: #endif

133: /* ERROR has problem with intel compilers. Since these
134: macros are not used, they are commented out

136: #define   ERROR        -1
137: #define   PASS                1
138: #define   FAIL                0
139: #define   SUCCESS       1
140: #define   FAILURE       0
141: */

143: #define   UT            5               /* dump upper 1/2 */
144: #define   LT            6               /* dump lower 1/2 */
145: #define   SYMM          8               /* we assume symm and dump upper 1/2 */
146: #define   NON_SYMM      9

148: #define   ROW          10
149: #define   COL          11

151: #ifdef r8
152: #define EPS   1.0e-14
153: #else
154: #define EPS   1.0e-06
155: #endif

157: #ifdef r8
158: #define EPS2  1.0e-07
159: #else
160: #define EPS2  1.0e-03
161: #endif

163: #define MPI   1
164: #define NX    2


167: #define LOG2(x)                (REAL)log((double)x)/log(2)
168: #define SWAP(a,b)       temp=(a); (a)=(b); (b)=temp;
169: #define P_SWAP(a,b)     ptr=(a); (a)=(b); (b)=ptr;
170: #if !defined(MAX)
171: #define MAX(x,y)        ((x)>(y)) ? (x) : (y)
172: #endif
173: #if !defined(MIN)
174: #define MIN(x,y)        ((x)<(y)) ? (x) : (y)
175: #endif

177: #define MAX_FABS(x,y)   ((double)fabs(x)>(double)fabs(y)) ? ((REAL)x) : ((REAL)y)
178: #define MIN_FABS(x,y)   ((double)fabs(x)<(double)fabs(y)) ? ((REAL)x) : ((REAL)y)

180: /* specer's existence ... can be done w/MAX_ABS */
181: #define EXISTS(x,y)     ((x)==0.0) ? (y) : (x)

183: #define MULT_NEG_ONE(a) (a) *= -1;
184: #define NEG(a)          (a) |= BIT_31;
185: #define POS(a)          (a) &= INT_MAX;