本文整理匯總了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])
示例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]
示例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])