Skip to content

Commit

Permalink
fix invalid length error with meshio.CellBlock
Browse files Browse the repository at this point in the history
In commit [60d11b70] of meshio the length of `CellBlock`, a subclass of
`namedtuple`, is redefined to the length of the `data` attribute. This breaks
`namedtuple._replace`, where the length of the newly created `CellBlock` is
verified. This patch circumvents the problem by using the `CellBlock`
constructor directly instead of `namedtuple._replace`.

[60d11b70]: nschloe/meshio@60d11b7
  • Loading branch information
joostvanzwieten committed Apr 21, 2021
1 parent 41db6c4 commit 00218c1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nutils/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def parsegmsh(mshdata):
if keep.all():
renum = numpy.arange(len(cells.data))
else:
msh.cells[icell] = cells._replace(data=cells.data[numpy.hstack([True, keep])])
msh.cells[icell] = type(cells)(type=cells.type, data=cells.data[numpy.hstack([True, keep])])
renum = numpy.hstack([0, keep.cumsum()])
renums.append(renum)
for name, (itag, nd) in msh.field_data.items():
Expand Down

0 comments on commit 00218c1

Please sign in to comment.