upxo.meshing.gbconformant.d3v2p0.interfaces module

Extract and Laplacian-smooth internal voxel interfaces without volume meshing.

upxo.meshing.gbconformant.d3v2p0.interfaces.upscale_labels(labels, factor=1, spacing=1.0)[source]

Subdivide each voxel into factor**3 equal, identically labelled voxels.

Return (refined_labels, refined_spacing). Factor must be an integer >= 1; integer-valued real numbers such as 2.0 are accepted. Factor 1 returns the original array without copying. Label IDs and physical grain geometry are preserved exactly before smoothing. Memory grows cubically with factor.

class upxo.meshing.gbconformant.d3v2p0.interfaces.Interfaces(points: numpy.ndarray, triangles: numpy.ndarray, grain_pairs: numpy.ndarray, original_points: numpy.ndarray, node_kind: numpy.ndarray, fixed_axes: numpy.ndarray, accepted_iterations: int, junction_edges: numpy.ndarray = <factory>, smoothing_report: dict = <factory>)[source]

Bases: object

points: ndarray
triangles: ndarray
grain_pairs: ndarray
original_points: ndarray
node_kind: ndarray
fixed_axes: ndarray
accepted_iterations: int
junction_edges: ndarray
smoothing_report: dict
junction_metrics()[source]

Turning angles at movable degree-two line nodes; straight = 0 degrees.

upxo.meshing.gbconformant.d3v2p0.interfaces.smooth_interfaces(labels, spacing=1.0, iterations=20, relaxation=0.35, junction_iterations=None, junction_relaxation=0.25, junction_max_displacement=None, frozen_grain_ids=(), iterations_by_pair=None, ramp_rings=2, thickness_cap_fraction=None, minimum_wedge_angle=None, minimum_corner_angle=None, progress=None)[source]

Return shared internal interface triangles; no tetrahedra or RVE caps.

Voxel axes are x/y/z. Surface nodes average surface neighbors and junction nodes average junction neighbors. Junction endpoints, branches and >=4-grain nodes stay fixed, as do coordinates on RVE planes. Local step suppression and backtracking prevent triangle collapse and per-step normal reversal. This surface preview does not certify self-intersection-free geometry or preserve individual grain volumes, and differs from volume-constrained CM01. Junction smoothing has an independent iteration count (None uses iterations), relaxation and optional maximum displacement in physical units from the extracted geometry. Only edges incident to >=3 distinct grains are junction edges; endpoint label sets alone do not identify a junction edge. frozen_grain_ids locks every shared node incident to the selected grains in all three axes, preserving their voxel facets through Laplacian updates.

Differential smoothing (all optional; defaults reproduce the above): iterations_by_pair maps a grain pair (a, b) to the number of Laplacian iterations its interface nodes receive; a node takes the smallest count of the pairs it touches, and counts rise by at most an equal step per ring of neighbours over ramp_rings rings, so no step change leaves a crease. thickness_cap_fraction caps each node’s distance from its voxel position at that fraction of half the smallest local thickness (local_thickness) of the grains it touches, in physical units: thin necks and plates move little, thick regions are unaffected. minimum_wedge_angle (degrees) stops a node for the remaining iterations when its move would bring two triangles sharing an edge (a grain wedge at a junction line, or a fold) below that opening; such openings are reported, not repaired. minimum_corner_angle (degrees) does the same for patch corners: the angle of one interface patch at a fixed junction point (the sum of its triangle angles there, i.e. the angle between the two junction lines bounding it). A move that would bring a corner below the minimum, or make an already smaller corner smaller, stops the nodes involved.