Tree build refactor 1
This is the first of several PRs to refactor the tree build. This PR adds the very basic classes and methods to enable generation of uniform box mesh for volumential (thus dropping its dependency on another custom fork of boxtree).
Generating a uniform mesh can be done as follows:
import numpy as np
import boxtree as bt
import modepy as mp
tree = bt.tree_build._make_tob_root(2, [[-1, -1], [1, 1]])
n_levels = 3
for lev in range(n_levels):
tree = tree.uniformly_refined()
quad = mp.LegendreGaussQuadrature(1)
x, q = bt.tree_build.distribute_quadrature_rule(tree, quad)
print(x)
assert np.isclose(sum(q), 4)
- [x] Needs https://github.com/inducer/pyopencl/pull/600
Update boxtree/tree_build.py
I know it's tempting, but please modify the default commit message for accepting suggestions to describe a bit what's happening. Otherwise it's hard to know from a list of commit titles to see what happened.
Just pushed with --force to fix the commit messages. Will see if that works..
To cut down on noise in my email, I'm unsubscribing from this PR. When it next needs my attention, please @-mention me or hit the "request review" button. Otherwise, I may not see your messages in a timely manner.
#49 just landed (via squashing). Unfortunately, it looks like this has caused a few conflicts here. I hope you'll just be able to reapply these changes on top of that.
No idea why the documentation CI is failing. It works on my machine (no warnings).
Are you running it the same way the CI does?
https://github.com/inducer/ci-support/blob/f6803534383def5cf816002c1b08b2d128009871/ci-support.sh#L437=
(I can reproduce the failure without a problem.)
I see, I was missing -n.
Might be related: https://github.com/sphinx-doc/sphinx/issues/9705
@xywei There are some CI failures here that I believe might be on the end of the new code. Could you take a look?
_ test_uniform_tree_of_boxes_convergence[<context factory for <pyopencl.Device 'pthread-Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz' on 'Portable Computing Language'>>-4-3] _
[gw1] linux -- Python 3.10.6 /home/runner/work/boxtree/boxtree/.miniforge3/envs/testing/bin/python3
Traceback (most recent call last):
File "/home/runner/work/boxtree/boxtree/test/test_tree_of_boxes.py", line 156, in test_uniform_tree_of_boxes_convergence
assert eoc_rec.order_estimate() >= 2*order + 2 - eps
AssertionError: assert 6.59328736537206 >= (((2 * 4) + 2) - 0.01)
+ where 6.59328736537206 = <bound method EOCRecorder.order_estimate of <pytools.convergence.EOCRecorder object at 0x7f581a3e82e0>>()
+ where <bound method EOCRecorder.order_estimate of <pytools.convergence.EOCRecorder object at 0x7f581a3e82e0>> = <pytools.convergence.EOCRecorder object at 0x7f581a3e82e0>.order_estimate
_ test_uniform_tree_of_boxes_convergence[<context factory for <pyopencl.Device 'pthread-Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz' on 'Portable Computing Language'>>-4-2] _
[gw2] linux -- Python 3.10.6 /home/runner/work/boxtree/boxtree/.miniforge3/envs/testing/bin/python3
Traceback (most recent call last):
File "/home/runner/work/boxtree/boxtree/test/test_tree_of_boxes.py", line 156, in test_uniform_tree_of_boxes_convergence
assert eoc_rec.order_estimate() >= 2*order + 2 - eps
AssertionError: assert 1.9475325801058603 >= (((2 * 4) + 2) - 0.01)
+ where 1.9475325801058603 = <bound method EOCRecorder.order_estimate of <pytools.convergence.EOCRecorder object at 0x7faee4da2a40>>()
+ where <bound method EOCRecorder.order_estimate of <pytools.convergence.EOCRecorder object at 0x7faee4da2a40>> = <pytools.convergence.EOCRecorder object at 0x7faee4da2a40>.order_estimate
_ test_uniform_tree_of_boxes_convergence[<context factory for <pyopencl.Device 'pthread-Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz' on 'Portable Computing Language'>>-3-2] _
[gw3] linux -- Python 3.10.6 /home/runner/work/boxtree/boxtree/.miniforge3/envs/testing/bin/python3
Traceback (most recent call last):
File "/home/runner/work/boxtree/boxtree/test/test_tree_of_boxes.py", line 156, in test_uniform_tree_of_boxes_convergence
assert eoc_rec.order_estimate() >= 2*order + 2 - eps
AssertionError: assert 7.9662860043822175 >= (((2 * 3) + 2) - 0.01)
+ where 7.9662860043822175 = <bound method EOCRecorder.order_estimate of <pytools.convergence.EOCRecorder object at 0x7fc2d49ebaf0>>()
+ where <bound method EOCRecorder.order_estimate of <pytools.convergence.EOCRecorder object at 0x7fc2d49ebaf0>> = <pytools.convergence.EOCRecorder object at 0x7fc2d49ebaf0>.order_estimate
Unsubscribing... @-mention or request review once it's ready for a look or needs attention.