本文整理汇总了Python中amuse.community.interface.common.CommonCode.define_methods方法的典型用法代码示例。如果您正苦于以下问题:Python CommonCode.define_methods方法的具体用法?Python CommonCode.define_methods怎么用?Python CommonCode.define_methods使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类amuse.community.interface.common.CommonCode
的用法示例。
在下文中一共展示了CommonCode.define_methods方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: define_methods
# 需要导入模块: from amuse.community.interface.common import CommonCode [as 别名]
# 或者: from amuse.community.interface.common.CommonCode import define_methods [as 别名]
def define_methods(self, object):
CommonCode.define_methods(self, object)
object.add_method("generate_particles", (), (object.ERROR_CODE,))
object.add_method("get_number_of_particles_updated", (), (object.NO_UNIT,object.NO_UNIT, object.ERROR_CODE,))
object.add_method("get_mass", (object.INDEX,),
(nbody_system.mass, object.ERROR_CODE)
)
object.add_method("get_position", (object.INDEX,),
(nbody_system.length, nbody_system.length, nbody_system.length, object.ERROR_CODE)
)
object.add_method("get_velocity", (object.INDEX,),
(nbody_system.speed, nbody_system.speed, nbody_system.speed, object.ERROR_CODE)
)
object.add_method("get_output_path", (), (object.NO_UNIT, object.ERROR_CODE,))
object.add_method("set_output_path", (object.NO_UNIT,), (object.ERROR_CODE,))
for par in parameters:
if hasattr(parameters[par]["default"],"unit"):
unit=parameters[par]["default"].unit
else:
unit=object.NO_UNIT
object.add_method("get_"+par, (), (unit, object.ERROR_CODE,))
object.add_method("set_"+par, (unit, ), (object.ERROR_CODE,))
示例2: define_methods
# 需要导入模块: from amuse.community.interface.common import CommonCode [as 别名]
# 或者: from amuse.community.interface.common.CommonCode import define_methods [as 别名]
def define_methods(self, object):
CommonCode.define_methods(self, object)
object.add_method(
"new_particle",
(units.MSun,),
(object.INDEX, object.ERROR_CODE,)
)
object.add_method(
"delete_particle",
(object.INDEX,),
(object.ERROR_CODE,)
)
object.add_method(
"read_usm",
(object.NO_UNIT,),
(object.INDEX, object.ERROR_CODE,)
)
object.add_method(
"add_shell",
(object.INDEX, units.MSun, units.MSun, units.RSun, units.g / units.cm**3, units.barye,
units.K, units.LSun, units.amu, object.NO_UNIT, object.NO_UNIT, object.NO_UNIT, object.NO_UNIT,
object.NO_UNIT, object.NO_UNIT, object.NO_UNIT, object.NO_UNIT, object.NO_UNIT),
(object.ERROR_CODE,)
)
object.add_method(
"get_stellar_model_element",
(object.INDEX, object.INDEX,),
(units.MSun, units.MSun, units.RSun, units.g / units.cm**3, units.barye,
object.NO_UNIT, units.K, units.LSun, units.amu,
object.NO_UNIT, object.NO_UNIT, object.NO_UNIT, object.NO_UNIT, object.NO_UNIT,
object.NO_UNIT, object.NO_UNIT, object.NO_UNIT, object.NO_UNIT, object.ERROR_CODE,)
)
object.add_method(
"get_number_of_zones",
(object.INDEX, ),
(object.NO_UNIT, object.ERROR_CODE,)
)
object.add_method(
"get_number_of_particles",
(),
(object.NO_UNIT, object.ERROR_CODE,)
)
object.add_method(
"merge_two_stars",
(object.INDEX, object.INDEX,),
(object.INDEX, object.ERROR_CODE,)
)
object.add_method("get_target_n_shells_mixing", (), (object.NO_UNIT, object.ERROR_CODE,))
object.add_method("set_target_n_shells_mixing", (object.NO_UNIT, ), (object.ERROR_CODE,))
object.add_method("get_target_n_shells", (), (object.NO_UNIT, object.ERROR_CODE,))
object.add_method("set_target_n_shells", (object.NO_UNIT, ), (object.ERROR_CODE,))
object.add_method("get_number_of_particles", (), (object.NO_UNIT, object.ERROR_CODE,))
示例3: define_methods
# 需要导入模块: from amuse.community.interface.common import CommonCode [as 别名]
# 或者: from amuse.community.interface.common.CommonCode import define_methods [as 别名]
def define_methods(self, object):
CommonCode.define_methods(self, object)
object.add_method("new_particle", [nbody_system.mass] + [nbody_system.length]*3,
(object.INDEX, object.ERROR_CODE))
object.add_method(
"get_eps2",
(),
(nbody_system.length * nbody_system.length, object.ERROR_CODE,)
)
object.add_method(
"set_eps2",
(nbody_system.length * nbody_system.length, ),
(object.ERROR_CODE,)
)
示例4: define_methods
# 需要导入模块: from amuse.community.interface.common import CommonCode [as 别名]
# 或者: from amuse.community.interface.common.CommonCode import define_methods [as 别名]
def define_methods(self, object):
CommonCode.define_methods(self, object)
object.add_method("generate_particles", (), (object.ERROR_CODE,))
object.add_method("get_number_of_particles_updated", (), (object.NO_UNIT, object.ERROR_CODE))
object.add_method(
"get_state", (object.INDEX,), [nbody_system.length] * 3 + [nbody_system.speed] * 3 + [object.ERROR_CODE]
)
object.add_method("get_target_number_of_particles", (), (object.NO_UNIT, object.ERROR_CODE))
object.add_method("set_target_number_of_particles", (object.NO_UNIT,), (object.ERROR_CODE,))
object.add_method("get_fractal_dimension", (), (object.NO_UNIT, object.ERROR_CODE))
object.add_method("set_fractal_dimension", (object.NO_UNIT,), (object.ERROR_CODE,))
object.add_method("get_random_seed", (), (object.NO_UNIT, object.ERROR_CODE))
object.add_method("set_random_seed", (object.NO_UNIT,), (object.ERROR_CODE,))