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

Leading Zeros in Output Files #145

Open
christianhauschel opened this issue Feb 27, 2024 · 5 comments
Open

Leading Zeros in Output Files #145

christianhauschel opened this issue Feb 27, 2024 · 5 comments

Comments

@christianhauschel
Copy link

It would be better if the output files (.vtk, h5, xmf, ...) of run_simulation had leading zeros by default for Paraview.

In the meantime, I think I will write a script that renames all result files.

@EdoAlvarezR
Copy link
Collaborator

You mean, something along the lines of 000-mysimulation.0.vtk, 001-mysimulation.1.vtk, and so on? Or more along the lines of mysimulation.000.vtk, mysimulation.001.vtk, and so on?

Could you explain more the motivation for this?

@christianhauschel
Copy link
Author

The latter.
ParaView does not support natural sorting, but lexicographical. So leading zeros would help to import sequences of data in the correct order.

It could be an option in the run_simulation:

run_simulation(nsteps, ...; ..., n_leading_zeros=nothing)

  if n_leading_zeros === nothing
    n_leading_zeros = ndigits(nsteps) +2 # add some margin for more steps in future
  end

  fname = lpad(string(10), n_leading_zeros, "0")
  println(fname)

end

@EdoAlvarezR
Copy link
Collaborator

EdoAlvarezR commented Mar 19, 2024

That's odd. I have never run into issues with ParaView being able to sort time steps from the format mysimulation.0.vtk, mysimulation.1.vtk, ... mysimulation.100.vtk. and so on. What operative system and version of ParaView are you using?

@cibinjoseph
Copy link
Member

Although I've not had this problem, I think this might happen when Paraview is built with Qt4.
Ref discussion

@christianhauschel
Copy link
Author

Win11, Paraview 5.12

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

3 participants