[boundary_from_poly] handle empty poly correctly
This commit is contained in:
parent
1ff8ab1014
commit
e2f6aea0a0
2 changed files with 5 additions and 0 deletions
|
|
@ -295,6 +295,8 @@ def boundary_from_poly(poly: poly_t) -> list[dict[str, Any]]:
|
||||||
"""
|
"""
|
||||||
neighbors = poly['neighbors']
|
neighbors = poly['neighbors']
|
||||||
vertices = poly['vertices']
|
vertices = poly['vertices']
|
||||||
|
if vertices.shape[0] == 0:
|
||||||
|
return []
|
||||||
|
|
||||||
owning_component = find_components(neighbors)
|
owning_component = find_components(neighbors)
|
||||||
faces = find_faces(neighbors)
|
faces = find_faces(neighbors)
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ from numpy.testing import assert_allclose
|
||||||
|
|
||||||
import adze
|
import adze
|
||||||
|
|
||||||
|
def test_boundary_from_empty_poly() -> None:
|
||||||
|
assert adze.boundary_from_poly(adze.util.build_empty()) == []
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('order', [0, 1, 2, 3])
|
@pytest.mark.parametrize('order', [0, 1, 2, 3])
|
||||||
def test_empty_poly_moments_shape(order: int) -> None:
|
def test_empty_poly_moments_shape(order: int) -> None:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue