本文整理匯總了Python中amuse.community.hermite0.interface.Hermite.synchronize_model方法的典型用法代碼示例。如果您正苦於以下問題:Python Hermite.synchronize_model方法的具體用法?Python Hermite.synchronize_model怎麽用?Python Hermite.synchronize_model使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類amuse.community.hermite0.interface.Hermite
的用法示例。
在下文中一共展示了Hermite.synchronize_model方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test13
# 需要導入模塊: from amuse.community.hermite0.interface import Hermite [as 別名]
# 或者: from amuse.community.hermite0.interface.Hermite import synchronize_model [as 別名]
def test13(self):
particles = plummer.new_plummer_model(31)
instance = Hermite(number_of_workers=1)#, debugger="xterm")
instance.initialize_code()
instance.parameters.epsilon_squared = 0.01 | nbody_system.length ** 2
instance.particles.add_particles(particles)
instance.evolve_model(0.1 | nbody_system.time)
instance.synchronize_model()
expected_positions = instance.particles.position
instance.stop()
positions_per_workers = []
for n in [2,3,4,5]:
instance = Hermite(number_of_workers=n)
instance.initialize_code()
instance.parameters.epsilon_squared = 0.01 | nbody_system.length ** 2
instance.particles.add_particles(particles)
instance.evolve_model(0.1 | nbody_system.time)
instance.synchronize_model()
positions_per_workers.append(instance.particles.position)
instance.stop()
for index, n in enumerate([2,3,4,5]):
self.assertAlmostEqual(expected_positions, positions_per_workers[index], 15)