MIXD format mesh handler
Project description
mixdpy
Package for handling mixd meshes and associated dataThis 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,
{"tetra":mesh.mien}
point_data = {
"velocity" : ins_data_out[0,:,:mesh.nsd],
"pressure" : ins_data_out[0,:,mesh.nsd]
}
)
export_mesh.write("ins.vtk")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mixdpy-0.2.3.tar.gz
(7.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mixdpy-0.2.3.tar.gz.
File metadata
- Download URL: mixdpy-0.2.3.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b32964a4a2782e1fd8dd3aa91ff2877c2efe6cb5f613ad998c1917b66d90b80c
|
|
| MD5 |
11766d07b9c9bc6a0268d2339d709f28
|
|
| BLAKE2b-256 |
08f0f4fe2a8f1214b475e6fd5b1f49516c310a7b5f73e3986aab66128cc557e6
|
File details
Details for the file mixdpy-0.2.3-py3-none-any.whl.
File metadata
- Download URL: mixdpy-0.2.3-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16e5e802618a312b3cb6755766660d05449320a9c0133d32615dc2e10f7b216e
|
|
| MD5 |
1d2348e92908a3a915af2f0a6c455a18
|
|
| BLAKE2b-256 |
e0a972c325544122364e7413e7bd8c876be37f954de92137e10618768db1dbee
|