Add Vector Cell Data in reader

Hello, I’m trying to write a new reader using a library of mine called oommfpy. I have cell data in the form of vectors. When I write my VTK files I specify this data as VECTORS m double. How can I do this in the reader? This is the RequestData method I’m writing

    def RequestData(self, request, inInfoVec, outInfoVec):
        output = dsa.WrapDataObject(vtkRectilinearGrid.GetData(outInfoVec))

        # Use oommfpy to read the mesh
        if self._file_format == 'omf':
            mesh = oommfpy.MagnetisationData(self._filename)
        else:
            mesh = oommfpy.FieldData(self._filename)
        mesh.generate_coordinates()
        mesh.generate_field()

        output.SetDimensions(mesh.nx + 1, mesh.ny + 1, mesh.nz + 1)

        output.SetXCoordinates(mesh.grid[0])
        output.SetYCoordinates(mesh.grid[1])
        output.SetZCoordinates(mesh.grid[2])

        # Cell data
        # This is a 3 * nx * ny * nz array. How to specify VECTORS?
        output.CellData.append(mesh.field.reshape(-1), 'm')

Hello,

I don’t know what the value of mesh.field.shape is, but adding vector data is often done as follows.

import vtk
from vtk.numpy_interface import algorithms as algs

m = algs.make_vector(mesh.field[0],mesh.field[1],mesh.field[2])
output.CellData.append(m, 'm')