本文整理汇总了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)
示例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)