Skip to content

Too many overlapping particles cause tree build to fail

The following script causes the tree build to go to 256 levels deep and then fail:

import pyopencl as cl
import pyopencl.array
import numpy as np
import logging

from boxtree import TreeBuilder

ctx = cl._csc(0)
tb = TreeBuilder(ctx)

logging.basicConfig(level=logging.INFO)

with cl.CommandQueue(ctx) as queue:
    sources = [cl.array.zeros(queue, 11, float) for i in range(2)]
    tree, _ = tb(queue, sources, max_particles_in_box=10, debug=True)

Since the particles are all on top of each other, the tree builder will keep subdividing the tree away hopelessly.

I am not sure if we want to support overlapping particles, but when an out of levels error happens it is confusing and perhaps we should include this possibility in an error message.