WriteVTK.jl
WriteVTK.jl copied to clipboard
Relative path to .vtu in .pvtu files
Hi,
First of all, thank you for this great package that we use every day.
I am aware of #139 and #141, but my problem is slightly different. I would suggest an option to write relative paths to .vtu files in the .ptvu file. Today, when we write a .pvtu file by calling pvtk_grid
with an absolute path, the created .pvtu file contains absolute paths to each .vtu file:
pvtk_grid("/foo/bar/result", ...)
creates a file /foo/bar/result.pvtu
containing
<?xml version="1.0" encoding="utf-8"?>
<VTKFile type="PUnstructuredGrid" version="1.0" byte_order="LittleEndian">
<PUnstructuredGrid GhostLevel="0">
<Piece Source="/foo/bar/result/result_1.vtu"/>
<Piece Source="/foo/bar/result/result_2.vtu"/>
<PPoints>
<PDataArray type="Float64" Name="Points" NumberOfComponents="3"/>
</PPoints>
</PUnstructuredGrid>
</VTKFile>
Then the problem is that the whole folder containing the results cannot be moved since the paths in the .pvtu are absolute. I would rather expect a .pvtu containing relative paths (to the .pvtu itself, not the current working dir of course):
<?xml version="1.0" encoding="utf-8"?>
<VTKFile type="PUnstructuredGrid" version="1.0" byte_order="LittleEndian">
<PUnstructuredGrid GhostLevel="0">
<Piece Source="result/result_1.vtu"/>
<Piece Source="result/result_2.vtu"/>
<PPoints>
<PDataArray type="Float64" Name="Points" NumberOfComponents="3"/>
</PPoints>
</PUnstructuredGrid>
</VTKFile>
In other words, I think the .pvtu
file should be constructed like the .pvd
file : the path indicated by the user indicates where to create the file, but the paths to the .vtu
or .pvtu
inside the .pvd
are relative to the .pvd
filepath.
I am ok to propose a PR if you agree with this remark.