The following looping function loops over all faces of a given cell. It consists of a single loop statement, followed by the action to be taken in braces.
cell_t c;
Thread *t;
face_t f;
Thread *tf;
int n;
c_face_loop(c, t, n) /* loops over all faces of a cell */
{
.
.
.
f = C_FACE(c,t,n);
tf = C_FACE_THREAD(c,t,n);
.
.
.
}
The argument n is the local face index
number. The local face index number is used in the C_FACE macro to obtain the global face number (for example, f = C_FACE(c,t,n)).
Another useful macro that is often used in c_face_loop is C_FACE_THREAD. This macro is used to
reference the associated face thread (for example, tf
= C_FACE_THREAD(c,t,n)).
Refer to Miscellaneous Macros for other macros
that are associated with c_face_loop.