コード例 #1
0
def test_compute_first_collision_1d():
    reference = {1: [4]}
    p = numpy.array([0.3, 0, 0])
    mesh = UnitIntervalMesh(MPI.comm_world, 16)
    for dim in range(1, 2):
        tree = BoundingBoxTree(mesh, dim)
        first = tree.compute_first_collision(p)
        assert first in reference[dim]
コード例 #2
0
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 = numpy.array([0.3, 0.3, 0.0])
    mesh = UnitSquareMesh(MPI.comm_world, 16, 16)
    for dim in range(1, 3):
        tree = BoundingBoxTree(mesh, dim)
        first = tree.compute_first_collision(p)

        # FIXME: Facet test is excluded because it mistakenly relies in
        # the facet indices
        if dim != mesh.topology.dim - 1:
            assert first in reference[dim]
コード例 #3
0
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 = numpy.array([0.3, 0.3, 0.3])
    mesh = UnitCubeMesh(MPI.comm_world, 8, 8, 8)
    for dim in range(1, 4):
        tree = BoundingBoxTree(mesh, dim)
        first = tree.compute_first_collision(p)

        # FIXME: Face and test is excluded because it mistakenly relies
        # in the facet indices
        tdim = mesh.topology.dim
        if dim != tdim - 1 and dim != tdim - 2:
            assert first in reference[dim]