Closed juliohm closed 2 years ago
It was merged into the General registry 6 hours ago, see https://github.com/JuliaRegistries/General/pull/47162
Also, what are the plans to keep improving the package with time?
As stated in the README on the main page of this repo, ReadVTK was mainly motivated by wanting to write proper tests for Trixi2Vtk.jl. A lot of useful features are still missing (see list in the README), and community contributions to improve this package are welcome! In particular, we will probably not have the bandwidth to add new features ourselves, but we will be happy to review PRs from the community or participate in a greater community effort to implement such functionality.
I second everything @ranocha has written. In addition, to help debugging your particular problem, it would be helpful if you could post the exact commands you used and the full error output.
Thank you all for the quick replies. The error I am getting with the master branch is the following:
julia> VTKFile("foo.vtk")
Entity: line 1: parser error : Start tag expected, '<' not found
# vtk DataFile Version 4.2
^
ERROR: LightXML.XMLParseError{String}("Failure in parsing an XML file.")
Stacktrace:
[1] _check_result
@ ~/.julia/packages/LightXML/g6rbQ/src/document.jl:88 [inlined]
[2] parse_string(s::String)
@ LightXML ~/.julia/packages/LightXML/g6rbQ/src/document.jl:99
[3] VTKFile(filename::String)
@ ReadVTK ~/.julia/packages/ReadVTK/61RnW/src/ReadVTK.jl:92
[4] top-level scope
@ REPL[7]:1
Let me know if you need any additional information, I am happy to help. The ultimate goal is to be able to load VTK files from disk and convert the data structures to Meshes.jl structures.
Would you mind sharing the VTK file you used (maybe in a gist)? From the first look, it seems like your VTK file might not be XML based - which tool did you use to create it?
@sloede can I send it to your email? The file was generated by a colleague, it is a widely used example in academia.
Sure. You'll find my email address here. I will probably not be able to looks at it before tomorrow, though.
Thank you for providing the problematic VTK file. My initial hunch was confirmed: The file you sent me was written in the legacy VTK format that is serial and not XML-based. Reading such files is currently not supported by ReadVTK, since in our projects we only deal with XML-based VTK files (especially since WriteVTK.jl only produces such XML-based files).
You can check if your file is a legacy VTK file by running (on a *nix machine) head -n1 FILENAME
. This will print the first line of the file in question. If it starts with something like # vtk DataFile Version X.Y
you know it's an unsupported legacy file. I also updated the README to make it clear that non-XML are not supported and I added a check to the VTKFile
constructor to warn if an unsupported file is read:
julia> VTKFile("some-old-legacy-file.vtk")
ERROR: bad VTK file format (found legacy format; only VTK XML files are currently supported)
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] VTKFile(filename::String)
@ ReadVTK ~/hackathon/ReadVTK.jl/src/ReadVTK.jl:76
[3] top-level scope
@ REPL[13]:1
As @ranocha stated above, however, community contributions are welcome, thus if you're interested in extending ReadVTK to support also legacy files (which shouldn't be too hard, I guess), we'd be happy to discuss possible strategies for how to organize the code and also to review PRs.
Awesome @sloede thank you for the update. Is there any tool from the VTK ecosystem that allows to convert legacy files to new files in the command line? That would solve my issue perfectly.
There are two options described here: https://stackoverflow.com/questions/26158599/how-to-convert-vtk-legacy-files-to-vtu-format
One is ParaView based, the other uses a Python tool. Maybe this can help - I haven't used either of them, though.
Thank you @sloede I will close the issue and try things again soon.
I tried installing the package with a simple
] add ReadVTK
but the package manager didn't find it. Also, what are the plans to keep improving the package with time? I have a file for whichVTKFile("foo.vtk")
failed.