PLUTO
al_defs.h
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
2 /*!
3  \file
4  \brief ArrayLib function definitions header file.
5 
6  Contains function definitions used in ArrayLib routines.
7 
8  \author A. Malagoli (University of Chicago)
9  \author G. Muscianisi (g.muscianisi@cineca.it)
10 
11  \date Aug 29, 2012
12 */
13 /* ///////////////////////////////////////////////////////////////////// */
14 #ifndef __AL_DEFS
15 #define __AL_DEFS
16 
17 
18 /* Some definitions for more useful generalizations */
19 #define AL_Const int
20 
21 /* The datatype type */
22 #define AL_Datatype MPI_Datatype
23 
24 /* Amount of grid overlap in staggered meshes */
25 #define AL_STAGGERED_OVERLAP 1
26 
27 /*
28  AL_ALLOC_ -- AL memory allocation procedure.
29  We define it temporarily as a macro,
30  but it should really become its own
31  function at some point.
32 */
33 #define AL_ALLOC_(nelem,size) malloc((nelem)*(size))
34 #define AL_CALLOC_(nelem,size) calloc((nelem),(size))
35 
36 /*
37  AL_FREE_ -- AL memory freeing procedure.
38  We define it temporarily as a macro,
39  but it should really become its own
40  function at some point.
41 */
42 #define AL_FREE_(ptr) free((ptr))
43 
44 /*
45  AL_POWEROF2 -- Return 1 if the number is a power of 2
46  0 otherwise
47 */
48 #define AL_POWEROF2(x) ((((x)-1)&(x))==0)
49 
50 /*
51  AL_ISEVEN -- Return 1 if the number is even, 0 otherwise
52  AL_ISODD -- Return 1 if the number is odd, 0 otherwise
53 */
54 #define AL_ISEVEN ((x)-(x)/2*2)
55 #define AL_ISODD ((x)/2*2-(x)+1)
56 
57 /*
58  AL_MAX, AL_MIN -- Max and Min definitions
59  */
60 #define AL_ISMAX(a,b) ((a) > (b) ? (a) : (b))
61 #define AL_ISMIN(a,b) ((a) < (b) ? (a) : (b))
62 
63 /* End ifndef __AL_DEFS */
64 #endif