本文整理汇总了Python中dolfin.BoundingBoxTree.compute_first_collision方法的典型用法代码示例。如果您正苦于以下问题:Python BoundingBoxTree.compute_first_collision方法的具体用法?Python BoundingBoxTree.compute_first_collision怎么用?Python BoundingBoxTree.compute_first_collision使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dolfin.BoundingBoxTree
的用法示例。
在下文中一共展示了BoundingBoxTree.compute_first_collision方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_compute_first_collision_3d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_first_collision [as 别名]
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()]
示例2: test_compute_first_collision_1d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_first_collision [as 别名]
def test_compute_first_collision_1d():
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)
assert first in reference[dim]
tree = mesh.bounding_box_tree()
first = tree.compute_first_collision(p)
assert first in reference[mesh.topology().dim()]
示例3: test_compute_first_collision_2d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_first_collision [as 别名]
def test_compute_first_collision_2d():
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)
assert first in reference[dim]
tree = mesh.bounding_box_tree()
first = tree.compute_first_collision(p)
assert first in reference[mesh.topology().dim()]
示例4: test_compute_first_collision_3d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_first_collision [as 别名]
def test_compute_first_collision_3d():
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)
assert first in reference[dim]
tree = mesh.bounding_box_tree()
first = tree.compute_first_collision(p)
assert first in reference[mesh.topology().dim()]
示例5: test_compute_first_collision_1d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_first_collision [as 别名]
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.size(mesh.mpi_comm()) == 1:
self.assertIn(first, reference[dim])
tree = mesh.bounding_box_tree()
first = tree.compute_first_collision(p)
if MPI.size(mesh.mpi_comm()) == 1:
self.assertIn(first, reference[mesh.topology().dim()])
示例6: test_compute_first_collision_2d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_first_collision [as 别名]
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.size(mesh.mpi_comm()) == 1:
self.assertIn(first, reference[dim])
tree = mesh.bounding_box_tree()
first = tree.compute_first_collision(p)
if MPI.size(mesh.mpi_comm()) == 1:
self.assertIn(first, reference[mesh.topology().dim()])
示例7: test_compute_first_collision_1d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_first_collision [as 别名]
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])
示例8: test_compute_first_collision_2d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_first_collision [as 别名]
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])
示例9: test_compute_first_collision_2d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_first_collision [as 别名]
def test_compute_first_collision_2d():
# FIXME: This test should not use facet indices as there are no guarantees
# on how DOLFIN numbers facets
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)
# FIXME: Facet test is excluded because it mistakingly relies in the
# facet indices
if dim != mesh.topology().dim() - 1:
assert first in reference[dim]
tree = mesh.bounding_box_tree()
first = tree.compute_first_collision(p)
assert first in reference[mesh.topology().dim()]
示例10: test_compute_first_collision_3d
# 需要导入模块: from dolfin import BoundingBoxTree [as 别名]
# 或者: from dolfin.BoundingBoxTree import compute_first_collision [as 别名]
def test_compute_first_collision_3d(self):
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)
if MPI.num_processes() == 1:
self.assertIn(first, reference[dim])