Add native OBJ, STL, PLY, SU2 and Nastran mesh I/O - #330
Open
vijaiaeroastro wants to merge 9 commits into
Open
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.
This PR makes progress on #44 by adding direct support for five commonly used
mesh-exchange formats through Mmg's existing public APIs and generic file
dispatch. The readers and writers are implemented directly in Mmg, without
requiring an additional runtime, and are available consistently to the C, C++,
Fortran and command-line interfaces.
I could not use
meshiodirectly for this implementation because it is aPython/NumPy library, while these readers and writers need to be available from
Mmg's native C, C++ and Fortran APIs without requiring a Python runtime.
meshiostill provided a useful interoperability reference for the formats itsupports.
I intend this as a substantial first step toward #44 rather than closing the
issue. I have left formats such as Gmsh 4 and CGNS for follow-up PRs.
What is included
OBJ for MMGS
mmg_ref_<id>names preserve the requested reference.references across a round trip.
STL for MMGS
.stlextension.meshes with very small coordinates.
PLY for MMGS
properties.
.plyaextension.toward non-standard 64-bit integer properties, while the writer reports an
error if a value cannot be represented by the PLY 1.0 scalar types.
SU2 for MMG2D, MMG3D and MMGS
3D, together with boundary markers.
meshes into tetrahedra. A warning is emitted when this conversion occurs.
mmg_ref_<id>marker references and assignscollision-free fallback references to ordinary marker names.
splitting quadrilaterals deterministically. It also accepts standalone
surface-only files that place those faces in
NELEM, provided no volumecells are mixed in.
SU2 representation of a boundary surface.
Nastran bulk data for MMGS and MMG3D
bulk-data representation.
decomposition, with a warning when conversion is required.
$MMG_REFmetadata.The new formats participate in the existing extension-based generic I/O path;
the established readers are otherwise left intact.
API and compatibility
MMG5_FMT_Unknownwithout changing its publicnumeric value.
MMGS public APIs.
not exposed as volume readers, and SU2/Nastran support follows the element
types represented by the relevant API.
Testing
Each format has API-level tests using actual mesh files generated by the test
programs. The tests cover generic and format-specific entry points, round trips,
reference preservation, element ordering, malformed or unsupported input, and
the hybrid-cell conversions used by SU2 and Nastran.
Additional checks include:
standard signed/unsigned reference output and 64-bit input policy.
MTL output.
reference mapping.
quadrilateral splitting and MMGS round trips.
MMG5_int.configuration.
Follow-up work
I intentionally kept the following formats out of this PR so that their design,
dependencies and review remain manageable:
Gmsh 4.x (especially 4.1): add native surface and volume support for the
block-based
$Entities,$Nodesand$Elementsmodel. Version detectionshould select the new path without competing with or regressing the existing
legacy Gmsh reader. Physical groups, entity tags, sparse node tags and both
ASCII and binary encodings need explicit tests.
CGNS: add surface and volume I/O through optional
libcgns/HDF5 support.This should use the project's established optional-dependency conventions,
with a clear CMake feature switch and useful behavior when CGNS is not
installed. Element sections, boundary conditions, families and Mmg
references need a documented mapping.
Broader interoperability fixtures: add a small curated corpus produced by
Gmsh, SU2, common CAD/meshing tools and Nastran-compatible solvers as the
native readers mature.