Skip to main content

MIXD format mesh handler

Project description

mixdpy

Package for handling mixd meshes and associated data

pipeline status coverage report

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,
    {"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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mixdpy-0.2.3-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

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

Hashes for mixdpy-0.2.3.tar.gz
Algorithm Hash digest
SHA256 b32964a4a2782e1fd8dd3aa91ff2877c2efe6cb5f613ad998c1917b66d90b80c
MD5 11766d07b9c9bc6a0268d2339d709f28
BLAKE2b-256 08f0f4fe2a8f1214b475e6fd5b1f49516c310a7b5f73e3986aab66128cc557e6

See more details on using hashes here.

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

Hashes for mixdpy-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 16e5e802618a312b3cb6755766660d05449320a9c0133d32615dc2e10f7b216e
MD5 1d2348e92908a3a915af2f0a6c455a18
BLAKE2b-256 e0a972c325544122364e7413e7bd8c876be37f954de92137e10618768db1dbee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page