コード例 #1
0
def _pairwise_enumerate_2d(grid2d, row_offset=0, col_offset=0):
    for (r1_idx, r1_lst), (r2_idx, r2_lst) in pairwise(enumerate(grid2d, row_offset)):
        first_in_row = True
        for (c1_idx, (r1c1, r2c1)), (c2_idx, (r1c2, r2c2)) in pairwise(enumerate(izip(r1_lst, r2_lst), col_offset)):
            yield Quad(row1=r1_idx, row2=r2_idx, col1=c1_idx, col2=c2_idx,
                        r1c1=r1c1, r1c2=r1c2, r2c1=r2c1, r2c2=r2c2, first_in_row=first_in_row)
            first_in_row = False
コード例 #2
0
 def iter_edge_pairs(self):
     for row in self.old_edges[self.node_row_start : self.node_row_finish]:
         for e1, e2 in pairwise(row[self.node_col_start : self.node_col_finish]):
             yield e1, e2