提交 d8bbc82d 编写于 作者: 三月三net's avatar 三月三net

Python超人-宇宙模拟器

上级 9bb46532
......@@ -177,7 +177,7 @@ class System(object):
forces = G * disps * mass_matrix / np.expand_dims(dists, 2) ** 3
return forces.sum(axis=1) / masses.reshape(-1, 1)
def calc_bodies_acceleration(self):
def calc_bodies_acceleration_bak(self):
"""
计算加速度(使用矩阵的方式,性能提高很多)
@return:
......@@ -194,7 +194,7 @@ class System(object):
for idx, body in enumerate(valid_bodies):
body.acceleration = accelerations[idx]/1000
def calc_bodies_acceleration_bak(self):
def calc_bodies_acceleration(self):
"""
计算加速度(性能非常低,代码保留)
@return:
......
......@@ -204,7 +204,7 @@ if __name__ == '__main__':
# 设置计时器的最小时间单位为年
BodyTimer().min_unit = BodyTimer.MIN_UNIT_YEARS
sim = JupiterProtectsEarthSim(comet_num=30)
sim = JupiterProtectsEarthSim(comet_num=20)
# 运行前会触发 on_ready
UrsinaEvent.on_ready_subscription(sim.on_ready)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册