Skip to content

Add file conversion CLI script and corresponding functionality - #275

Merged
adperezm merged 3 commits into
ExtremeFLOW:mainfrom
timofeymukha:feature/convert_tool
Oct 12, 2026
Merged

adperezm merged 3 commits into
ExtremeFLOW:mainfrom
timofeymukha:feature/convert_tool

Conversation

@timofeymukha

Copy link
Copy Markdown
Contributor

Adds pysemtools_convert that 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.

pysemtools_convert --list
  re2   -> nmsh  serial    convert a NEKTON .re2 mesh to Neko .nmsh
                            options: --periodic-tol
  re2   -> fld   parallel  write the GLL points of a re2 mesh to a Nek5000 field file without data
                            options: --order, --wdsz (required: --order)
  nmsh  -> fld   parallel  write the GLL points of a nmsh mesh to a Nek5000 field file without data
                            options: --order, --wdsz (required: --order)

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 CornerMesh being 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.

@timofeymukha
timofeymukha requested a review from adperezm October 2, 2026 08:07
@adperezm
adperezm merged commit 8e0df3f into ExtremeFLOW:main Oct 12, 2026
10 checks passed
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

Successfully merging this pull request may close these issues.

2 participants