more strict file names / allow numbers in mesh file prefix #220
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Main changes of this PR
Replay mode currently doesn't allow numbers in the mesh file prefix since the code is looking for the string
"1"
(if startdt = 1) anywhere in the file name, including the path. If the data files aredirectory1/mesh.init.vtk
anddirectory1/mesh.dt1.vtk
, the search picksdirectory1/mesh.init.vtk
as the mesh for the first time step and complains about missing0
orinit
file if initialization is required. (Error message:Starting from dt =1 but previous timestep ".init" or 0 was not found. Please make sure the relevant Mesh exists.
) I think this only actually a problem if data initialization is enabled, otherwise the sorting of the list of mesh file names hides the bug.With this change, the code is looking for
".dt1"
instead, and only in the actual file name, not in the path.Pro: Allow numbers in the mesh prefix path, e.g. resolution of the mesh, versions, dates, etc.
Con: Someone might rely on a less strict format, i.e. using
mesh1.vtk
as file names. The documentation doesn't explicitly forbid this, but it does talk about using the meshes generated by precice export. I guess the check could be relaxed a bit by checking for1
instead ofdt1
, but not including the path.Author's checklist
pre-commit
hook and usedpre-commit run --all
to apply all available hooks.docs/README.md
. => I think the documentation already covers this./changelog-entries/
(create if necessary).precice/tutorials/aste-turbine
. => tutorials use meshes generated by precice export, so it's fineCan add a test and changelog on request, not sure this small change requires it.