-
Notifications
You must be signed in to change notification settings - Fork 632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use geom_box_tree for fragment stats calculation #996
Comments
For reference, the following plot shows the time for The time for Additionally, the following are the same results showing the time in seconds which demonstrate that |
Summary of method for using Suppose you want to compute the intersection of a box
The sum of the intersections in step 4, from all of the leaves and objects, is then what you want (replacing your current loop over objects). |
Looks like int iii, jjj, kkk; \
for (iii = -1; iii <= 1; ++iii) { \
shiftby.x = iii * geometry_lattice.size.x; \
for (jjj = -1; jjj <= 1; ++jjj) { \
shiftby.y = jjj * geometry_lattice.size.y; \
for (kkk = -1; kkk <= 1; ++kkk) { \
shiftby.z = kkk * geometry_lattice.size.z; \
body; \
if (geometry_lattice.size.z == 0) break; \
} \
if (geometry_lattice.size.y == 0) break; \
} \
if (geometry_lattice.size.x == 0) break; \
} \ |
and in for (i = 0; i < dimensions; ++i) {
if (VEC_I(t->b.high, i) == VEC_I(t->b.low, i)) continue; /* skip empty dimensions */
find_best_partition(t->nobjects, t->objects, i, &division_point[i],
&division_nobjects[i][0],
&division_nobjects[i][1]);
if (MAX(division_nobjects[i][0], division_nobjects[i][1]) <
MAX(division_nobjects[best][0], division_nobjects[best][1]))
best = i;
} |
This was implemented in #1030, but it didn't seem to improve performance. |
To speed up the computation of
box_overlap_with_object
, you can:compute the
geom_box_tree
object withcreate_geom_box_tree0
for the whole computational cell duringinit_libctl
or similar.When you are computing the cost of a box, walk down the tree (using the bounding boxes stored in each tree node) to quickly find a list of objects that may potentially intersect your box, and only for these objects call the slow
box_overlap_with_object
routineThe text was updated successfully, but these errors were encountered: