本文整理汇总了Python中amuse.community.huayno.interface.Huayno.synchronize_model方法的典型用法代码示例。如果您正苦于以下问题:Python Huayno.synchronize_model方法的具体用法?Python Huayno.synchronize_model怎么用?Python Huayno.synchronize_model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类amuse.community.huayno.interface.Huayno
的用法示例。
在下文中一共展示了Huayno.synchronize_model方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test13
# 需要导入模块: from amuse.community.huayno.interface import Huayno [as 别名]
# 或者: from amuse.community.huayno.interface.Huayno import synchronize_model [as 别名]
def test13(self):
particles = plummer.new_plummer_model(31)
instance = Huayno(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()
示例2: test15
# 需要导入模块: from amuse.community.huayno.interface import Huayno [as 别名]
# 或者: from amuse.community.huayno.interface.Huayno import synchronize_model [as 别名]
def test15(self):
particles = plummer.new_plummer_model(512)
expected_positions = None
for mode in ["cpu", "openmp", "opencl"]:
try:
instance = Huayno(mode=mode, number_of_workers=1)#, debugger="xterm")
except:
print "Running huayno with mode=", mode, " was unsuccessful."
continue
else:
print "Running huayno with mode=", mode, "... "
instance.initialize_code()
instance.parameters.epsilon_squared = 0.01 | nbody_system.length ** 2
instance.particles.add_particles(particles)
instance.evolve_model(0.2 | nbody_system.time)
instance.synchronize_model()
if expected_positions is None:
expected_positions = instance.particles.position
else:
self.assertAlmostRelativeEquals(expected_positions, instance.particles.position, 8)
instance.stop()