本文整理汇总了Python中pyne.mesh.Mesh.elem_volume方法的典型用法代码示例。如果您正苦于以下问题:Python Mesh.elem_volume方法的具体用法?Python Mesh.elem_volume怎么用?Python Mesh.elem_volume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyne.mesh.Mesh
的用法示例。
在下文中一共展示了Mesh.elem_volume方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_elem_volume
# 需要导入模块: from pyne.mesh import Mesh [as 别名]
# 或者: from pyne.mesh.Mesh import elem_volume [as 别名]
def test_elem_volume():
"""Test the get_elem_volume method"""
# Test tet elements recognition and calculation
filename = os.path.join(os.path.dirname(__file__),
"files_mesh_test/unstr.h5m")
tetmesh = Mesh(mesh=filename)
vols = list()
for __, __, ve in tetmesh:
vols.append(tetmesh.elem_volume(ve))
assert_almost_equal(np.min(vols), 0.13973, places=5)
assert_almost_equal(np.max(vols), 2.1783, places=4)
assert_almost_equal(np.mean(vols), 0.52702, places=5)
# Test hex elements recognition and calculation
filename = os.path.join(os.path.dirname(__file__),
"files_mesh_test/grid543.h5m")
mesh = Mesh(mesh=filename)
vols = list()
for __, __, ve in mesh:
vols.append(mesh.elem_volume(ve))
assert_almost_equal(np.mean(vols), 51.3333, places=4)