Skip to content

User Guide

gmshparser has two intentionally different Python interfaces:

  • gmshparser.read() returns the modern immutable model and is recommended for new code.
  • gmshparser.parse() returns the original mutable compatibility model for existing applications.

Most users only need the modern interface.

  1. Install gmshparser.
  2. Follow Getting Started for a complete first read.
  3. Learn the Modern Data Model.
  4. Use Working with Meshes for common tasks and recipes.
  5. Read Supported Formats before relying on optional MSH sections.

Common tasks

Task Guide
Read a path or text stream Getting Started
Inspect nodes, elements, and entities Working with Meshes
Resolve named boundary or material groups Physical Groups and Periodicity
Convert topology to NumPy arrays NumPy Interoperability
Handle malformed or unsupported files Error Handling
Print mesh information from a shell Command Line Interface
Plot 2D meshes with matplotlib Visualization
Move an existing application to read() Migrating from the Compatibility API

Scope

gmshparser reads supported ASCII Gmsh MSH files into memory. It does not write meshes, convert formats, or retain every optional MSH section. The format guide records the exact supported versions, retained metadata, and known limitations.

For exact signatures and attributes, use the API Reference.