Skip to main content

meshRW is a Python module that proposes basic readers and writers for msh (gmsh) and vtk (Paraview).

Project description

meshRW

GitHub PyPI release DOI CI tests code coverage Documentation

meshRW is a lightweight Python library to read/write mesh files for Gmsh and VTK-based workflows.

What it provides

  • Read legacy Gmsh meshes (.msh, v2.2).
  • Write Gmsh meshes (.msh) with static or transient fields.
  • Write legacy VTK (.vtk) and XML VTK (.vtu + .pvd) outputs.
  • Export nodal and elemental data, including time-series results.

Installation

pip install meshRW

For contributors (lint + docs tooling):

pip install -e .[dev,docs]

Quick start

Read a Gmsh mesh

from meshRW import msh

mesh = msh.mshReader(filename="input.msh", dim=3)
nodes = mesh.getNodes()
elements = mesh.getElements(dictFormat=True)

Write a VTK/VTU result

from meshRW import vtk2

vtk2.vtkWriter(
    filename="output.vtu",
    nodes=nodes,
    elements=elements,
    fields=[],
)

Writer input model

Writers share the same core data model:

  • nodes: array-like (n_nodes, 2|3).
  • elements: a dictionary or list of dictionaries with connectivity, type, and optional physgrp.
  • fields: list of dictionaries with name, type (nodal/elemental), dim, data, and optional time metadata (nbsteps, steps).

Format notes

  • .msh: use meshRW.msh (legacy) or meshRW.msh2 (Gmsh API-backed, version options).
  • .vtk: use meshRW.vtk (legacy writer).
  • .vtu / .pvd: use meshRW.vtk2 for XML and transient outputs.

Documentation

Development and quality

  • Tests: pytest meshRW/tests -q
  • Lint: ruff check meshRW
  • Docs build: sphinx-build -W --keep-going -b html docs docs/_build/html

See CONTRIBUTING.md for the full workflow.

Related projects

License

This project is licensed under the MIT License. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

meshrw-1.6.1.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

meshrw-1.6.1-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file meshrw-1.6.1.tar.gz.

File metadata

  • Download URL: meshrw-1.6.1.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for meshrw-1.6.1.tar.gz
Algorithm Hash digest
SHA256 d2be497b208077f60b8ec74c088a7a1551b131d775851411da4233d5445a691a
MD5 5d84e9676c36a12ea16f6427c2104b31
BLAKE2b-256 3957798cb9eebfab665edd9af204a4736d9d4252b936e1ea4bd162d443b521ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for meshrw-1.6.1.tar.gz:

Publisher: CI-publish.yml on luclaurent/meshRW

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file meshrw-1.6.1-py3-none-any.whl.

File metadata

  • Download URL: meshrw-1.6.1-py3-none-any.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for meshrw-1.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a24ecc77e28e5c78c4df91ee5d45906add2eeb0a19795b18d3ba8e59ab9dcb8
MD5 264fe63ee771bf00057d1077c7ffcf0b
BLAKE2b-256 7369aba583d8557dcc603ca51491303237323df141bd5430c0a1550e1275c2f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for meshrw-1.6.1-py3-none-any.whl:

Publisher: CI-publish.yml on luclaurent/meshRW

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page