Actual source code: const.h

  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
 90: #define INT_TYPE        MPI_INT


 93: #if defined(tmpr8)
 94: #define REAL_TYPE        MPI_DOUBLE
 95: #else 
 96: #define REAL_TYPE        MPI_FLOAT
 97: #endif

 99: #define DATA_TYPE        MPI_Datatype



103: #define REAL                 float
104: #define REAL_LEN        (int)sizeof(float)
105: #define REAL_MAX        FLT_MAX
106: #define REAL_MIN        FLT_MIN




111: /* -Dtmpr8 as compile line arg for c compiler */
112: #ifdef  tmpr8
113: #undef  REAL
114: #undef  REAL_LEN 
115: #undef  REAL_MAX
116: #undef  REAL_MIN
117: #define REAL            double
118: #define REAL_LEN        (int)sizeof(double)
119: #define REAL_MAX        DBL_MAX
120: #define REAL_MIN        DBL_MIN
121: #endif

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

126: #define   ERROR        -1
127: #define   PASS                1
128: #define   FAIL                0
129: #define   SUCCESS       1
130: #define   FAILURE       0
131: */

133: #define   UT            5               /* dump upper 1/2 */
134: #define   LT            6               /* dump lower 1/2 */
135: #define   SYMM          8               /* we assume symm and dump upper 1/2 */
136: #define   NON_SYMM      9

138: #define   ROW          10
139: #define   COL          11

141: #ifdef tmpr8
142: #define EPS   1.0e-14
143: #else
144: #define EPS   1.0e-06
145: #endif

147: #ifdef tmpr8
148: #define EPS2  1.0e-07
149: #else
150: #define EPS2  1.0e-03
151: #endif

153: #define MPI   1
154: #define NX    2


157: #define LOG2(x)                (REAL)log((double)x)/log(2)
158: #define SWAP(a,b)       temp=(a); (a)=(b); (b)=temp;
159: #define P_SWAP(a,b)     ptr=(a); (a)=(b); (b)=ptr;

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

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

167: #define MULT_NEG_ONE(a) (a) *= -1;
168: #define NEG(a)          (a) |= BIT_31;
169: #define POS(a)          (a) &= INT_MAX;