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


Python dolfin.BoundingBoxTree类代码示例

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


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

示例1: test_compute_first_collision_3d

def test_compute_first_collision_3d():

    # FIXME: This test should not use facet indices as there are no guarantees
    # on how DOLFIN numbers facets

    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)
        first = tree.compute_first_collision(p)

        # FIXME: Face and test is excluded because it mistakingly
        # relies in the facet indices
        tdim = mesh.topology().dim()
        if dim != tdim - 1 and dim != tdim - 2:
            assert first in reference[dim]

    tree = mesh.bounding_box_tree()
    first = tree.compute_first_collision(p)
    assert first in reference[mesh.topology().dim()]
开发者ID:live-clones,项目名称:dolfin,代码行数:25,代码来源:test_bounding_box_tree.py

示例2: test_compute_entity_collisions_3d

def test_compute_entity_collisions_3d():

    reference = set([876, 877, 878, 879, 880, 881])

    p = Point(0.3, 0.3, 0.3)
    mesh = UnitCubeMesh(8, 8, 8)

    tree = BoundingBoxTree()
    tree.build(mesh)
    entities = tree.compute_entity_collisions(p)
    assert set(entities) == reference
开发者ID:vincentqb,项目名称:dolfin,代码行数:11,代码来源:test_bounding_box_tree.py

示例3: test_compute_first_entity_collision_3d

    def test_compute_first_entity_collision_3d(self):

        reference = [876, 877, 878, 879, 880, 881]

        p = Point(0.3, 0.3, 0.3)
        mesh = UnitCubeMesh(8, 8, 8)
        tree = BoundingBoxTree()
        tree.build(mesh)
        first = tree.compute_first_entity_collision(p, mesh)
        if MPI.num_processes() == 1:
            self.assertIn(first, reference)
开发者ID:MiroK,项目名称:DolfinSurface,代码行数:11,代码来源:BoundingBoxTree.py

示例4: test_compute_first_entity_collision_2d

    def test_compute_first_entity_collision_2d(self):

        reference = [136, 137]

        p = Point(0.3, 0.3)
        mesh = UnitSquareMesh(16, 16)
        tree = BoundingBoxTree()
        tree.build(mesh)
        first = tree.compute_first_entity_collision(p, mesh)
        if MPI.num_processes() == 1:
            self.assertIn(first, reference)
开发者ID:MiroK,项目名称:DolfinSurface,代码行数:11,代码来源:BoundingBoxTree.py

示例5: test_compute_entity_collisions_3d

    def test_compute_entity_collisions_3d(self):

        reference = [876, 877, 878, 879, 880, 881]

        p = Point(0.3, 0.3, 0.3)
        mesh = UnitCubeMesh(8, 8, 8)
        tree = BoundingBoxTree()
        tree.build(mesh)
        entities = tree.compute_entity_collisions(p, mesh)
        if MPI.num_processes() == 1:
            self.assertEqual(sorted(entities), reference)
开发者ID:MiroK,项目名称:DolfinSurface,代码行数:11,代码来源:BoundingBoxTree.py

示例6: test_compute_collisions_point_1d

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,代码行数:11,代码来源:test_bounding_box_tree.py

示例7: test_compute_entity_collisions_2d

    def test_compute_entity_collisions_2d(self):

        reference = [136, 137]

        p = Point(0.3, 0.3)
        mesh = UnitSquareMesh(16, 16)
        tree = BoundingBoxTree()
        tree.build(mesh)
        entities = tree.compute_entity_collisions(p, mesh)
        if MPI.num_processes() == 1:
            self.assertEqual(sorted(entities), reference)
开发者ID:MiroK,项目名称:DolfinSurface,代码行数:11,代码来源:BoundingBoxTree.py

示例8: test_compute_collisions_1d

    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])
开发者ID:MiroK,项目名称:DolfinSurface,代码行数:12,代码来源:BoundingBoxTree.py

示例9: test_compute_first_collision_1d

    def test_compute_first_collision_1d(self):

        reference = {1: [4]}

        p = Point(0.3)
        mesh = UnitIntervalMesh(16)
        for dim in range(1, 2):
            tree = BoundingBoxTree()
            tree.build(mesh, dim)
            first = tree.compute_first_collision(p)
            if MPI.num_processes() == 1:
                self.assertIn(first, reference[dim])
开发者ID:MiroK,项目名称:DolfinSurface,代码行数:12,代码来源:BoundingBoxTree.py

示例10: test_compute_collisions_point_2d

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,代码行数:12,代码来源:test_bounding_box_tree.py

示例11: test_compute_collisions_point_1d

    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,代码行数:12,代码来源:BoundingBoxTree.py

示例12: test_compute_entity_collisions_3d

    def test_compute_entity_collisions_3d(self):

        reference = set([876, 877, 878, 879, 880, 881])

        p = Point(0.3, 0.3, 0.3)
        mesh = UnitCubeMesh(8, 8, 8)

        tree = BoundingBoxTree()
        tree.build(mesh)
        entities = tree.compute_entity_collisions(p)
        if MPI.size(mesh.mpi_comm()) == 1:
            self.assertEqual(set(entities), reference)
开发者ID:YannCobigo,项目名称:dolfin,代码行数:12,代码来源:BoundingBoxTree.py

示例13: test_compute_closest_entity_3d

    def test_compute_closest_entity_3d(self):

        reference = (2, numpy.sqrt(3.0))

        p = Point(-1.0, -1.0, -1.0)
        mesh = UnitCubeMesh(8, 8, 8)
        tree = BoundingBoxTree()
        tree.build(mesh)
        entity, distance = tree.compute_closest_entity(p, mesh)

        if MPI.num_processes() == 1:
            self.assertEqual(entity, reference[0])
            self.assertAlmostEqual(distance, reference[1])
开发者ID:MiroK,项目名称:DolfinSurface,代码行数:13,代码来源:BoundingBoxTree.py

示例14: test_compute_closest_entity_1d

    def test_compute_closest_entity_1d(self):

        reference = (0, 1.0)

        p = Point(-1.0)
        mesh = UnitIntervalMesh(16)
        tree = BoundingBoxTree()
        tree.build(mesh)
        entity, distance = tree.compute_closest_entity(p, mesh)

        if MPI.num_processes() == 1:
            self.assertEqual(entity, reference[0])
            self.assertAlmostEqual(distance, reference[1])
开发者ID:MiroK,项目名称:DolfinSurface,代码行数:13,代码来源:BoundingBoxTree.py

示例15: test_compute_first_collision_2d

    def test_compute_first_collision_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)
            first = tree.compute_first_collision(p)
            if MPI.num_processes() == 1:
                self.assertIn(first, reference[dim])
开发者ID:MiroK,项目名称:DolfinSurface,代码行数:13,代码来源:BoundingBoxTree.py


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