コード例 #1
0
 def recurse(current_block, insert_list):
     other_list = blocks_a if insert_list is blocks_b else blocks_b
     for dim in range(3):
         ngb_id = blocking.getNeighborId(current_block, dim, False)
         if ngb_id != -1:
             if ngb_id not in all_blocks:
                 insert_list.append(ngb_id)
                 all_blocks.append(ngb_id)
                 recurse(ngb_id, other_list)
コード例 #2
0
 def recurse(current_block, insert_list):
     other_list = blocks_a if insert_list is blocks_b else blocks_b
     for dim in range(3):
         ngb_id = blocking.getNeighborId(current_block, dim, False)
         if ngb_id != -1:
             #  check if this block is overlapping the roi
             if ngb_id not in blocks_in_roi:
                 continue
             if ngb_id not in all_blocks:
                 insert_list.append(ngb_id)
                 all_blocks.append(ngb_id)
                 recurse(ngb_id, other_list)
コード例 #3
0
def iterate_faces(blocking, block_id, halo=[1, 1, 1], return_only_lower=True,
                  empty_blocks=None):

    ndim = len(blocking.blockShape)
    assert len(halo) == ndim, str(halo)
    directions = (False,) if return_only_lower else (False, True)
    # iterate over the axes and directions
    for axis in range(ndim):
        for direction in directions:
            # get neighbor id and check if it is valid
            ngb_id = blocking.getNeighborId(block_id, axis, direction)
            if ngb_id == -1:
                continue
            if empty_blocks is not None:
                if ngb_id in empty_blocks:
                    continue
            face, face_a, face_b = get_face(blocking, block_id, ngb_id,
                                            axis, halo)
            yield face, face_a, face_b, block_id, ngb_id