upxo.meshing.gbconformant.d3v2p0.voxel_topology module

Label-preserving voxel edits driven by exact cubical vertex-link defects.

upxo.meshing.gbconformant.d3v2p0.voxel_topology.detect_voxel_topology(labels)[source]

Return defective (padded block origin -> grain IDs) cubical vertex links.

Includes box faces/edges/corners, point pinches, alternating edge contacts, and disconnected complementary sectors. This tests each grain’s closed cubical boundary, not whether a genuine multi-grain junction should exist.

upxo.meshing.gbconformant.d3v2p0.voxel_topology.clean_voxel_topology(labels, enabled=True, max_passes=20, max_changes=5000, max_volume_fraction=0.2, protect_grains_up_to=0, preserve_components=False, max_pair_trials=20000, progress=None, track_history=True)[source]

Greedily reduce vertex-link defects without deleting a grain ID.

Only voxels adjacent to detected defects are considered. Every edit strictly reduces the global defect count (all affected links are recomputed). Volume budgets bound per-grain net count changes. Component preservation is optional because removing legitimate contacts may require merging/splitting components. Unresolved defects are reported explicitly; no success is inferred from stop.