本文整理汇总了Python中amuse.community.huayno.interface.Huayno.get_state方法的典型用法代码示例。如果您正苦于以下问题:Python Huayno.get_state方法的具体用法?Python Huayno.get_state怎么用?Python Huayno.get_state使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类amuse.community.huayno.interface.Huayno
的用法示例。
在下文中一共展示了Huayno.get_state方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test5
# 需要导入模块: from amuse.community.huayno.interface import Huayno [as 别名]
# 或者: from amuse.community.huayno.interface.Huayno import get_state [as 别名]
def test5(self):
convert_nbody = nbody_system.nbody_to_si(5.0 | units.kg, 10.0 | units.m)
instance = Huayno(convert_nbody)
instance.initialize_code()
particles = datamodel.Particles(2)
self.assertEquals(len(instance.particles), 0)
particles.mass = [15.0, 30.0] | units.kg
particles.radius = [10.0, 20.0] | units.m
particles.position = [[10.0, 20.0, 30.0], [20.0, 40.0, 60.0]] | units.m
particles.velocity = [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]] | units.m / units.s
instance.particles.add_particles(particles)
self.assertEquals(len(instance.particles), 2)
instance.set_state(1, 16|units.kg, 20.0|units.m, 40.0|units.m, 60.0|units.m,
1.0|units.ms, 1.0|units.ms, 1.0|units.ms)
curr_state = instance.get_state(1)
for expected, actural in zip((16|units.kg, 20.0|units.m, 40.0|units.m, 60.0|units.m,
1.0|units.ms, 1.0|units.ms, 1.0|units.ms, 0 | units.m), curr_state):
self.assertAlmostRelativeEquals(actural,expected)
instance.set_state(1, 16|units.kg, 20.0|units.m, 40.0|units.m, 60.0|units.m,
1.0|units.ms, 1.0|units.ms, 1.0|units.ms , 20.0|units.m)
curr_state = instance.get_state(1)
for expected, actural in zip((16|units.kg, 20.0|units.m, 40.0|units.m, 60.0|units.m,
1.0|units.ms, 1.0|units.ms, 1.0|units.ms, 20 | units.m), curr_state):
self.assertAlmostRelativeEquals(actural,expected)