High-Performance and Thread-Safe library for parsing binary output files and key files of LS Dyna (d3plot, binout, input deck)
Project description
dynareadout
High-Performance and Thread-Safe C/C++ library for parsing binary output files and key files of LS Dyna (d3plot, binout, input deck) with bindings for python.
Documentation
You can find a Wiki with API Documentation for python.
Examples
Binout
from dynareadout import Binout
bin_file = None
try:
# This library also supports opening multiple binout files at once by globing them
bin_file = Binout("path/to/your/binout*")
except RuntimeError as e:
print("Failed to open binout: {}".format(e))
exit(1)
# Print the children of the binout
children = bin_file.read()
for (i, child) in enumerate(children):
print("Child {}: {}".format(i, child))
# Read some data. This method can read variables of all different types
node_ids = bin_file.read("nodout/ids")
for i in range(len(node_ids)):
print("Node ID {}: {}".format(i, node_ids[i]))
# You can also find out if a variable exists
node_ids_exist = bin_file.variable_exists("nodout/ids")
# Get the number of time steps in the binout
nodout_timesteps = bin_file.get_num_timesteps("nodout")
# The time steps can vary inside the binout
rcforc_timesteps = bin_file.get_num_timesteps("rcforc")
# If you want to read "timed" data (x_displacement, x_force, etc.) you can do so also with the read method
x_displacement = bin_file.read("nodout/x_displacement")
for (t, time_step) in enumerate(x_displacement):
for (n, x_disp) in enumerate(time_step):
print("X Displacement time_step={}, node_id={}: {}".format(t, node_ids[n], x_displacement[t][n]))
D3plot
from dynareadout import D3plot
plot_file = None
try:
# Just give it the first d3plot file and it opens all of them
plot_file = D3plot("path/to/your/d3plot")
except RuntimeError as e:
print("Failed to open: {}".format(e))
exit(1)
# Read the title
title = plot_file.read_title()
print("Title: {}".format(title))
# Read node ids
node_ids = plot_file.read_node_ids()
print("Nodes: {}".format(len(node_ids)))
for (i, nid) in enumerate(node_ids):
print("Node {}: {}".format(i, nid))
# Read node coordinates of time step 10
node_coords = plot_file.read_node_coordinates(10)
for i in range(len(node_coords)):
print("Node Coords {}: ({:.2f}, {:.2f}, {:.2f})".format(i, node_coords[i][0], node_coords[i][1], node_coords[i][2]))
KeyFile
from dynareadout import key_file_parse
keywords = key_file_parse("path/to/your/input.k")
# Parse all nodes
node_keywords = keywords["NODE"]
# Loop over all *NODE keywords
for i in range(len(node_keywords)):
# Loop over all cards of each *NODE keyword
for j in range(len(node_keywords[i])):
node = node_keywords[i][j]
# Then you can parse the variables of each card as integers and floats
# The list of integers holds all the widths of each variable in the card in characters
nid, x, y, z = node.parse_whole([8, 16, 16, 16])
print(f"NODE {nid:d}: ({x:.3f}; {y:.3f}; {z:.3f})")
Other languages
This library is also available for C and C++ this version can be found here.
Installation
python -m pip install dynareadout
Uploading to PyPI
-
Make sure that the dynareadout submodule has the correct version
-
Update the version in
setup.py
andpyproject.toml
. Also check if new source files have been added -
Publish a new release
-
Create source distribution
python setup.py sdist
- Upload to
test.pypi.org
python -m twine upload --repository testpypi dist/*
Then insert __token__
as username and the token as password.
- Install package from
test.pypi.org
to test it
python -m pip install --upgrade --no-build-isolation --index-url https://test.pypi.org/simple/ dynareadout
-
If it works upload it to
pypi.org
-
Create windows wheel
python -m build
-
Upload windows wheel to
test.pypi.org
and test it. -
If it works upload it to
pypi.org
python -m twine upload dist/*
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
Built Distributions
Hashes for dynareadout-24.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2977a1863ef3a8ce44bd2aa5f013c077710cf43bff13f8fff596f51744cc014a |
|
MD5 | 5000379803a0312824073c24554ec5c6 |
|
BLAKE2b-256 | 4edd7d2021aaefebbbf0084e7d263c0240ca167763c90c64561c6699cf6d64ca |
Hashes for dynareadout-24.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4b5691e6247d1444e7a5adf035f693dada30d0cec2060bf736fd405f06d9ef0 |
|
MD5 | eda6825807c4407b973e325202f7cd7b |
|
BLAKE2b-256 | cf25c1a81ad3b617117f876d2179ba07d6cbae8bd6749aa3716b5947b8d06ff5 |
Hashes for dynareadout-24.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 512825b0b8e483af244531d3032fe000cd02c2ff4624857091a396da1ed16951 |
|
MD5 | df3925b954a77e7e0a4b55f7ca21315c |
|
BLAKE2b-256 | 1dedb4538fbfef19ec83e76dcf410719da7da025e08a7d6315c3e8a261c3969a |
Hashes for dynareadout-24.1-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8f483dd1f0a1e346c6579c738542e5fb6254f7111f0b1a1706e700ba1c1bba0 |
|
MD5 | 741d86ed46d60cd0d1c76dc99a4fd324 |
|
BLAKE2b-256 | a16e71933116e01c7d60622cd7aaa541757bc7cc17acdecf45d7334658660ccf |
Hashes for dynareadout-24.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 690fd4f71b35810b21344b734e9c9e4eb3d5178c76408f55b6222df4d6aecc60 |
|
MD5 | 1166f937d5c3119e03c1b72b6e26884a |
|
BLAKE2b-256 | 890323bae014433acc2a90b38742d181f32a8200a0fc1a895cba56a0767808a8 |
Hashes for dynareadout-24.1-cp312-cp312-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13dcaa971562fcbe315175b200935ff73ceab0b9e52ee6747bcdbfb0003c7f73 |
|
MD5 | 91253a442afca18afecb3528c968d057 |
|
BLAKE2b-256 | dee20e3155f950c7058c9c4b196160fbaa84f945dfd559eb1458f1f0c5445547 |
Hashes for dynareadout-24.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab3dc8a3d8765f3d588688badb87d07e633533d5fc206fbbe4a8c76714b7d61e |
|
MD5 | 12b6af27e5d2b3c24c0406fa6a5d1c7f |
|
BLAKE2b-256 | b558531c71e7027883de75fe245f925d777a4946ba3b7e97f9d6ec3258f01a5f |
Hashes for dynareadout-24.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb2b30426953beb48d94e5b196d73f4a57e2dd76cce4c230a65df0f195bcff76 |
|
MD5 | aeacbef93ba84b4c189f4875a505646b |
|
BLAKE2b-256 | e8182b66624a8a4ed37c7d713e12c116984ae2b4d94b9bf490b37f09c353fe77 |
Hashes for dynareadout-24.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76803409e5e97afe311bbbb2f106968aa51c427e7e935b9d0b3c33246c715f15 |
|
MD5 | afee1a5569c8c9e2a384fd07c3c09674 |
|
BLAKE2b-256 | 826cf62ae5645acbaf04de04831d3d11088014f01b2d1deaf931f41ffc67195c |
Hashes for dynareadout-24.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c939d4a47c50140e0981e3a669ccd5648dea00412f3f03f13af80bd0acc9f27b |
|
MD5 | e8de3bf050b1052fe64fc6041255f99d |
|
BLAKE2b-256 | 5d2976a62abe3622dd76a10b682c595cdc200c0163a9286346a2c205a31f0ea8 |
Hashes for dynareadout-24.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f1d789f544356492f103aa70cc6f5292f48d5ad8a667c16b0cfd09a7bb6d4db |
|
MD5 | 2a89ea7865f5cf3b48496d52adc13d5a |
|
BLAKE2b-256 | 6422a242f0115bea200951a12bcec3d7931755edb353df01caf5d9579b0a5236 |
Hashes for dynareadout-24.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f58fc5f63a8f80c2ebcdbc0771eb8897c628839b33977ba7b892bbb33667bc2 |
|
MD5 | 47b63d914109450052b176ddba54d7d0 |
|
BLAKE2b-256 | c86717e689afada84f2597cc044513c6ce9f17c946e93fe312ab09ff38d8c89a |