Skip to main content

pyLibMeshb

Python module to read/write mesh and solution files in Gamma Mesh Format (.mesh/.meshb/.sol/.solb). Implemented by compiling the vendored libMeshb source (libmeshb8.c / libmeshb8.h) directly and binding via Python ctypes.

PyPI distributions include precompiled shared libraries for Linux, Windows, and macOS, so most users can install with pip install pyLibMeshb without a C compiler or build toolchain. Wheels bundle the compiled libmeshb8 binary with the Python ctypes bindings, so the extension loads correctly on the host platform. If no prebuilt wheel matches your platform, pip falls back to building from source.

Getting Started

Install

pip install pyLibMeshb

Read and write mesh data

Import pyLibMeshb

import pyLibMeshb.libMeshb as lm

Check mesh information.

lm.mesh_info("naca0012.meshb")
 File          : naca0012.meshb
 Version       : 2
 Dimension     : 2
 Type                     Kind             Count   Details
 ----------------------------------------------------------------------
 vertices                 vertex            4796
 edges                    element            192
 triangles                element           9400

Read a mesh.

mesh = lm.read("naca0012.meshb")

Mesh data is stored in a dictionary with keys for each data type.

print(mesh.keys())
dict_keys(['version', 'dim', 'vertices', 'edges', 'triangles'])

Write the mesh back out.

lm.write("roundtrip.meshb", mesh)

Verify consistency.

import numpy as np
check = lm.read("roundtrip.meshb", types=["vertices"])
print("Round-trip vertices match:", np.allclose(mesh["vertices"], check["vertices"]))
Round-trip vertices match: True

Read and write solution data

Solution demo: 3 synthetic scalar fields (e.g. density, pressure, Mach).

n = mesh["vertices"].shape[0]
demo_values = np.column_stack([
    np.linspace(1.0, 2.0, n),
    np.linspace(101325.0, 90000.0, n),
    np.linspace(0.1, 3.5, n),
])
lm.write("naca0012.solb", {"version": 3, "dim": 2, "sol_at_vertices": {"values": demo_values}})

Check solution file information.

lm.mesh_info("naca0012.solb")
File          : naca0012.solb
Version       : 3
Dimension     : 2
Type                     Kind             Count   Details
----------------------------------------------------------------------
sol_at_vertices          solution          4796   sol_size=3, field_types=[1, 1, 1]

Solution data can be read using lm.read(). The mesh and solution can be visualized with Vizir4.

Query data types

Get lists of types in this mesh file.

mesh_types = lm.list_types("naca0012.meshb")
print(mesh_types)
['edges', 'triangles', 'vertices']

Get lists of types in this solution file.

solution_types =  lm.list_types("naca0012.solb")
print(solution_types)
['sol_at_vertices']

Get list of all types supported by pyLibMeshb.

all_types = lm.list_types()
print(all_types)

['corners', 'dsol_at_vertices', 'edges', 'hexahedra', 'isol_at_edges', 'isol_at_hexahedra', 'isol_at_prisms', 'isol_at_pyramids', 'isol_at_quadrilaterals', 'isol_at_tetrahedra', 'isol_at_triangles', 'isol_at_vertices', 'prisms', 'pyramids', 'quadrilaterals', 'ridges', 'sol_at_edges', 'sol_at_hexahedra', 'sol_at_prisms', 'sol_at_pyramids', 'sol_at_quadrilaterals', 'sol_at_tetrahedra', 'sol_at_triangles', 'sol_at_vertices', 'tetrahedra', 'triangles', 'vertices']

Testing

Install the package with its test dependencies and run the automated tests:

python -m pip install -e ".[test]"
python -m pytest

Credits

Download files

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

Source Distribution

pylibmeshb-0.1.10.tar.gz (33.3 kB view details)

Uploaded Source

Built Distributions

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

pylibmeshb-0.1.10-py3-none-win_amd64.whl (29.7 kB view details)

Uploaded Python 3Windows x86-64

pylibmeshb-0.1.10-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (73.0 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

pylibmeshb-0.1.10-py3-none-macosx_10_13_universal2.whl (51.5 kB view details)

Uploaded Python 3macOS 10.13+ universal2 (ARM64, x86-64)

File details

Details for the file pylibmeshb-0.1.10.tar.gz.

File metadata

  • Download URL: pylibmeshb-0.1.10.tar.gz
  • Upload date:
  • Size: 33.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pylibmeshb-0.1.10.tar.gz
Algorithm Hash digest
SHA256 e38580db31e9aab0ed35a5ef24a706cd36def652d7871ccb887e60c4039577cd
MD5 bb10d46b6137a3c15c8a935568677222
BLAKE2b-256 e7c12864fd82cd92ee9f4a15b42253142a9cc602c5712ac5554be36d4f0c5cd9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylibmeshb-0.1.10.tar.gz:

Publisher: build-wheels.yml on vtpasquale/pyLibMeshb

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

File details

Details for the file pylibmeshb-0.1.10-py3-none-win_amd64.whl.

File metadata

  • Download URL: pylibmeshb-0.1.10-py3-none-win_amd64.whl
  • Upload date:
  • Size: 29.7 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pylibmeshb-0.1.10-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 cd0ef1902bc3a87c4182072a8cd7767fde06d7b687c3b6aeff1236a5c2ad33d3
MD5 b3cc40bc9144d29beb5d41141cdb60fb
BLAKE2b-256 cf60f8d776a6b7c2d71475ca408ec18ebe5d4841a5af308f530df8872f5b6b99

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylibmeshb-0.1.10-py3-none-win_amd64.whl:

Publisher: build-wheels.yml on vtpasquale/pyLibMeshb

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

File details

Details for the file pylibmeshb-0.1.10-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pylibmeshb-0.1.10-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 7dfb99f81972544a4e236c4aea42733fd909a441935c7c00c12bf088c457a8a6
MD5 a920269bcbec90ff3fc5cee8019b5e06
BLAKE2b-256 810c3595269a3c9e4f606208c2d4006bdfb1a237e8607cb7d694eba0290cdd36

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylibmeshb-0.1.10-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:

Publisher: build-wheels.yml on vtpasquale/pyLibMeshb

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

File details

Details for the file pylibmeshb-0.1.10-py3-none-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for pylibmeshb-0.1.10-py3-none-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 275e4478d7c0bfafc6c9e7bc969f39936ab791d61d39667acdda0da1d0b5daf3
MD5 65b28c3d91a5d7fdc4877124538480a2
BLAKE2b-256 7b8dee1f5493cc74d0b309df603158322fbb64edcc21861ee7b720968ddca570

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylibmeshb-0.1.10-py3-none-macosx_10_13_universal2.whl:

Publisher: build-wheels.yml on vtpasquale/pyLibMeshb

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

Release history Release notifications | RSS feed

This release

0.1.10 This release

4 files

0.1.9

4 files

0.1.6

4 files

0.1.3

3 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page