def _write_serial_header(self, vtuf, mk, off):
    (names, types, comps, sizes) = self._get_array_attrs(mk)
    (npts, ncells) = self._get_npts_ncells_nnodes(mk)[:2]
    write_s = (lambda s: vtuf.write(s.encode('utf-8')))
    write_s('<Piece NumberOfPoints="{0}" NumberOfCells="{1}">\n'.format(npts, ncells))
    write_s('<Points>\n')
    for (i, (n, t, c, s)) in enumerate(zip(names, types, comps, sizes)):
        write_s('<DataArray Name="{0}" type="{1}" NumberOfComponents="{2}" format="appended" offset="{3}"/>\n'.format(n, t, c, off))
        off += (4 + s)
        if (i == 0):
            write_s('</Points>\n<Cells>\n')
        elif (i == 3):
            write_s('</Cells>\n<PointData>\n')
    write_s('</PointData>\n</Piece>\n')
    return off
def _write_serial_header(self, vtuf, mk, off):
    (names, types, comps, sizes) = self._get_array_attrs(mk)
    (npts, ncells) = self._get_npts_ncells_nnodes(mk)[:2]
    write_s = (lambda s: vtuf.write(s.encode('utf-8')))
    write_s('<Piece NumberOfPoints="{0}" NumberOfCells="{1}">\n'.format(npts, ncells))
    write_s('<Points>\n')
    for (i, (n, t, c, s)) in enumerate(zip(names, types, comps, sizes)):
        write_s('<DataArray Name="{0}" type="{1}" NumberOfComponents="{2}" format="appended" offset="{3}"/>\n'.format(n, t, c, off))
        off += (4 + s)
        if (i == 0):
            write_s('</Points>\n<Cells>\n')
        elif (i == 3):
            write_s('</Cells>\n<PointData>\n')
    write_s('</PointData>\n</Piece>\n')
    return off