JuliaVTK / ReadVTK.jl

Julia package for reading VTK XML files
https://juliavtk.github.io/ReadVTK.jl
MIT License
32 stars 10 forks source link

Support for PolyData? #10

Closed OndrejKincl closed 2 years ago

OndrejKincl commented 2 years ago

Would you please consider adding PolyData support? It would be greatly appreciated. I use WriteVTK to save results from particle simulations and then view in paraview. Sometimes I would like to load a simulation state or do some complicated post-processing.
I have only bunch of points with point data. Actually, your package works when I add

  elseif file_type == "PolyData"
    piece = root[file_type][1]["Piece"][1]
    n_points = parse(Int, attribute(piece, "NumberOfPoints", required=true))
    n_cells = 0
  end 

after line 140. But by default it throws assertion error.

ranocha commented 2 years ago

Would you mind making a PR with the addition and some tests?

OndrejKincl commented 2 years ago

Maybe. But I dont understand vtk very much and the fix which works for me is for sure extremely not robust. What do you imagine as tests?

ranocha commented 2 years ago

A nice test would be to use some different ways to write different forms of PolyData via WriteVTK.jl, read them back in, and check whether you get what you wrote.

OndrejKincl commented 2 years ago

Hi. I made a pull request with the addition and a test.