upxo.meshing.gbconformant.d3v2p0.mesh module

Shared voxel tetrahedra with constrained Laplacian relaxation.

Array axes are physical x, y, z; voxels occupy [i, i+1] * spacing. All integer labels, including zero and negative labels, are grains.

upxo.meshing.gbconformant.d3v2p0.mesh.quality(points, tets)[source]

Signed volume and mean-ratio quality (regular tetrahedron = 1).

upxo.meshing.gbconformant.d3v2p0.mesh.faces_of(tets)[source]
class upxo.meshing.gbconformant.d3v2p0.mesh.Mesh(points: numpy.ndarray, tetrahedra: numpy.ndarray, grain_ids: numpy.ndarray, boundary_triangles: numpy.ndarray, boundary_grains: numpy.ndarray, exterior: numpy.ndarray, node_kind: numpy.ndarray, fixed_axes: numpy.ndarray, original_points: numpy.ndarray, history: list, quality_history: list = <factory>, quality_before_optimization: numpy.ndarray | None = None)[source]

Bases: object

points: ndarray
tetrahedra: ndarray
grain_ids: ndarray
boundary_triangles: ndarray
boundary_grains: ndarray
exterior: ndarray
node_kind: ndarray
fixed_axes: ndarray
original_points: ndarray
history: list
quality_history: list
quality_before_optimization: ndarray | None = None
boundary_quality()[source]

Quality of tets touching internal interfaces, and interface triangles.

validate()[source]

Check incidence, per-grain closure, volume, and frozen constraints.

save(prefix)[source]

Write lossless NPZ, ParaView VTU, and validation JSON.

upxo.meshing.gbconformant.d3v2p0.mesh.mesh_voxels(labels, spacing=1.0, iterations=20, relaxation=0.35, min_quality=0.5, quality_iterations=60, quality_displacement=0.35)[source]

Mesh every voxel with six conforming tetrahedra, then relax globally.

Surface nodes average surface neighbors; junction line nodes average only neighbors on their junction line. Branch/end points and >=4-grain nodes are frozen. Interior nodes average volume neighbors. Backtracking enforces positive volumes and the requested mean-ratio quality floor globally. The initial mesh must meet that floor; otherwise a ValueError is raised. A subsequent tangential quality optimization runs for quality_iterations steps (0 disables it), with motion bounded by quality_displacement times the smallest voxel spacing from the post-Laplacian geometry.