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]
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])
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])