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


Python Mesh.structured方法代码示例

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


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

示例1: test_photon_sampling_setup_unstructured

# 需要导入模块: from pyne.mesh import Mesh [as 别名]
# 或者: from pyne.mesh.Mesh import structured [as 别名]
def test_photon_sampling_setup_unstructured():

    phtn_src = os.path.join(thisdir, "files_test_r2s", "phtn_src")
    coords = [[0, 1, 2], [0, 1, 2], [0, 1]]
    m = Mesh(structured=True, structured_coords=coords)
    m.structured = False
    tags = {(10010000, "1 h"): "tag1", ("TOTAL", "shutdown"): "tag2"}
    photon_sampling_setup(m, phtn_src, tags)

    exp_tag1 = [[1.1, 2.2], [3.3, 4.4], [5.5, 6.6], [7.7, 8.8]]
    exp_tag2 = [[11.1, 12.2], [13.3, 14.4], [15.5, 16.6], [17.7, 18.8]]

    m.tag1 = IMeshTag(2, float)
    m.tag2 = IMeshTag(2, float)

    for i, mat, ve in m:
        assert_array_equal(m.tag1[i], exp_tag1[i])
        assert_array_equal(m.tag2[i], exp_tag2[i])
开发者ID:NukespudWork,项目名称:pyne,代码行数:20,代码来源:test_r2s.py

示例2: discretize_geom_centers

# 需要导入模块: from pyne.mesh import Mesh [as 别名]
# 或者: from pyne.mesh.Mesh import structured [as 别名]
def discretize_geom_centers():
    from pyne import dagmc
    dagmc.load(path)

    coords = [0, 1]
    coords2 = [0, 2, 4]
    mesh = Mesh(structured=True, 
                structured_coords=[coords2, coords, coords])
    #  explicitly set to unstructured to trigger the ve centers sampling
    #  method
    mesh.structured = False
    res = dagmc.discretize_geom(mesh)
    assert_array_equal(res["idx"], [0, 1])
    assert_array_equal(res["cell"], [2, 3])
    assert_array_equal(res["vol_frac"], [1.0, 1.0])
    assert_array_equal(res["rel_error"], [1.0, 1.0])

    #  ensure kwargs are not accepted for unstructured mesh
    assert_raises(ValueError, dagmc.discretize_geom, mesh, num_rays=3, grid=True)
开发者ID:FlanFlanagan,项目名称:pyne,代码行数:21,代码来源:test_dagmc.py

示例3: test_discretize_geom_centers

# 需要导入模块: from pyne.mesh import Mesh [as 别名]
# 或者: from pyne.mesh.Mesh import structured [as 别名]
    def test_discretize_geom_centers(self):
        """Test that unstructured mesh is sampled by mesh ve centers.
        """
        if not HAVE_IMESH:
            raise SkipTest
        coords = [0, 1]
        coords2 = [0, 2, 4]
        mesh = Mesh(structured=True, 
                    structured_coords=[coords2, coords, coords])
        #  explicitly set to unstructured to trigger the ve centers sampling
        #  method
        mesh.structured = False
        res = dagmc.discretize_geom(mesh)
        assert_array_equal(res["idx"], [0, 1])
        assert_array_equal(res["cell"], [2, 3])
        assert_array_equal(res["vol_frac"], [1.0, 1.0])
        assert_array_equal(res["rel_error"], [1.0, 1.0])

        #  ensure kwargs are not accepted for unstructured mesh
        assert_raises(ValueError, dagmc.discretize_geom, mesh, num_rays=3, grid=True)
开发者ID:NukespudWork,项目名称:pyne,代码行数:22,代码来源:test_dagmc.py


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