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


Python BoundingBoxTree.compute_collisions方法代码示例

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


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

示例1: test_compute_collisions_tree_1d

# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_collisions [as 别名]
def test_compute_collisions_tree_1d():

    references = [[set([8, 9, 10, 11, 12, 13, 14, 15]),
                    set([0, 1, 2, 3, 4, 5, 6, 7])],
                  [set([14, 15]),
                    set([0, 1])]]

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

    for i, point in enumerate(points):

        mesh_A = UnitIntervalMesh(16)
        mesh_B = UnitIntervalMesh(16)

        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)

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

示例2: test_compute_collisions_tree_3d

# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_collisions [as 别名]
def test_compute_collisions_tree_3d():

    references = [[set([18, 19, 20, 21, 22, 23, 42, 43, 44, 45, 46, 47]),
                    set([0, 1, 2, 3, 4, 5, 24, 25, 26, 27, 28, 29])],
                  [set([6, 7, 8, 9, 10, 11, 30, 31, 32, 33, 34, 35]),
                    set([12, 13, 14, 15, 16, 17, 36, 37, 38, 39, 40, 41])]]

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

    for i, point in enumerate(points):

        mesh_A = UnitCubeMesh(2, 2, 2)
        mesh_B = UnitCubeMesh(2, 2, 2)

        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)

        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_collisions_tree_2d

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

        references = [[[20, 21, 22, 23, 28, 29, 30, 31],
                      [0, 1, 2, 3, 8, 9, 10, 11]],
                      [[6, 7],
                       [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.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

示例4: test_compute_collisions_tree_2d

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

    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)

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

示例5: test_compute_collisions_1d

# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_collisions [as 别名]
    def test_compute_collisions_1d(self):

        reference = {1: [4]}

        p = Point(0.3)
        mesh = UnitIntervalMesh(16)
        for dim in range(1, 2):
            tree = BoundingBoxTree()
            tree.build(mesh, dim)
            entities = tree.compute_collisions(p)
            if MPI.num_processes() == 1:
                self.assertEqual(sorted(entities), reference[dim])

        tree = mesh.bounding_box_tree()
        entities = tree.compute_collisions(p)
        if MPI.num_processes() == 1:
            self.assertEqual(sorted(entities), reference[mesh.topology().dim()])
开发者ID:ifumagalli,项目名称:dolfin,代码行数:19,代码来源:BoundingBoxTree.py

示例6: test_compute_collisions_3d

# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_collisions [as 别名]
    def test_compute_collisions_3d(self):

        reference = {1: [1364],
                     2: [1967, 1968, 1970, 1972, 1974, 1976],
                     3: [876, 877, 878, 879, 880, 881]}

        p = Point(0.3, 0.3, 0.3)
        mesh = UnitCubeMesh(8, 8, 8)
        for dim in range(1, 4):
            tree = BoundingBoxTree()
            tree.build(mesh, dim)
            entities = tree.compute_collisions(p)
            if MPI.num_processes() == 1:
                self.assertEqual(sorted(entities), reference[dim])

        tree = mesh.bounding_box_tree()
        entities = tree.compute_collisions(p)
        if MPI.num_processes() == 1:
            self.assertEqual(sorted(entities), reference[mesh.topology().dim()])
开发者ID:ifumagalli,项目名称:dolfin,代码行数:21,代码来源:BoundingBoxTree.py

示例7: test_compute_collisions_point_1d

# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_collisions [as 别名]
def test_compute_collisions_point_1d():

    reference = {1: set([4])}

    p = Point(0.3)
    mesh = UnitIntervalMesh(16)
    for dim in range(1, 2):
        tree = BoundingBoxTree()
        tree.build(mesh, dim)
        entities = tree.compute_collisions(p)
        assert set(entities) == reference[dim]
开发者ID:vincentqb,项目名称:dolfin,代码行数:13,代码来源:test_bounding_box_tree.py

示例8: test_compute_collisions_point_2d

# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_collisions [as 别名]
def test_compute_collisions_point_2d():

    reference = {1: set([226]),
                  2: set([136, 137])}

    p = Point(0.3, 0.3)
    mesh = UnitSquareMesh(16, 16)
    for dim in range(1, 3):
        tree = BoundingBoxTree()
        tree.build(mesh, dim)
        entities = tree.compute_collisions(p)
        assert set(entities) == reference[dim]
开发者ID:vincentqb,项目名称:dolfin,代码行数:14,代码来源:test_bounding_box_tree.py

示例9: test_compute_collisions_point_1d

# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_collisions [as 别名]
    def test_compute_collisions_point_1d(self):

        reference = {1: set([4])}

        p = Point(0.3)
        mesh = UnitIntervalMesh(16)
        for dim in range(1, 2):
            tree = BoundingBoxTree()
            tree.build(mesh, dim)
            entities = tree.compute_collisions(p)
            if MPI.size(mesh.mpi_comm()) == 1:
                self.assertEqual(set(entities), reference[dim])
开发者ID:YannCobigo,项目名称:dolfin,代码行数:14,代码来源:BoundingBoxTree.py

示例10: test_compute_collisions_point_3d

# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_collisions [as 别名]
def test_compute_collisions_point_3d():

    reference = {1: set([1364]),
                  2: set([1967, 1968, 1970, 1972, 1974, 1976]),
                  3: set([876, 877, 878, 879, 880, 881])}

    p = Point(0.3, 0.3, 0.3)
    mesh = UnitCubeMesh(8, 8, 8)
    for dim in range(1, 4):
        tree = BoundingBoxTree()
        tree.build(mesh, dim)
        entities = tree.compute_collisions(p)
        assert set(entities) == reference[dim]
开发者ID:vincentqb,项目名称:dolfin,代码行数:15,代码来源:test_bounding_box_tree.py

示例11: test_compute_collisions_2d

# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_collisions [as 别名]
    def test_compute_collisions_2d(self):

        reference = {1: [226],
                     2: [136, 137]}

        p = Point(0.3, 0.3)
        mesh = UnitSquareMesh(16, 16)
        for dim in range(1, 3):
            tree = BoundingBoxTree()
            tree.build(mesh, dim)
            entities = tree.compute_collisions(p)
            if MPI.num_processes() == 1:
                self.assertEqual(sorted(entities), reference[dim])
开发者ID:MiroK,项目名称:DolfinSurface,代码行数:15,代码来源:BoundingBoxTree.py

示例12: test_compute_collisions_point_2d

# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_collisions [as 别名]
    def test_compute_collisions_point_2d(self):

        reference = {1: set([226]),
                     2: set([136, 137])}

        p = Point(0.3, 0.3)
        mesh = UnitSquareMesh(16, 16)
        for dim in range(1, 3):
            tree = BoundingBoxTree()
            tree.build(mesh, dim)
            entities = tree.compute_collisions(p)
            if MPI.size(mesh.mpi_comm()) == 1:
                self.assertEqual(set(entities), reference[dim])
开发者ID:YannCobigo,项目名称:dolfin,代码行数:15,代码来源:BoundingBoxTree.py

示例13: test_compute_collisions_point_2d

# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_collisions [as 别名]
def test_compute_collisions_point_2d():

    reference = {1: set([226]),
                  2: set([136, 137])}

    p = Point(0.3, 0.3)
    mesh = UnitSquareMesh(16, 16)
    for dim in range(1, 3):
        tree = BoundingBoxTree()
        tree.build(mesh, dim)
        entities = tree.compute_collisions(p)
        for e in entities:
            ent = MeshEntity(mesh, dim, e)
            mp = ent.midpoint()
            x = (mp.x(), mp.y())
            print("test: {}".format(x))
开发者ID:live-clones,项目名称:dolfin,代码行数:18,代码来源:test_bounding_box_tree.py

示例14: test_compute_collisions_point_3d

# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_collisions [as 别名]
def test_compute_collisions_point_3d():

    reference = {1: set([1364]),
                  2: set([1967, 1968, 1970, 1972, 1974, 1976]),
                  3: set([876, 877, 878, 879, 880, 881])}

    p = Point(0.3, 0.3, 0.3)
    mesh = UnitCubeMesh(8, 8, 8)
    for dim in range(1, 4):
        tree = BoundingBoxTree()
        tree.build(mesh, dim)
        entities = tree.compute_collisions(p)

        # FIXME: Face and edges tests are excluded because test
        # mistakingly relies on the face and edge indices
        tdim = mesh.topology().dim()
        if dim != tdim - 1 and dim != tdim - 2:
            assert set(entities) == reference[dim]
开发者ID:live-clones,项目名称:dolfin,代码行数:20,代码来源:test_bounding_box_tree.py


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