def test_compute_first_entity_collision_3d(): reference = [876, 877, 878, 879, 880, 881] p = numpy.array([0.3, 0.3, 0.3]) mesh = UnitCubeMesh(MPI.comm_world, 8, 8, 8) tree = BoundingBoxTree(mesh, mesh.topology.dim) first = tree.compute_first_entity_collision(p, mesh) assert first in reference
def test_compute_first_entity_collision_1d(): reference = [4] p = numpy.array([0.3, 0, 0]) mesh = UnitIntervalMesh(MPI.comm_world, 16) tree = BoundingBoxTree(mesh, mesh.topology.dim) first = tree.compute_first_entity_collision(p, mesh) assert first in reference
def test_compute_first_entity_collision_2d(): reference = [136, 137] p = numpy.array([0.3, 0.3, 0.0]) mesh = UnitSquareMesh(MPI.comm_world, 16, 16) tree = BoundingBoxTree(mesh, mesh.topology.dim) first = tree.compute_first_entity_collision(p, mesh) assert first in reference
def test_manifold_point_search(): # Simple two-triangle surface in 3d vertices = [(0.0, 0.0, 1.0), (1.0, 1.0, 1.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)] cells = [(0, 1, 2), (0, 1, 3)] mesh = Mesh(MPI.comm_world, CellType.triangle, numpy.array(vertices, dtype=numpy.float64), numpy.array(cells, dtype=numpy.int32), [], cpp.mesh.GhostMode.none) bb = BoundingBoxTree(mesh, mesh.topology.dim) p = numpy.array([0.5, 0.25, 0.75]) assert bb.compute_first_entity_collision(p, mesh) == 0 p = numpy.array([0.25, 0.5, 0.75]) assert bb.compute_first_entity_collision(p, mesh) == 1