當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。