Example #1
0
def get_points(obj):
    if not hasattr(obj, "GetPoints"):
        obj = read_ugrid(obj)

    p = obj.GetPoints()
    points = (p.GetPoint(i) for i in range(0, p.GetNumberOfPoints()))

    return points
Example #2
0
def get_connectivity(obj):
    ""
    if not hasattr(obj, "GetPoints"):
        obj = read_ugrid(obj)

    connections = list()

    ids = vtk.vtkIdList()
    for i in range(obj.GetNumberOfCells()):
        obj.GetCellPoints(i, ids)
        connections.append(tuple(
            (ids.GetId(j) for j in range(0, ids.GetNumberOfIds()))
        ))
    return connections