PLUTO  4.0
 All Data Structures Files Functions Variables Enumerations Macros Pages
al_defs.h
1 #ifndef __AL_DEFS
2 #define __AL_DEFS
3 
4 
5 /* Some definitions for more useful generalizations */
6 #define AL_Const int
7 
8 /* The datatype type */
9 #define AL_Datatype MPI_Datatype
10 
11 /* Amount of grid overlap in staggered meshes */
12 #define AL_STAGGERED_OVERLAP 1
13 
14 /*
15  AL_ALLOC_ -- AL memory allocation procedure.
16  We define it temporarily as a macro,
17  but it should really become its own
18  function at some point.
19 */
20 #define AL_ALLOC_(nelem,size) malloc((nelem)*(size))
21 #define AL_CALLOC_(nelem,size) calloc((nelem),(size))
22 
23 /*
24  AL_FREE_ -- AL memory freeing procedure.
25  We define it temporarily as a macro,
26  but it should really become its own
27  function at some point.
28 */
29 #define AL_FREE_(ptr) free((ptr))
30 
31 /*
32  AL_POWEROF2 -- Return 1 if the number is a power of 2
33  0 otherwise
34 */
35 #define AL_POWEROF2(x) ((((x)-1)&(x))==0)
36 
37 /*
38  AL_ISEVEN -- Return 1 if the number is even, 0 otherwise
39  AL_ISODD -- Return 1 if the number is odd, 0 otherwise
40 */
41 #define AL_ISEVEN ((x)-(x)/2*2)
42 #define AL_ISODD ((x)/2*2-(x)+1)
43 
44 /*
45  AL_MAX, AL_MIN -- Max and Min definitions
46  */
47 #define AL_ISMAX(a,b) ((a) > (b) ? (a) : (b))
48 #define AL_ISMIN(a,b) ((a) < (b) ? (a) : (b))
49 
50 /* End ifndef __AL_DEFS */
51 #endif