From cab534dd24b4fc28e88dd6ab7d61fc59a55eb5a3 Mon Sep 17 00:00:00 2001 From: Nicholas Sharp Date: Sat, 2 May 2026 23:37:30 -0700 Subject: [PATCH 1/4] update to latest --- deps/polyscope | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/polyscope b/deps/polyscope index 0c3dd68..dcbaedb 160000 --- a/deps/polyscope +++ b/deps/polyscope @@ -1 +1 @@ -Subproject commit 0c3dd68b9851417e6b2b976d347adc3250026122 +Subproject commit dcbaedb6cef9467e8f037dab7c89c116b0fc04dc From 808dba060d05a0a1f0db88e660adc6a10a4347b0 Mon Sep 17 00:00:00 2001 From: Nicholas Sharp Date: Sat, 2 May 2026 23:42:29 -0700 Subject: [PATCH 2/4] minor updates for volume cells --- src/polyscope/volume_mesh.py | 10 +++++++++- test/tests/test_all.py | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/polyscope/volume_mesh.py b/src/polyscope/volume_mesh.py index 18e32ba..426ba99 100644 --- a/src/polyscope/volume_mesh.py +++ b/src/polyscope/volume_mesh.py @@ -287,7 +287,15 @@ def register_volume_mesh( material: str | None = None, transparency: float | None = None, ) -> VolumeMesh: - """Register a new volume mesh""" + """ + Register a new volume mesh. + + Pass exactly one of tets (N,4), hexes (N,8) or mixed_cells (N,8) to specify the cell connectivity. + + The mixed_cells argument supports a mixture of tets, hexes, prisms, and pyramid elements; for each + row of indices, right-pad with -1 indices when not needed for that element type, for example a + pyramid cell row might be [72, 33, 86, 91, 15, -1, -1, -1]. + """ if not psb.is_initialized(): raise RuntimeError("Polyscope has not been initialized") diff --git a/test/tests/test_all.py b/test/tests/test_all.py index 311db83..0f55783 100644 --- a/test/tests/test_all.py +++ b/test/tests/test_all.py @@ -1816,6 +1816,20 @@ def test_add_mixed(self): # cells[-5:,4:] = -1 # clear out some rows at end # ps.register_volume_mesh("test_mesh3", self.generate_verts(), hexes=self.generate_tets()) + def test_add_prisms_pyramids_mixed(self): + np.random.seed(777) + n_pts = 10 + # prisms: (N,6) padded to (N,8) with -1 in last 2 cols + prism_cells = np.random.randint(0, n_pts, size=(n_pts, 8)) + prism_cells[:, 6:] = -1 + # pyramids: (N,5) padded to (N,8) with -1 in last 3 cols + pyramid_cells = np.random.randint(0, n_pts, size=(n_pts, 8)) + pyramid_cells[:, 5:] = -1 + cells = np.concatenate([prism_cells, pyramid_cells], axis=0) + ps.register_volume_mesh("test_mesh3", self.generate_verts(), mixed_cells=cells) + ps.show(3) + ps.remove_all_structures() + def test_options(self): p = ps.register_volume_mesh("test_mesh", self.generate_verts(), self.generate_tets()) From c51127cc87ccd9c34396c9bebc3a2bb3a14ec1af Mon Sep 17 00:00:00 2001 From: Nicholas Sharp Date: Sat, 2 May 2026 23:53:52 -0700 Subject: [PATCH 3/4] fix bad docstring --- src/polyscope/volume_mesh.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/polyscope/volume_mesh.py b/src/polyscope/volume_mesh.py index 426ba99..b5ced5a 100644 --- a/src/polyscope/volume_mesh.py +++ b/src/polyscope/volume_mesh.py @@ -290,11 +290,15 @@ def register_volume_mesh( """ Register a new volume mesh. - Pass exactly one of tets (N,4), hexes (N,8) or mixed_cells (N,8) to specify the cell connectivity. + Pass index arrays of tets (N,4), hexes (N,8) or mixed_cells (N,8) to specify the cell connectivity. The mixed_cells argument supports a mixture of tets, hexes, prisms, and pyramid elements; for each row of indices, right-pad with -1 indices when not needed for that element type, for example a pyramid cell row might be [72, 33, 86, 91, 15, -1, -1, -1]. + + It is not supported to specify both tets/hexes and the general mixed_cells; in this case, just pass + all cells as mixed_cells. You may pass both the tets and hexes arrays simultaneously, if so the cells + are presumed to be ordered with all tetrahedral cells coming first, then hexahedral cells. """ if not psb.is_initialized(): From 3d2320babcdc1bf2de65b17749f5b8a1c1199002 Mon Sep 17 00:00:00 2001 From: Nicholas Sharp Date: Sat, 2 May 2026 23:54:13 -0700 Subject: [PATCH 4/4] run formatter --- src/polyscope/volume_mesh.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/polyscope/volume_mesh.py b/src/polyscope/volume_mesh.py index b5ced5a..37e36ae 100644 --- a/src/polyscope/volume_mesh.py +++ b/src/polyscope/volume_mesh.py @@ -292,12 +292,12 @@ def register_volume_mesh( Pass index arrays of tets (N,4), hexes (N,8) or mixed_cells (N,8) to specify the cell connectivity. - The mixed_cells argument supports a mixture of tets, hexes, prisms, and pyramid elements; for each - row of indices, right-pad with -1 indices when not needed for that element type, for example a + The mixed_cells argument supports a mixture of tets, hexes, prisms, and pyramid elements; for each + row of indices, right-pad with -1 indices when not needed for that element type, for example a pyramid cell row might be [72, 33, 86, 91, 15, -1, -1, -1]. - It is not supported to specify both tets/hexes and the general mixed_cells; in this case, just pass - all cells as mixed_cells. You may pass both the tets and hexes arrays simultaneously, if so the cells + It is not supported to specify both tets/hexes and the general mixed_cells; in this case, just pass + all cells as mixed_cells. You may pass both the tets and hexes arrays simultaneously, if so the cells are presumed to be ordered with all tetrahedral cells coming first, then hexahedral cells. """