当前位置: 首页>>代码示例>>Python>>正文


Python Mesh.structured_get_divisions方法代码示例

本文整理汇总了Python中pyne.mesh.Mesh.structured_get_divisions方法的典型用法代码示例。如果您正苦于以下问题:Python Mesh.structured_get_divisions方法的具体用法?Python Mesh.structured_get_divisions怎么用?Python Mesh.structured_get_divisions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyne.mesh.Mesh的用法示例。


在下文中一共展示了Mesh.structured_get_divisions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_divs

# 需要导入模块: from pyne.mesh import Mesh [as 别名]
# 或者: from pyne.mesh.Mesh import structured_get_divisions [as 别名]
def test_get_divs():
    x = [1, 2.5, 4, 6.9]
    y = [-12, -10, -.5]
    z = [100, 200]

    sm = Mesh(structured_coords=[x, y, z], structured=True)

    assert_equal(sm.structured_get_divisions("x"), x)
    assert_equal(sm.structured_get_divisions("y"), y)
    assert_equal(sm.structured_get_divisions("z"), z)
开发者ID:FlanFlanagan,项目名称:pyne,代码行数:12,代码来源:test_mesh.py

示例2: test_create_by_file

# 需要导入模块: from pyne.mesh import Mesh [as 别名]
# 或者: from pyne.mesh.Mesh import structured_get_divisions [as 别名]
def test_create_by_file():
    filename = os.path.join(os.path.dirname(__file__), 
                            "files_mesh_test/grid543.h5m")
    sm = Mesh(mesh=filename, structured=True)
    assert_true(all(sm.dims == [1, 11, -5, 5, 14, -3]))

    # This mesh is interesting because the i/j/k space is not numbered from
    # zero. Check that divisions are correct

    assert_equal(sm.structured_get_divisions("x"), range(1,6))
    assert_equal(sm.structured_get_divisions("y"), [1.0, 5.0, 10.0, 15.0] )
    assert_equal(sm.structured_get_divisions("z"), [-10.0, 2.0, 12.0] )

    # loading a test file without structured mesh metadata should raise an 
    # error
    filename2 = os.path.join(os.path.dirname(__file__), 
                             "files_mesh_test/no_str_mesh.h5m")
    assert_raises(iBase.TagNotFoundError, Mesh, mesh=filename2, 
                       structured=True)
开发者ID:FlanFlanagan,项目名称:pyne,代码行数:21,代码来源:test_mesh.py


注:本文中的pyne.mesh.Mesh.structured_get_divisions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。