Skip to content

Conversation

@gunney1
Copy link
Contributor

@gunney1 gunney1 commented Jan 3, 2026

Summary

  • This PR is a performance improvement and re-factor
  • It does the following:
    • Implement a 2-pass BVH candidate search in the MeshClipperImpl::computeClipVolumes3DTets.
    • Factor common parts of that function to make it more compact and for re-use in a later PR.

The 2-pass BVH candidate search is more selective than the single-pass bounding box search, because we can use a more accurate screening at the leaves. The 2-pass is implemented only for tet-screened clips in this PR. The non-screened version and the hex-screened version will be updated in a later PR. (They are less likely to be used when performance is critical.)

The re-factoring is a partial fix for issue #1704.

…te search.

The 2-pass search uses more detailed screening than the single-pass
bounding-box collision criterion, so it screens more accurately.

Some repeated operations like checking overlaps and calling the
primitive clipping code have been factored out to make the main
loop more compact.
@gunney1 gunney1 added this to the FY26 January Release milestone Jan 3, 2026
@gunney1 gunney1 self-assigned this Jan 3, 2026
@gunney1 gunney1 added Quest Issues related to Axom's 'quest' component Performance Issues related to code performance labels Jan 3, 2026
@gunney1 gunney1 changed the base branch from develop to feature/gunney/reduce-device-copies January 4, 2026 06:02
Comment on lines +1059 to +1070
TetrahedronType tets[] = {TetrahedronType(oct[0], oct[3], oct[1], oct[2]),
TetrahedronType(oct[0], oct[3], oct[2], oct[4]),
TetrahedronType(oct[0], oct[3], oct[4], oct[5]),
TetrahedronType(oct[0], oct[3], oct[5], oct[1])};
double octVol = 0.0;
for(int i = 0; i < 4; ++i)
{
double tetVol = tets[i].signedVolume();
SLIC_ASSERT(tetVol >= -EPS); // Tet may be degenerate but not inverted.
octVol += axom::utilities::abs(tetVol);
}
return octVol;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be implemented within the Octahedron class as Octahedron::signedVolume() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. The octs from discretizing spheres and cones should convex, but general octs may be concave. I don't know if that matters but it seems like something to think about.

{
using ATOMIC_POL = typename axom::execution_space<ExecSpace>::atomic_policy;
constexpr bool tryFixOrientation = false;
if(screenLevel >= 3)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to define a ScreenLevel enum w/ meaningful names for the different levels?

Copy link
Contributor Author

@gunney1 gunney1 Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. It's just a way for me to do some experimentation to understand the effects of various things I was trying and to compare to similar codes. Once that is done, I believe that screening will prove to be low cost and usually helpful and I plan to remove the parameter.

An error occurred while trying to automatically change base from feature/gunney/reduce-device-copies to feature/gunney/mesh-clipper-statistics January 7, 2026 14:14
An error occurred while trying to automatically change base from feature/gunney/reduce-device-copies to feature/gunney/mesh-clipper-statistics January 7, 2026 14:14
@gunney1 gunney1 changed the base branch from feature/gunney/reduce-device-copies to develop January 7, 2026 14:16
@gunney1 gunney1 merged commit 699d226 into develop Jan 7, 2026
15 checks passed
@gunney1 gunney1 deleted the feature/gunney/2-pass-candidate-search branch January 7, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Performance Issues related to code performance Quest Issues related to Axom's 'quest' component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants