本文整理汇总了Python中dolfin.BoundingBoxTree.compute_closest_entity方法的典型用法代码示例。如果您正苦于以下问题:Python BoundingBoxTree.compute_closest_entity方法的具体用法?Python BoundingBoxTree.compute_closest_entity怎么用?Python BoundingBoxTree.compute_closest_entity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dolfin.BoundingBoxTree
的用法示例。
在下文中一共展示了BoundingBoxTree.compute_closest_entity方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_compute_closest_entity_2d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_closest_entity [as 别名]
def test_compute_closest_entity_2d():
reference = (1, 1.0)
p = Point(-1.0, 0.01)
mesh = UnitSquareMesh(16, 16)
tree = BoundingBoxTree()
tree.build(mesh)
entity, distance = tree.compute_closest_entity(p)
assert entity == reference[0]
assert round(distance - reference[1], 7) == 0
tree = mesh.bounding_box_tree()
entity, distance = tree.compute_closest_entity(p)
assert entity == reference[0]
assert round(distance - reference[1], 7) == 0
示例2: test_compute_closest_entity_3d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_closest_entity [as 别名]
def test_compute_closest_entity_3d():
reference = (0, 0.1)
p = Point(0.1, 0.05, -0.1)
mesh = UnitCubeMesh(8, 8, 8)
tree = BoundingBoxTree()
tree.build(mesh)
entity, distance = tree.compute_closest_entity(p)
assert entity == reference[0]
assert round(distance - reference[1], 7) == 0
tree = mesh.bounding_box_tree()
entity, distance = tree.compute_closest_entity(p)
assert entity == reference[0]
assert round(distance - reference[1], 7) == 0
示例3: test_compute_closest_entity_3d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_closest_entity [as 别名]
def test_compute_closest_entity_3d(self):
reference = (0, 0.1)
p = Point(0.1, 0.05, -0.1)
mesh = UnitCubeMesh(8, 8, 8)
tree = BoundingBoxTree()
tree.build(mesh)
entity, distance = tree.compute_closest_entity(p)
if MPI.size(mesh.mpi_comm()) == 1:
self.assertEqual(entity, reference[0])
self.assertAlmostEqual(distance, reference[1])
tree = mesh.bounding_box_tree()
entity, distance = tree.compute_closest_entity(p)
if MPI.size(mesh.mpi_comm()) == 1:
self.assertEqual(entity, reference[0])
self.assertAlmostEqual(distance, reference[1])
示例4: test_compute_closest_entity_2d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_closest_entity [as 别名]
def test_compute_closest_entity_2d(self):
reference = (1, 1.0)
p = Point(-1.0, 0.01)
mesh = UnitSquareMesh(16, 16)
tree = BoundingBoxTree()
tree.build(mesh)
entity, distance = tree.compute_closest_entity(p)
if MPI.size(mesh.mpi_comm()) == 1:
self.assertEqual(entity, reference[0])
self.assertAlmostEqual(distance, reference[1])
tree = mesh.bounding_box_tree()
entity, distance = tree.compute_closest_entity(p)
if MPI.size(mesh.mpi_comm()) == 1:
self.assertEqual(entity, reference[0])
self.assertAlmostEqual(distance, reference[1])
示例5: test_compute_closest_entity_1d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_closest_entity [as 别名]
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)
if MPI.num_processes() == 1:
self.assertEqual(entity, reference[0])
self.assertAlmostEqual(distance, reference[1])
tree = mesh.bounding_box_tree()
entity, distance = tree.compute_closest_entity(p)
if MPI.num_processes() == 1:
self.assertEqual(entity, reference[0])
self.assertAlmostEqual(distance, reference[1])
示例6: test_compute_closest_entity_3d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_closest_entity [as 别名]
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])
tree = mesh.bounding_box_tree()
entity, distance = tree.compute_closest_entity(p, mesh)
if MPI.num_processes() == 1:
self.assertEqual(entity, reference[0])
self.assertAlmostEqual(distance, reference[1])
示例7: test_compute_closest_entity_2d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_closest_entity [as 别名]
def test_compute_closest_entity_2d(self):
reference = (0, numpy.sqrt(2.0))
p = Point(-1.0, -1.0)
mesh = UnitSquareMesh(16, 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])