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