def _current_sc_dir(sc_dir, grid):
    """Return current direction(s) for semicoarsening.

    Semicoarsening is defined in `self.sc_dir`. Here `self.sc_dir` is checked
    with which directions can actually still be halved, and depending on that,
    an adjusted `sc_dir` is returned for this particular grid.


    Parameters
    ----------
    grid : :class:`emg3d.meshes.TensorMesh`
        Input grid.

    sc_dir : int
        Direction of semicoarsening.

    Returns
    -------
    c_sc_dir : int
        Current direction of semicoarsening.

    """
    xsc_dir = grid.nCx % 2 != 0 or grid.nCx < 3 or sc_dir == 1
    ysc_dir = grid.nCy % 2 != 0 or grid.nCy < 3 or sc_dir == 2
    zsc_dir = grid.nCz % 2 != 0 or grid.nCz < 3 or sc_dir == 3
    if xsc_dir:
        if ysc_dir:
            c_sc_dir = 6
        elif zsc_dir:
            c_sc_dir = 5
        else:
            c_sc_dir = 1
    elif ysc_dir:
        if zsc_dir:
            c_sc_dir = 4
        else:
            c_sc_dir = 2
    elif zsc_dir:
        c_sc_dir = 3
    else:
        c_sc_dir = 0
    return c_sc_dir
