liblaf.melon.tet
¶
Tetrahedral volume-mesh helpers.
Classes:
Functions:
-
fix_winding–Flip negatively oriented tetrahedra to positive volume.
-
flip–Flip tetrahedral winding for selected cells.
-
tetra_center_radius– -
tetra_surface_broad_phase– -
tetra_surface_fraction– -
volume_fraction–Estimate how much of each tetrahedron lies inside a closed surface.
TetraCenterRadiusResult
¶
fix_winding
¶
Flip negatively oriented tetrahedra to positive volume.
Parameters:
-
mesh(Any) –Object convertible to [
pyvista.UnstructuredGrid][]. -
check(bool, default:True) –Assert that all tetrahedra have non-negative volume after repair.
Returns:
-
UnstructuredGrid–Repaired tetrahedral mesh.
Source code in src/liblaf/melon/tet/_repair.py
flip
¶
flip(
mesh: Any, mask: Bool[ArrayLike, " C"]
) -> UnstructuredGrid
Flip tetrahedral winding for selected cells.
Parameters:
-
mesh(Any) –Object convertible to [
pyvista.UnstructuredGrid][]. -
mask(Bool[ArrayLike, ' C']) –Boolean mask selecting tetrahedra to flip.
Returns:
-
UnstructuredGrid–Mesh with selected tetrahedra rewound.
Source code in src/liblaf/melon/tet/_repair.py
tetra_center_radius
¶
tetra_center_radius(
mesh: UnstructuredGrid,
) -> TetraCenterRadiusResult
Source code in src/liblaf/melon/tet/_tetra_center_radius.py
tetra_surface_broad_phase
¶
Source code in src/liblaf/melon/tet/_tetra_surface_broad_phase.py
tetra_surface_fraction
¶
tetra_surface_fraction(
mesh: UnstructuredGrid,
surface: Mesh,
*,
n_samples: int = 1024,
) -> Bool[Tensor, "c s"]
Source code in src/liblaf/melon/tet/_tetra_surface_fraction.py
volume_fraction
¶
volume_fraction(
mesh: UnstructuredGrid,
surface: PolyData,
*,
n_samples: int = 1024,
split_size: int = 100000000,
) -> Float[ndarray, " c"]
Estimate how much of each tetrahedron lies inside a closed surface.
Tetrahedra whose four vertices are all inside or all outside the surface are classified exactly. Boundary tetrahedra are sampled with Sobol barycentric coordinates and classified by ray intersections.
Parameters:
-
mesh(UnstructuredGrid) –Tetrahedral volume mesh.
-
surface(PolyData) –Closed triangular surface used as the inside/outside boundary.
-
n_samples(int, default:1024) –Requested number of samples for each boundary tetrahedron. The Sobol sequence rounds this up to a power of two.
-
split_size(int, default:100000000) –Approximate maximum number of sampled points to process in one chunk.
Returns:
-
Float[ndarray, ' c']–One fraction per tetrahedral cell.