Repository navigation
Add file conversion CLI script and corresponding functionality - #275
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds
pysemtools_convertthat can convert various file formats. It takes the input and output files as arguments and deduces the formats. Alternatively, one can pin the formats via command line options. Depending on the format, additional options are expected / possible.Behind the CLI script there is a registry of converts and implementations for ones in the above list (the -> fld ones are really one converter being a
CornerMeshbeing constructed from either a re2 or nmsh file).The implementation is again by Fable 5.1, with guidance from me afterwards and an adversarial review from Opus 5.5. I think the registry system is very neat, I learned some new Python :-). It should be easy to add new formats with this sytem (vtkhdf5 is a clear candidate). The point deduplication agorithm is also not something I could invent: it reinterprets float64s as int64s so that one can sort on ints, which is faster. I went through the entire code line by line, except for the actual re2 -> nmsh converter functions. Most of those seem to very closely mimic what rea2nbin does, and it has been tested against rea2nbin on about 30 meshes I pulled from the Nek5000 and Neko examples.
The re2->nsmsh converter delivers what this was all started for: it consumes way less memory than rea2nbin. A 1M element mesh converts in about 5s on my machine.