Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative path to .vtu in .pvtu files #151

Open
bmxam opened this issue Oct 3, 2024 · 1 comment
Open

Relative path to .vtu in .pvtu files #151

bmxam opened this issue Oct 3, 2024 · 1 comment

Comments

@bmxam
Copy link
Contributor

bmxam commented Oct 3, 2024

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.

@jipolanco
Copy link
Member

Hi, I completely agree with your remark: writing .pvtu files should work just like .pvd ones.

It would be great if you could make a PR to change this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants