Skip to content

Commit

Permalink
Merge pull request #1096 from nschloe/poly-fix
Browse files Browse the repository at this point in the history
poly fix
  • Loading branch information
nschloe authored May 6, 2021
2 parents ae6807e + 553e7e1 commit e0cd69d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = meshio
version = 4.4.2
version = 4.4.3
author = Nico Schlömer et al.
author_email = [email protected]
description = I/O for many mesh formats
Expand Down
16 changes: 1 addition & 15 deletions src/meshio/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,7 @@ def write(filename, mesh: Mesh, file_format: Optional[str] = None, **kwargs):

# check cells for sanity
for key, value in mesh.cells:
if key[:7] == "polygon":
try:
n = int(key[7:])
except ValueError:
msg = (
f'Key "{key}" malformed. '
'Should be "polygonN", where N is the number of points per polygon.'
)
raise ValueError(msg)
if value.shape[1] != n:
raise WriteError(
f"Polygon data array (shape {value.shape}) "
f'doesn\'t match the key "{key}"'
)
elif key in num_nodes_per_cell:
if key in num_nodes_per_cell:
if value.shape[1] != num_nodes_per_cell[key]:
raise WriteError(
f"Unexpected cells array shape {value.shape} for {key} cells."
Expand Down
5 changes: 1 addition & 4 deletions tests/legacy_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,7 @@ def _generate_vtk_mesh(points, cells):
len_array = 0
for meshio_type, data in cells.items():
numcells, num_local_nodes = data.shape
if meshio_type[:7] == "polygon":
vtk_type = meshio_to_vtk_type[meshio_type[:7]]
else:
vtk_type = meshio_to_vtk_type[meshio_type]
vtk_type = meshio_to_vtk_type[meshio_type]
# add cell types
cell_types.append(np.empty(numcells, dtype=np.ubyte))
cell_types[-1].fill(vtk_type)
Expand Down

0 comments on commit e0cd69d

Please sign in to comment.