def gridIndexToSingleGridIndex(ix, iy, iz, nx, ny, nz):
    """
    Convert a grid index (3 indices) into a single grid index:

    :param ix, iy, iz:  (int) grid index in x-, y-, z-axis direction
    :param nx, ny, nz:  (int) number of grid cells in each direction

    :return: i:         (int) single grid index
                            Note: ix, iy, iz can be ndarray of same shape, then
                            i in output is ndarray of that shape
    """
    return ix + nx * (iy + ny * iz)