PLUTO
4.4-patch2
|
PLUTO header file for function-like macros. More...
Go to the source code of this file.
Macros | |
#define | BOX_LOOP(B, k, j, i) |
#define | FOR_EACH(nv, list) |
#define | INT_FLOOR(z) ((int)((z) + 32768.) - 32768) |
#define | MAX(a, b) ( (a) >= (b) ? (a) : (b) ) |
#define | MIN(a, b) ( (a) <= (b) ? (a) : (b) ) |
#define | ABS_MIN(a, b) (fabs(a) < fabs(b) ? (a):(b)) |
#define | DSIGN(x) ( (x) >= 0.0 ? (1.0) : (-1.0)) |
#define | MINMOD_LIMITER(a, b) ((a)*(b) > 0.0 ? (fabs(a) < fabs(b) ? (a):(b)):0.0) |
#define | QUIT_PLUTO(e_code) |
#define | DIM_EXPAND(a, b, c) a b c |
#define | DIM_SELECT(a, b, c) c |
Spatial loop macros. | |
The following macros provide a compact way to perform 1D or multi-D loops in selected regions of the (local) computational domain. The | |
#define | IBEG_LOOP(i) for ((i) = IBEG; (i)--; ) |
#define | JBEG_LOOP(j) for ((j) = JBEG; (j)--; ) |
#define | KBEG_LOOP(k) for ((k) = KBEG; (k)--; ) |
#define | IEND_LOOP(i) for ((i) = IEND + 1; (i) < NX1_TOT; (i)++) |
#define | JEND_LOOP(j) for ((j) = JEND + 1; (j) < NX2_TOT; (j)++) |
#define | KEND_LOOP(k) for ((k) = KEND + 1; (k) < NX3_TOT; (k)++) |
#define | IDOM_LOOP(i) for ((i) = IBEG; (i) <= IEND; (i)++) |
#define | JDOM_LOOP(j) for ((j) = JBEG; (j) <= JEND; (j)++) |
#define | KDOM_LOOP(k) for ((k) = KBEG; (k) <= KEND; (k)++) |
#define | ITOT_LOOP(i) for ((i) = 0; (i) < NX1_TOT; (i)++) |
#define | JTOT_LOOP(j) for ((j) = 0; (j) < NX2_TOT; (j)++) |
#define | KTOT_LOOP(k) for ((k) = 0; (k) < NX3_TOT; (k)++) |
#define | DOM_LOOP(k, j, i) KDOM_LOOP(k) JDOM_LOOP(j) IDOM_LOOP(i) |
#define | TOT_LOOP(k, j, i) KTOT_LOOP(k) JTOT_LOOP(j) ITOT_LOOP(i) |
#define | X1_BEG_LOOP(k, j, i) KTOT_LOOP(k) JTOT_LOOP(j) IBEG_LOOP(i) |
#define | X2_BEG_LOOP(k, j, i) KTOT_LOOP(k) JBEG_LOOP(j) ITOT_LOOP(i) |
#define | X3_BEG_LOOP(k, j, i) KBEG_LOOP(k) JTOT_LOOP(j) ITOT_LOOP(i) |
#define | X1_END_LOOP(k, j, i) KTOT_LOOP(k) JTOT_LOOP(j) IEND_LOOP(i) |
#define | X2_END_LOOP(k, j, i) KTOT_LOOP(k) JEND_LOOP(j) ITOT_LOOP(i) |
#define | X3_END_LOOP(k, j, i) KEND_LOOP(k) JTOT_LOOP(j) ITOT_LOOP(i) |
Forward and central finite differences macros. | |
The following set of macros provide a compact way to perform two-point, undivided finite difference operations in a specified direction. Differences can be either | |
#define | FDIFF_X1(Q, k, j, i) (0.0) |
#define | CDIFF_X1(Q, k, j, i) (0.0) |
#define | FDIFF_X2(Q, k, j, i) (0.0) |
#define | CDIFF_X2(Q, k, j, i) (0.0) |
#define | FDIFF_X3(Q, k, j, i) (0.0) |
#define | CDIFF_X3(Q, k, j, i) (0.0) |
Spatial averages macros. | |
The following set of macros provide a compact way to perform multi-D averages from cell centered values to interfaces. For instance, AVERAGE_X(q,k,j,i) will simply take the arithmetic average betwen q(i) and q(i+1) at the i+1/2 interface. Likewise, AVERAGE_YZ(q,k,j,i) will produce an average at the j+1/2 and k+1/2 edge. | |
#define | AVERAGE_X(q, k, j, i) (q[k][j][i]) |
#define | AVERAGE_Y(q, k, j, i) (q[k][0][i]) |
#define | AVERAGE_XY(q, k, j, i) AVERAGE_X(q,k,0,i) |
#define | AVERAGE_Z(q, k, j, i) (q[0][j][i]) |
#define | AVERAGE_XZ(q, k, j, i) AVERAGE_X(q,0,j,i) |
#define | AVERAGE_YZ(q, k, j, i) AVERAGE_Y(q,0,j,i) |
#define | AVERAGE_XYZ(q, k, j, i) AVERAGE_XY(q,0,j,i) |
#define ABS_MIN | ( | a, | |
b | |||
) | (fabs(a) < fabs(b) ? (a):(b)) |
Return the number with the smaller absolute value.
#define BOX_LOOP | ( | B, | |
k, | |||
j, | |||
i | |||
) |
The BOX_LOOP() macro implements a loop over (i,j,k) in a rectangular portion of the domain with indices defined by the (pointer to) RBox structure B. The loop increments (di,dj,dk) are members of the structure which are here initialized to either 1 or -1 depending on whether the lower corner index lies below or above the upper index (e.g. B->ib <= B->ie or not).
#define DIM_EXPAND | ( | a, | |
b, | |||
c | |||
) | a b c |
Allows to write dimension-ndependent expressions involving vectors by evaluating as many arguments as the number of DIMENSIONS. The result is that only the first argument will be compiled in 1D, the first two arguments in 2D and all of them in 3D. As an example:
becomes
when DIMENSIONS
is equal to 1 or
when DIMENSIONS
is equal to 2 or
when DIMENSIONS
is equal to 3.
#define DIM_SELECT | ( | a, | |
b, | |||
c | |||
) | c |
Expand only the 1st, 2nd or 3rd argument based on the value of DIMENSIONS.
#define DSIGN | ( | x | ) | ( (x) >= 0.0 ? (1.0) : (-1.0)) |
Return the sign of x.
#define FOR_EACH | ( | nv, | |
list | |||
) |
The FOR_EACH(p, intList) macro implements a loop over the elements of the array intList->indx
(in a similar way to Python lists).
Example:
#define INT_FLOOR | ( | z | ) | ((int)((z) + 32768.) - 32768) |
Faster implementation than stdlib floor() function. It returns the largest integer value less than or equal to z.
#define MAX | ( | a, | |
b | |||
) | ( (a) >= (b) ? (a) : (b) ) |
Return the maximum between two numbers.
#define MIN | ( | a, | |
b | |||
) | ( (a) <= (b) ? (a) : (b) ) |
Return the minimum between two numbers.
#define MINMOD_LIMITER | ( | a, | |
b | |||
) | ((a)*(b) > 0.0 ? (fabs(a) < fabs(b) ? (a):(b)):0.0) |
Quick limiting macros (more general ones are found in States/plm_coeffs.h)