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.0

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.0
File Size Uploaded Provenance Actions
mixdpy-0.4.0.tar.gz 447.1 kB Without provenance Details for mixdpy-0.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 456.5 kB

Release files / mixdpy-0.4.0.tar.gz

Download URL mixdpy-0.4.0.tar.gz
Size 447.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b5ec54e96e611bd0ef45aab7942b9db4c34c5317d2d491e149852429b884742d
BLAKE2b-256 checksum
How to use checksums
003d1c6ed497d5ae37a0ea6cbc73166eacc1badcbc1b633c120a1127a8d6ccab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","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.0-py3-none-any.whl

Download URL mixdpy-0.4.0-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4677baa5c9b7956295d43dd3d3621b4bd350e68f17acf3732dc2215d2960a57
BLAKE2b-256 checksum
How to use checksums
04951b2529fe67f6699c94b3bf9d9945b5dae0a005902cf648390fded8a357ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","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.0

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