What's wrong with my VTU file?

When I try to open the following VTK file in Paraview, it says that a reader could not be found. In looking at other forum posts, this probably means that the file format is invalid. However, due to the scarcity of examples out there, I can’t figure out why this file doesn’t work.

<VTKFile type=”UnstructuredGrid” version="1.0" byte_order="LittleEndian" header_type="UInt32">
    <UnstructuredGrid>
        <Piece NumberOfPoints=”4” NumberOfCells=”2”>
            <PointData Scalars="data">
                <DataArray type="Float32" NumberOfComponents="1" Name="data" format="ascii">
                    0 0.5 0.5 1
                </DataArray>
            </PointData>
            <Points>
                <DataArray type="Float32" Name="coordinates" NumberOfComponents="3" format="ascii">
                0 0 0
                0 1 0
                1 0 0
                1 1 0
                </DataArray>
            </Points>
            <Cells>
                <DataArray type="Int32" Name="connectivity" format="ascii">
                0 2 1
                1 2 3
                </DataArray>
                <DataArray type="Int32" Name="offsets" format="ascii">
                3 6
                </DataArray>
                <DataArray type="UInt8" Name="types" format="ascii">
                5 5
                </DataArray>
            </Cells>
        </Piece>
    </UnstructuredGrid>
</VTKFile>

I’ve tried too many variations/edits to count, so I won’t bother listing them. Any idea what’s wrong?

Should offsets be [3, 3]

To debug that, I would use paraview, create a cone, clip it so you get an unstructured grid and look at the output format.

Nope, the offsets are correct.

Thanks for the tip. The problem I was having was on copying the data from the VTKBook pdf, the double quote character was incorrect. In the above file you can see the differences between the quotes in ”UnstructuredGrid” and version="1.0". Note that one is slanted, while the other is neutral.

The incorrect double quote character in Unicode is character U+201d, or RIGHT DOUBLE QUOTATION MARK. Whereas the normal double quote character is U+0022 or, QUOTATION MARK.

1 Like