SU2
Macros
gk_macros.h File Reference

This file contains various macros. More...

Go to the source code of this file.

Macros

#define gk_max(a, b)   ((a) >= (b) ? (a) : (b))
 
#define gk_min(a, b)   ((a) >= (b) ? (b) : (a))
 
#define gk_max3(a, b, c)   ((a) >= (b) && (a) >= (c) ? (a) : ((b) >= (a) && (b) >= (c) ? (b) : (c)))
 
#define gk_SWAP(a, b, tmp)   do {(tmp) = (a); (a) = (b); (b) = (tmp);} while(0)
 
#define INC_DEC(a, b, val)   do {(a) += (val); (b) -= (val);} while(0)
 
#define sign(a, b)   ((a >= 0 ? b : -b))
 
#define ONEOVERRANDMAX   (1.0/(RAND_MAX+1.0))
 
#define RandomInRange(u)   ((int) (ONEOVERRANDMAX*(u)*rand()))
 
#define gk_abs(x)   ((x) >= 0 ? (x) : -(x))
 
#define gk_clearcputimer(tmr)   (tmr = 0.0)
 
#define gk_startcputimer(tmr)   (tmr -= gk_CPUSeconds())
 
#define gk_stopcputimer(tmr)   (tmr += gk_CPUSeconds())
 
#define gk_getcputimer(tmr)   (tmr)
 
#define gk_clearwctimer(tmr)   (tmr = 0.0)
 
#define gk_startwctimer(tmr)   (tmr -= gk_WClockSeconds())
 
#define gk_stopwctimer(tmr)   (tmr += gk_WClockSeconds())
 
#define gk_getwctimer(tmr)   (tmr)
 
#define IFSET(a, flag, cmd)   if ((a)&(flag)) (cmd);
 
#define GKSETJMP()   (setjmp(gk_return_to_entry))
 
#define gk_sigcatch()   (setjmp(gk_jbufs[gk_cur_jbufs]))
 
#define MALLOC_CHECK(ptr)   ;
 
#define MAKECSR(i, n, a)
 
#define SHIFTCSR(i, n, a)
 
#define GKASSERT(expr)
 
#define GKASSERTP(expr, msg)
 
#define GKCUASSERT(expr)
 
#define GKCUASSERTP(expr, msg)
 
#define ASSERT(expr)
 
#define ASSERTP(expr, msg)
 
#define ASSERT2   ASSERT
 
#define ASSERTP2   ASSERTP
 

Detailed Description

This file contains various macros.

Date
Started 3/27/2007
Author
George
Version
$Id: gk_macros.h 10711 2011-08-31 22:23:04Z karypis $ 

Macro Definition Documentation

§ ASSERT

#define ASSERT (   expr)
Value:
if (!(expr)) { \
printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
__LINE__, __FILE__); \
assert(expr); \
}

§ ASSERTP

#define ASSERTP (   expr,
  msg 
)
Value:
if (!(expr)) { \
printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
__LINE__, __FILE__); \
printf msg ; \
printf("\n"); \
assert(expr); \
}

§ GKASSERT

#define GKASSERT (   expr)
Value:
if (!(expr)) { \
printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
__LINE__, __FILE__); \
abort(); \
}

§ GKASSERTP

#define GKASSERTP (   expr,
  msg 
)
Value:
if (!(expr)) { \
printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
__LINE__, __FILE__); \
printf msg ; \
printf("\n"); \
abort(); \
}

§ GKCUASSERT

#define GKCUASSERT (   expr)
Value:
if (!(expr)) { \
printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
__LINE__, __FILE__); \
}

§ GKCUASSERTP

#define GKCUASSERTP (   expr,
  msg 
)
Value:
if (!(expr)) { \
printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
__LINE__, __FILE__); \
printf msg ; \
printf("\n"); \
}

§ MAKECSR

#define MAKECSR (   i,
  n,
 
)
Value:
do { \
for (i=1; i<n; i++) a[i] += a[i-1]; \
for (i=n; i>0; i--) a[i] = a[i-1]; \
a[0] = 0; \
} while(0)

§ SHIFTCSR

#define SHIFTCSR (   i,
  n,
 
)
Value:
do { \
for (i=n; i>0; i--) a[i] = a[i-1]; \
a[0] = 0; \
} while(0)