From d8bbc82d3a180df724218dace43c255959dcbfad Mon Sep 17 00:00:00 2001 From: march3 Date: Fri, 14 Jul 2023 11:14:27 +0800 Subject: [PATCH] =?UTF-8?q?Python=E8=B6=85=E4=BA=BA-=E5=AE=87=E5=AE=99?= =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/system.py | 4 ++-- sim_scenes/science/jupiter_moon_protects_earth.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/system.py b/common/system.py index 6fdf273..48c0242 100644 --- a/common/system.py +++ b/common/system.py @@ -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: diff --git a/sim_scenes/science/jupiter_moon_protects_earth.py b/sim_scenes/science/jupiter_moon_protects_earth.py index 327eb11..eaeaf15 100644 --- a/sim_scenes/science/jupiter_moon_protects_earth.py +++ b/sim_scenes/science/jupiter_moon_protects_earth.py @@ -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) -- GitLab