big vtk ascii writer improvement
@@ -662,11 +662,10 @@ def _write_cells(f, cells, binary):
for c in cells.values():
n = c.shape[1]
# prepend a column with the value n
- out = numpy.column_stack([numpy.full(c.shape[0], n, dtype=c.dtype), c])
- fmt = " ".join(["{}"] * out.shape[1])
- # join them all together as strings
- out = "\n".join([fmt.format(*row) for row in out]) + "\n"
- f.write(out.encode("utf-8"))
+ numpy.column_stack([numpy.full(c.shape[0], n, dtype=c.dtype), c]).tofile(
+ f, sep="\n"
+ )
+ f.write("\n".encode("utf-8"))
# write cell types
f.write("CELL_TYPES {}\n".format(total_num_cells).encode("utf-8"))
