This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How do I get cell collisions from BoundingBoxTree?

+1 vote

According to the documentation, the compute_collisions() method should return
two lists of identical length, listing the colliding BoundingBoxes of two BoundingBoxTrees.
In this example, I don't see that.

from dolfin import *

coarse = UnitSquareMesh(2, 2)
cb = BoundingBoxTree()
cb.build(coarse)

fine = UnitSquareMesh(5, 5)
fb = BoundingBoxTree()
fb.build(fine)

print cb.compute_collisions(fb)

(array([0, 1, 2, 3, 4, 5, 6, 7], dtype=uint32), array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49], dtype=uint32))

What am I doing wrong? How can I get a list of colliding cells (or cells which may collide based on their BoundingBox) ?

asked Oct 21, 2014 by chris_richardson FEniCS Expert (31,740 points)
...