本文整理汇总了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])