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.0.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.0-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: meshrw-1.6.0.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.0.tar.gz
Algorithm Hash digest
SHA256 bd59364144959f44273a2924f4f35adf2d0592ec63d20a31d68e634a35a9c9ad
MD5 52a0966cb07552901bad3f0be82e68b3
BLAKE2b-256 29b4820e0e63f34023ebe77b57a892fe01460eaa089ebc760a4d0964e0dd9e63

See more details on using hashes here.

Provenance

The following attestation bundles were made for meshrw-1.6.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: meshrw-1.6.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a3490b38a9b94bf76510b5304350df7f3a41658d9fbe3bfa0c17a92421455716
MD5 eee6a1088e5fe9818073218f6a293fed
BLAKE2b-256 68c62e997916f7b1eea6b0e65d2778d6bf8645c93b1052ecdde7f8113a4fedba

See more details on using hashes here.

Provenance

The following attestation bundles were made for meshrw-1.6.0-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