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


Python UnitSquareMesh.translate方法代码示例

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


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

示例1: test_compute_collisions_tree_2d

# 需要导入模块: from dolfin import UnitSquareMesh [as 别名]
# 或者: from dolfin.UnitSquareMesh import translate [as 别名]
    def test_compute_collisions_tree_2d(self):

        references = [[set([20, 21, 22, 23, 28, 29, 30, 31]),
                       set([0, 1, 2, 3, 8, 9, 10, 11])],
                      [set([6, 7]),
                       set([24, 25])]]

        points = [Point(0.52, 0.51), Point(0.9, -0.9)]

        for i, point in enumerate(points):

            mesh_A = UnitSquareMesh(4, 4)
            mesh_B = UnitSquareMesh(4, 4)

            mesh_B.translate(point)

            tree_A = BoundingBoxTree()
            tree_A.build(mesh_A)

            tree_B = BoundingBoxTree()
            tree_B.build(mesh_B)

            entities_A, entities_B = tree_A.compute_collisions(tree_B)

            if MPI.size(mesh_A.mpi_comm()) == 1:
                self.assertEqual(set(entities_A), references[i][0])
                self.assertEqual(set(entities_B), references[i][1])
开发者ID:YannCobigo,项目名称:dolfin,代码行数:29,代码来源:BoundingBoxTree.py

示例2: test_compute_entity_collisions_tree_2d

# 需要导入模块: from dolfin import UnitSquareMesh [as 别名]
# 或者: from dolfin.UnitSquareMesh import translate [as 别名]
def test_compute_entity_collisions_tree_2d():

    references = [[set([20, 21, 22, 23, 28, 29, 30, 31]),
                    set([0, 1, 2, 3, 8, 9, 10, 11])],
                  [set([6]),
                    set([25])]]

    points = [Point(0.52, 0.51), Point(0.9, -0.9)]

    for i, point in enumerate(points):

        mesh_A = UnitSquareMesh(4, 4)
        mesh_B = UnitSquareMesh(4, 4)

        mesh_B.translate(point)

        tree_A = BoundingBoxTree()
        tree_A.build(mesh_A)

        tree_B = BoundingBoxTree()
        tree_B.build(mesh_B)

        entities_A, entities_B = tree_A.compute_entity_collisions(tree_B)

        assert set(entities_A) == references[i][0]
        assert set(entities_B) == references[i][1]
开发者ID:vincentqb,项目名称:dolfin,代码行数:28,代码来源:test_bounding_box_tree.py

示例3: test_compute_entity_collisions_tree_2d

# 需要导入模块: from dolfin import UnitSquareMesh [as 别名]
# 或者: from dolfin.UnitSquareMesh import translate [as 别名]
    def test_compute_entity_collisions_tree_2d(self):

        references = [[[20, 21, 22, 23, 28, 29, 30, 31],
                      [0, 1, 2, 3, 8, 9, 10, 11]],
                      [[6],
                       [25]]]

        points = [Point(0.52, 0.51), Point(0.9, -0.9)]

        for i, point in enumerate(points):

            mesh_A = UnitSquareMesh(4, 4)
            mesh_B = UnitSquareMesh(4, 4)

            mesh_B.translate(point)

            tree_A = BoundingBoxTree()
            tree_A.build(mesh_A)

            tree_B = BoundingBoxTree()
            tree_B.build(mesh_B)

            entities_A, entities_B = tree_A.compute_entity_collisions(tree_B)

            if MPI.num_processes() == 1:
                self.assertEqual(sorted(entities_A), references[i][0])
                self.assertEqual(sorted(entities_B), references[i][1])
开发者ID:maciekswat,项目名称:dolfin_1.3.0,代码行数:29,代码来源:BoundingBoxTree.py


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