@classmethod
def subnodes(cls, nsubdiv):
    lcon = []
    qcon = [QuadShapeSubDiv.subnodes((n + 1)).reshape((- 1), 4) for n in range(nsubdiv)]

    def _row_in_quad(n, a=0, b=0):
        return np.array([(((n * i) + j), (((n * i) + j) + 1)) for i in range(a, (n + b)) for j in range((n - 1))])

    def _col_in_quad(n, a=0, b=0):
        return np.array([(((n * i) + j), ((n * (i + 1)) + j)) for i in range((n - 1)) for j in range(a, (n + b))])
    u = 0
    for n in range(nsubdiv, 0, (- 1)):
        l = u
        u += ((n + 1) ** 2)
        lower_quad = (qcon[(n - 1)] + l)
        upper_pts = (np.arange((n ** 2)) + u)
        lcon.append([lower_quad, upper_pts])
        if (n > 1):
            upper_quad = (qcon[(n - 2)] + u)
            lower_pts = (np.hstack((range(((k * (n + 1)) + 1), (((k + 1) * n) + k)) for k in range(1, n))) + l)
            lcon.append([upper_quad[:, ::(- 1)], lower_pts])
            lower_row = (_row_in_quad((n + 1), 1, (- 1)) + l)
            lower_col = (_col_in_quad((n + 1), 1, (- 1)) + l)
            upper_row = (_row_in_quad(n) + u)
            upper_col = (_col_in_quad(n) + u)
            lcon.append([lower_col, upper_row])
            lcon.append([lower_row[:, ::(- 1)], upper_col])
    return np.hstack((np.column_stack(l).flat for l in lcon))
@classmethod
def subnodes(cls, nsubdiv):
    lcon = []
    qcon = [QuadShapeSubDiv.subnodes((n + 1)).reshape((- 1), 4) for n in range(nsubdiv)]

    def _row_in_quad(n, a=0, b=0):
        return np.array([(((n * i) + j), (((n * i) + j) + 1)) for i in range(a, (n + b)) for j in range((n - 1))])

    def _col_in_quad(n, a=0, b=0):
        return np.array([(((n * i) + j), ((n * (i + 1)) + j)) for i in range((n - 1)) for j in range(a, (n + b))])
    u = 0
    for n in range(nsubdiv, 0, (- 1)):
        l = u
        u += ((n + 1) ** 2)
        lower_quad = (qcon[(n - 1)] + l)
        upper_pts = (np.arange((n ** 2)) + u)
        lcon.append([lower_quad, upper_pts])
        if (n > 1):
            upper_quad = (qcon[(n - 2)] + u)
            lower_pts = (np.hstack((range(((k * (n + 1)) + 1), (((k + 1) * n) + k)) for k in range(1, n))) + l)
            lcon.append([upper_quad[:, ::(- 1)], lower_pts])
            lower_row = (_row_in_quad((n + 1), 1, (- 1)) + l)
            lower_col = (_col_in_quad((n + 1), 1, (- 1)) + l)
            upper_row = (_row_in_quad(n) + u)
            upper_col = (_col_in_quad(n) + u)
            lcon.append([lower_col, upper_row])
            lcon.append([lower_row[:, ::(- 1)], upper_col])
    return np.hstack((np.column_stack(l).flat for l in lcon))