vtk writer: small improvements
@@ -380,6 +380,11 @@ def write(filename,
field_data=None,
write_binary=True
):
+ # from .legacy_writer import write as w
+ # w('vtk-ascii',
+ # filename, points, cells, point_data, cell_data, field_data
+ # )
+ # return
meshio_to_vtk_type = {v: k for k, v in vtk_to_meshio_type.items()}
@@ -424,9 +429,10 @@ def write(filename,
for key in cells:
n = cells[key].shape[1]
for cell in cells[key]:
- f.write(('{} '.format(n)).encode('utf-8'))
- for idx in cell:
- f.write(('{} '.format(idx)).encode('utf-8'))
+ f.write(' '.join([
+ '{}'.format(idx)
+ for idx in numpy.concatenate([[n], cell])
+ ]).encode('utf-8'))
f.write('\n'.encode('utf-8'))
# write cell types
@@ -468,8 +474,6 @@ def write(filename,
f.write('CELL_DATA {}\n'.format(total_num_cells).encode('utf-8'))
_write_field_data(f, cell_data_raw, write_binary)
- # from .legacy_writer import write as w
- # w(filetype, filename, points, cells, point_data, cell_data, field_data)
return
