Skip to main content

mixdpy

Package for handling mixd meshes and associated data

Pipeline Status Coverage Report Latest Release

This package provides an interface for handling the MIXD mesh format developed at CATS. Routines for reading/writing big endian binary files and a Mixd class for reading meshes and associated data are provided.

Installation

In your python environment run:

pip install mixdpy

To also use the meshio reader/writer, install the meshio extra:

pip install "mixdpy[meshio]"

With the extra installed, import mixdpy automatically registers the mixd format with meshio, so meshio.read(..., file_format="mixd") and mesh.write(..., file_format="mixd") work out of the box.

Examples

Some examples:

Write and read binaries

import mixdpy
import numpy as np

arr = np.arange(24, dtype=np.int32).reshape(2, 3, 4)
filename = "somebinarray"

mixdpy.write_int(filename, arr, shift=False)
out = mixdpy.read_int(filename, shape=(3, 4), shift=False)

Reading a mesh

import mixdpy

path_to_mesh = "mesh"

mesh = mixdpy.Mixd(path_to_mesh, minf_name="minf.space") # Infers dpst flag from mien entries

# Read associated data
ndf = mesh.nsd + 1
ins_data_out = mesh.read_node_float("data.out",entry_shape=(ndf,))
ins_data_all = mesh.read_node_float("data.all",entry_shape=(ndf,),nts=-1)

print(mesh.get_bounds())

Export mesh using meshio

import mixdpy
import meshio

path_to_mesh = "mesh"
mesh = mixdpy.Mixd(path_to_mesh)

ndf = mesh.nsd + 1
ins_data_out = mesh.read_node_float("data.out",entry_shape=(ndf,))

export_mesh = meshio.Mesh(
    mesh.mxyz,
    {mesh.get_meshio_elem():mesh.mien},
    point_data = {
        "velocity" : ins_data_out[0,:,:mesh.nsd],
        "pressure" : ins_data_out[0,:,mesh.nsd]
    }
)
export_mesh.write("ins.vtk")

Visualize partitioning with pyvista

import pyvista as pv
import mixdpy
import numpy as np

path_to_mesh = "tests/meshes/hypermesh2mixd_sd"
mesh = mixdpy.Mixd(path_to_mesh)
pv_cell_type = pv.CellType.TRIANGLE
n_part = 4

# Pad mesh array with 0s if necessary
coords = np.pad(mesh.mxyz, (0, 3-mesh.nsd))

# Read mipe array from mesh path (nrec, ne, 1). If nrec is 1 the dimension is NOT collapsed.
partitioning_array = mesh.read_elem_int(mesh.path / f"mipe.{n_part:04d}")

out_mesh = pv.UnstructuredGrid({pv_cell_type:mesh.mien}, coords)

out_mesh.cell_data[f"Partitoning {n_part}"] = partitioning_array[0] 

out_mesh.plot(show_edges=True)

Metadata

Release files for mixdpy 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mixdpy 0.4.1
File Size Uploaded Provenance Actions
mixdpy-0.4.1.tar.gz 457.3 kB Without provenance Details for mixdpy-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mixdpy 0.4.1
File Interpreter ABI Platform Actions
mixdpy-0.4.1-py3-none-any.whl Python 3 none any Details for mixdpy-0.4.1-py3-none-any.whl

Total release size: 466.7 kB

Release files / mixdpy-0.4.1.tar.gz

Download URL mixdpy-0.4.1.tar.gz
Size 457.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8d158177a4d14164964f7f6d377de45ddb4ed6637c31c8c33ee1801b15d316e9
BLAKE2b-256 checksum
How to use checksums
ee11872e8e5e986e3cad47d0f5a0a5736c478667bc09f2445a111f818b9131a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mixdpy-0.4.1-py3-none-any.whl

Download URL mixdpy-0.4.1-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02fa83788b1c56ffabc2f392cfa86a67650a1aa9dde17e2b49403d5c77df92ce
BLAKE2b-256 checksum
How to use checksums
f9a3570a7efda0a3399dc8ccc32f97b5023ba68aaa9334abd0684b19d648af2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for mixdpy 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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