本文整理汇总了Python中amuse.community.sse.interface.SSE.cleanup_code方法的典型用法代码示例。如果您正苦于以下问题:Python SSE.cleanup_code方法的具体用法?Python SSE.cleanup_code怎么用?Python SSE.cleanup_code使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类amuse.community.sse.interface.SSE
的用法示例。
在下文中一共展示了SSE.cleanup_code方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test13
# 需要导入模块: from amuse.community.sse.interface import SSE [as 别名]
# 或者: from amuse.community.sse.interface.SSE import cleanup_code [as 别名]
def test13(self):
print "Testing SSE states"
stars = Particles(1)
stars.mass = 1.0 | units.MSun
print "First do everything manually:",
instance = SSE()
self.assertEquals(instance.get_name_of_current_state(), 'UNINITIALIZED')
instance.initialize_code()
self.assertEquals(instance.get_name_of_current_state(), 'INITIALIZED')
instance.commit_parameters()
self.assertEquals(instance.get_name_of_current_state(), 'RUN')
instance.cleanup_code()
self.assertEquals(instance.get_name_of_current_state(), 'END')
instance.stop()
print "ok"
print "initialize_code(), commit_parameters(), " \
"and cleanup_code() should be called automatically:",
instance = SSE()
self.assertEquals(instance.get_name_of_current_state(), 'UNINITIALIZED')
instance.parameters.reimers_mass_loss_coefficient = 0.5
self.assertEquals(instance.get_name_of_current_state(), 'INITIALIZED')
instance.particles.add_particles(stars)
self.assertEquals(instance.get_name_of_current_state(), 'RUN')
instance.stop()
self.assertEquals(instance.get_name_of_current_state(), 'STOPPED')
print "ok"