Closed ytanimura closed 1 year ago
I wrote a code that creates a simple cube:
fn main() { use vtkio::model::*; #[rustfmt::skip] let points = IOBuffer::F32(vec![ 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, ]); let vertex_numbers = VertexNumbers::XML { #[rustfmt::skip] connectivity: vec![ 0, 2, 3, 1, 0, 1, 5, 4, 1, 3, 7, 5, 3, 2, 6, 7, 2, 0, 4, 6, 4, 5, 7, 6, ], offsets: vec![4, 8, 12, 16, 20, 24], }; let piece = PolyDataPiece { points, polys: Some(vertex_numbers), ..Default::default() }; let vtk = Vtk { version: Version::new((1, 0)), title: "simple cube".to_string(), byte_order: ByteOrder::LittleEndian, data: DataSet::PolyData { meta: None, pieces: vec![Piece::Inline(Box::new(piece))], }, file_path: None, }; let mut buf = Vec::<u8>::new(); vtk.write_xml(&mut buf).unwrap(); std::fs::write("simple-cube.vtp", &buf).unwrap(); }
The contents of simple-cube.vtp are as follows:
simple-cube.vtp
<VTKFile type="PolyData" version="1.0" byte_order="LittleEndian" header_type="UInt64"><PolyData><Piece NumberOfPoints="8" NumberOfLines="0" NumberOfStrips="0" NumberOfPolys="6" NumberOfVerts="0"><PointData/><CellData/><Points><DataArray type="Float32" format="binary" NumberOfComponents="3">YAAAAAAAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAAAAAAIA/AACAPwAAAAAAAAAAAAAAAAAAgD8AAIA/AAAAAAAAgD8AAAAAAACAPwAAgD8AAIA/AACAPwAAgD8=</DataArray></Points><Polys><DataArray type="UInt64" Name="connectivity" format="binary" NumberOfComponents="1">wAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAADAAAAAAAAAAcAAAAAAAAABQAAAAAAAAADAAAAAAAAAAIAAAAAAAAABgAAAAAAAAAHAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAFAAAAAAAAAAcAAAAAAAAABgAAAAAAAAA=</DataArray><DataArray type="UInt64" Name="offsets" format="binary" NumberOfComponents="1">MAAAAAAAAAAEAAAAAAAAAAgAAAAAAAAADAAAAAAAAAAQAAAAAAAAABQAAAAAAAAAGAAAAAAAAAA=</DataArray></Polys></Piece></PolyData></VTKFile>
When I tried to load it in ParaView (5.8.0), I got the following error message.
Error reading cell offsets: Unsupported array type: vtkUnsignedLongLongArray
ParaView successfully displayed the cube after changing the type of connectivity and offsets to Int64, as shown below.
connectivity
offsets
Int64
<VTKFile type="PolyData" version="1.0" byte_order="LittleEndian" header_type="UInt64"><PolyData><Piece NumberOfPoints="8" NumberOfLines="0" NumberOfStrips="0" NumberOfPolys="6" NumberOfVerts="0"><PointData/><CellData/><Points><DataArray type="Float32" format="binary" NumberOfComponents="3">YAAAAAAAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAAAAAAIA/AACAPwAAAAAAAAAAAAAAAAAAgD8AAIA/AAAAAAAAgD8AAAAAAACAPwAAgD8AAIA/AACAPwAAgD8=</DataArray></Points><Polys><DataArray type="Int64" Name="connectivity" format="binary" NumberOfComponents="1">wAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAADAAAAAAAAAAcAAAAAAAAABQAAAAAAAAADAAAAAAAAAAIAAAAAAAAABgAAAAAAAAAHAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAFAAAAAAAAAAcAAAAAAAAABgAAAAAAAAA=</DataArray><DataArray type="Int64" Name="offsets" format="binary" NumberOfComponents="1">MAAAAAAAAAAEAAAAAAAAAAgAAAAAAAAADAAAAAAAAAAQAAAAAAAAABQAAAAAAAAAGAAAAAAAAAA=</DataArray></Polys></Piece></PolyData></VTKFile>
It seems to be resolved in ParaView 5.11.0. My apologies. I close it.
Thank you @ytanimura for reporting this issue. It is still good to know that paraview 5.8 doesn't have support unsigned indices.
I wrote a code that creates a simple cube:
The contents of
simple-cube.vtp
are as follows:When I tried to load it in ParaView (5.8.0), I got the following error message.
ParaView successfully displayed the cube after changing the type of
connectivity
andoffsets
toInt64
, as shown below.