本文整理汇总了Python中Matrix.Matrix.filter_local_lichens方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.filter_local_lichens方法的具体用法?Python Matrix.filter_local_lichens怎么用?Python Matrix.filter_local_lichens使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix.Matrix
的用法示例。
在下文中一共展示了Matrix.filter_local_lichens方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: int
# 需要导入模块: from Matrix import Matrix [as 别名]
# 或者: from Matrix.Matrix import filter_local_lichens [as 别名]
rows = int(problem_size / comm_size)
mapper = Mapper(problem_size, comm_rank, rows)
matrix = Matrix(problem_size, comm_rank, rows, mapper)
initial_rank = int(comm_size / 2)
if comm_rank == initial_rank:
target_x = int(problem_size / 2)
target_y = int(problem_size / 2)
initial_bacteria = Lichen(target_x, target_y, chance=1)
matrix.update_matrix([initial_bacteria])
alg_start = MPI.Wtime()
for i in range(0, iterations):
comm.Barrier()
if history:
print_iterations(i)
lichens_created = matrix.create_lichens()
local_lichens, remote_lichens = matrix.filter_local_lichens(lichens_created)
matrix.update_matrix(local_lichens)
send_lichen(comm_size, comm_rank, remote_lichens, matrix.col_up, matrix.col_down)
received_lichens = get_lichen(comm_size, comm_rank)
matrix.update_matrix(received_lichens)
matrix.update_cells_state()
comm.Barrier()
alg_end = MPI.Wtime()
alg_time = alg_end - alg_start
print("Execution time: " + str(alg_time))