From 00218c1b3f27924ab8dfc2747fc1e9e94cc63c30 Mon Sep 17 00:00:00 2001 From: Joost van Zwieten Date: Thu, 15 Apr 2021 21:43:34 +0200 Subject: [PATCH] fix invalid length error with meshio.CellBlock 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]: https://github.com/nschloe/meshio/commit/60d11b705c9b9074284feefdb7475db0410953e9 --- nutils/mesh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nutils/mesh.py b/nutils/mesh.py index 11e86eaf5..64e8cbe54 100644 --- a/nutils/mesh.py +++ b/nutils/mesh.py @@ -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():