00001
00005 #ifndef __SUPERLU_UTIL
00006 #define __SUPERLU_UTIL
00007
00008 #include <stdio.h>
00009 #include <stdlib.h>
00010 #include <string.h>
00011 #include <assert.h>
00012
00013
00014
00015
00016 #ifndef USER_ABORT
00017 #define USER_ABORT(msg) superlu_abort_and_exit_dist(msg)
00018 #endif
00019
00020 #define ABORT(err_msg) \
00021 { char msg[256];\
00022 sprintf(msg,"%s at line %d in file %s\n",err_msg,__LINE__, __FILE__);\
00023 USER_ABORT(msg); }
00024
00025
00026 #ifndef USER_MALLOC
00027 #define USER_MALLOC(size) superlu_malloc_dist(size)
00028 #endif
00029
00030 #define SUPERLU_MALLOC(size) USER_MALLOC(size)
00031
00032 #ifndef USER_FREE
00033 #define USER_FREE(addr) superlu_free_dist(addr)
00034 #endif
00035
00036 #define SUPERLU_FREE(addr) USER_FREE(addr)
00037
00038 #define CHECK_MALLOC(pnum, where) { \
00039 extern long int superlu_malloc_total; \
00040 printf("(%d) %s: superlu_malloc_total (KBytes) %.3f\n", \
00041 pnum, where, superlu_malloc_total*1e-3); \
00042 }
00043
00044 #define SUPERLU_MAX(x, y) ( (x) > (y) ? (x) : (y) )
00045 #define SUPERLU_MIN(x, y) ( (x) < (y) ? (x) : (y) )
00046
00047
00048
00049
00050 #define EMPTY (-1)
00051 #ifndef FALSE
00052 #define FALSE (0)
00053 #endif
00054 #ifndef TRUE
00055 #define TRUE (1)
00056 #endif
00057
00058
00059
00060
00061 typedef float flops_t;
00062 typedef unsigned char Logical;
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 typedef enum {
00077 COLPERM,
00078 ROWPERM,
00079 RELAX,
00080 ETREE,
00081 EQUIL,
00082 SYMBFAC,
00083 DIST,
00084 FACT,
00085 COMM,
00086 SOL_COMM,
00087 RCOND,
00088 SOLVE,
00089 REFINE,
00090 FLOAT,
00091 TRSV,
00092 GEMV,
00093 FERR,
00094 NPHASES
00095 } PhaseType;
00096
00097 typedef struct {
00098 int *panel_histo;
00099 double *utime;
00100 flops_t *ops;
00101 int TinyPivots;
00102 int RefineSteps;
00103 } SuperLUStat_t;
00104
00105
00106 typedef struct e_node {
00107 int size;
00108 void *mem;
00109 } ExpHeader;
00110
00111 typedef struct {
00112 int size;
00113 int used;
00114 int top1;
00115 int top2;
00116 void *array;
00117 } LU_stack_t;
00118
00119
00120 #define GluIntArray(n) (5 * (n) + 5)
00121 #define NO_MEMTYPE 4
00122
00123
00124
00125
00126
00127 #define StackFull(x) ( x + stack.used >= stack.size )
00128 #define NotDoubleAlign(addr) ( (long)addr & 7 )
00129 #define DoubleAlign(addr) ( ((long)addr + 7) & ~7L )
00130 #define TempSpace(n, w) ( (2*w + 4 + NO_MARKER)*m*sizeof(int) + \
00131 (w + 1)*n*sizeof(double) )
00132 #define Reduce(alpha) ((alpha + 1) / 2)
00133
00134 #define FIRSTCOL_OF_SNODE(i) (xsup[i])
00135
00136 #if ( PROFlevel>=1 )
00137 #define TIC(t) t = SuperLU_timer_()
00138 #define TOC(t2, t1) t2 = SuperLU_timer_() - t1
00139 #else
00140 #define TIC(t)
00141 #define TOC(t2, t1)
00142 #endif
00143
00144
00145
00146
00147 #define L_SUB_START(col) ( Lstore->rowind_colptr[col] )
00148 #define L_SUB(ptr) ( Lstore->rowind[ptr] )
00149 #define L_NZ_START(col) ( Lstore->nzval_colptr[col] )
00150 #define L_FST_SUPC(superno) ( Lstore->sup_to_col[superno] )
00151 #define U_NZ_START(col) ( Ustore->colptr[col] )
00152 #define U_SUB(ptr) ( Ustore->rowind[ptr] )
00153
00154 #endif