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.

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", {"sol_at_vertices": {"values": demo_values}}, version=3, dim=2)

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.9.tar.gz (32.7 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.9-py3-none-win_amd64.whl (29.3 kB view details)

Uploaded Python 3Windows x86-64

pylibmeshb-0.1.9-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (72.7 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

pylibmeshb-0.1.9-py3-none-macosx_10_13_universal2.whl (51.2 kB view details)

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

File details

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

File metadata

  • Download URL: pylibmeshb-0.1.9.tar.gz
  • Upload date:
  • Size: 32.7 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.9.tar.gz
Algorithm Hash digest
SHA256 c7190fb76d75ab0f0b5f6ebb1c5c6315fec557a49b550be98e6c5e973f86f2c9
MD5 dce341679bdc0a863205569940f15c9e
BLAKE2b-256 502d44c9b4a64583fb69ae19245c8772ee43a91217857d440c383cd5500309ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylibmeshb-0.1.9.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.9-py3-none-win_amd64.whl.

File metadata

  • Download URL: pylibmeshb-0.1.9-py3-none-win_amd64.whl
  • Upload date:
  • Size: 29.3 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.9-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 950638cb1649e686c8237c84c18378f82bd87298bcb200ecd0ed398c691f8017
MD5 391a242ba28d04234508b94cfb762cc4
BLAKE2b-256 c5f01e602faa223c3aeb095c9435b5f18052050c3ffa1685fce8b205c93441ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylibmeshb-0.1.9-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.9-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pylibmeshb-0.1.9-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 5fc3b8def10c0134bde222a644a187ec01f1967260a45234949e161f33996624
MD5 ad8e89843d0404dfe528dce64deeeed9
BLAKE2b-256 3004fe6e5dee706da52abafe2f81478b3e2c06efc8128d665ec1e04e9c90ce62

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylibmeshb-0.1.9-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.9-py3-none-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for pylibmeshb-0.1.9-py3-none-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 4add25f1bd05d84382b21dc6905cdd73486ab300c4c0150d9f02d83a98b832c9
MD5 0a9e2b62e1ff01172bf57dd41aad4d6f
BLAKE2b-256 1b01c260fc5ade48ebd9d4582667663f4fc919dec53933e3d7f3cfed29fb5499

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylibmeshb-0.1.9-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

0.1.10

4 files

This release

0.1.9 This release

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