def _simplex_box_connectivity(*, npoints, nelements, nvertices):
    ambient_dim = len(npoints)
    point_indices = np.arange(np.prod(npoints)).reshape(npoints)
    connectivity = np.empty((nelements, nvertices), dtype=np.uint32)
    ielement = 0
    from itertools import product
    if (ambient_dim == 1):
        raise NotImplementedError
    elif (ambient_dim == 2):
        for (i, j) in product(range((npoints[0] - 1)), repeat=ambient_dim):
            a = point_indices[((i + 0), (j + 0))]
            b = point_indices[((i + 1), (j + 0))]
            c = point_indices[((i + 0), (j + 1))]
            d = point_indices[((i + 1), (j + 1))]
            connectivity[(ielement + 0), :] = (a, b, c)
            connectivity[(ielement + 1), :] = (d, c, b)
            ielement += 2
    elif (ambient_dim == 3):
        for (i, j, k) in product(range((npoints[0] - 1)), repeat=ambient_dim):
            a000 = point_indices[(i, j, k)]
            a001 = point_indices[(i, j, (k + 1))]
            a010 = point_indices[(i, (j + 1), k)]
            a011 = point_indices[(i, (j + 1), (k + 1))]
            a100 = point_indices[((i + 1), j, k)]
            a101 = point_indices[((i + 1), j, (k + 1))]
            a110 = point_indices[((i + 1), (j + 1), k)]
            a111 = point_indices[((i + 1), (j + 1), (k + 1))]
            connectivity[(ielement + 0), :] = (a000, a100, a010, a001)
            connectivity[(ielement + 1), :] = (a101, a100, a001, a010)
            connectivity[(ielement + 2), :] = (a101, a011, a010, a001)
            connectivity[(ielement + 3), :] = (a100, a010, a101, a110)
            connectivity[(ielement + 4), :] = (a011, a010, a110, a101)
            connectivity[(ielement + 5), :] = (a011, a111, a101, a110)
            ielement += 6
    else:
        raise NotImplementedError
    assert (ielement == nelements)
    from pyvisfile.xdmf import NumpyDataArray
    return NumpyDataArray(connectivity, name='connectivity')
def _simplex_box_connectivity(*, npoints, nelements, nvertices):
    ambient_dim = len(npoints)
    point_indices = np.arange(np.prod(npoints)).reshape(npoints)
    connectivity = np.empty((nelements, nvertices), dtype=np.uint32)
    ielement = 0
    from itertools import product
    if (ambient_dim == 1):
        raise NotImplementedError
    elif (ambient_dim == 2):
        for (i, j) in product(range((npoints[0] - 1)), repeat=ambient_dim):
            a = point_indices[((i + 0), (j + 0))]
            b = point_indices[((i + 1), (j + 0))]
            c = point_indices[((i + 0), (j + 1))]
            d = point_indices[((i + 1), (j + 1))]
            connectivity[(ielement + 0), :] = (a, b, c)
            connectivity[(ielement + 1), :] = (d, c, b)
            ielement += 2
    elif (ambient_dim == 3):
        for (i, j, k) in product(range((npoints[0] - 1)), repeat=ambient_dim):
            a000 = point_indices[(i, j, k)]
            a001 = point_indices[(i, j, (k + 1))]
            a010 = point_indices[(i, (j + 1), k)]
            a011 = point_indices[(i, (j + 1), (k + 1))]
            a100 = point_indices[((i + 1), j, k)]
            a101 = point_indices[((i + 1), j, (k + 1))]
            a110 = point_indices[((i + 1), (j + 1), k)]
            a111 = point_indices[((i + 1), (j + 1), (k + 1))]
            connectivity[(ielement + 0), :] = (a000, a100, a010, a001)
            connectivity[(ielement + 1), :] = (a101, a100, a001, a010)
            connectivity[(ielement + 2), :] = (a101, a011, a010, a001)
            connectivity[(ielement + 3), :] = (a100, a010, a101, a110)
            connectivity[(ielement + 4), :] = (a011, a010, a110, a101)
            connectivity[(ielement + 5), :] = (a011, a111, a101, a110)
            ielement += 6
    else:
        raise NotImplementedError
    assert (ielement == nelements)
    from pyvisfile.xdmf import NumpyDataArray
    return NumpyDataArray(connectivity, name='connectivity')