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

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

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.3.2
File Size Uploaded
mixdpy-0.3.2.tar.gz 443.8 kB Details

Built distribution (wheel)

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

Total release size: 451.4 kB

Release files / mixdpy-0.3.2.tar.gz

Download URL mixdpy-0.3.2.tar.gz
Size 443.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a42048e7620f60cda61bf6d9642a143b0aae7a37cb4493b16a2b63f766cfa179
BLAKE2b-256 checksum
How to use checksums
a7387363d160900fd5a3dca2985fff62d3596411c9365e52055cbf7620c2abeb
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.3.2-py3-none-any.whl

Download URL mixdpy-0.3.2-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8404deb158f715a2c76f785ab0343a381fadfde40752dc33ceb92348eaa3dce3
BLAKE2b-256 checksum
How to use checksums
14c20849dc3c33a8e545f63d51c9cdede1faa3d0e2c8cdafcbe9dbace7439503
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 history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

1 release file

0.2.3

2 release files

0.2.2

2 release 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