D3plot


class lasso.dyna.D3plot.D3plot(filepath: str = None, use_femzip: bool = False, n_files_to_load_at_once=-1, state_array_filter=None)

Constructor for a D3plot

Parameters
filepathstr

path to a d3plot file

use_femzipbool

whether to use femzip decompression

n_files_to_load_at_onceint

number of d3plot files to load into memory at once. By default -1 means all are loaded

state_array_filterlist of str or None

names of arrays which will be the only ones loaded from state data

Notes
—–

If dyna wrote multiple files for several states, only give the path to the first file.

Attributes
arrays

Dictionary holding all d3plot arrays

header

Dictionary holding all d3plot header information

Methods

compare(self, d3plot2)

Compare two d3plots and print the info

enable_logger(enable)

Enable the logger for this class

plot(self, i_timestep[, field])

Plot the d3plot geometry

write_d3plot(self, filepath, block_size_bytes)

Write a d3plot file again

__init__(self, filepath: str = None, use_femzip: bool = False, n_files_to_load_at_once=-1, state_array_filter=None)

Constructor for a D3plot

Parameters
filepathstr

path to a d3plot file

use_femzipbool

whether to use femzip decompression

n_files_to_load_at_onceint

number of d3plot files to load into memory at once. By default -1 means all are loaded

state_array_filterlist of str or None

names of arrays which will be the only ones loaded from state data

Notes
—–

If dyna wrote multiple files for several states, only give the path to the first file.

property arrays

Dictionary holding all d3plot arrays

Notes

The corresponding keys of the dictionary can also be found in lasso.dyna.ArrayTypes, which helps with IDE integration and code safety.

Examples

>>> d3plot = D3plot("some/path/to/d3plot")
>>> d3plot.arrays.keys()
dict_keys(['irbtyp', 'node_coordinates', ...])
>>> # The following is good coding practice
>>> import lasso.dyna.ArrayTypes.ArrayTypes as atypes
>>> d3plot.arrays[atypes.node_displacmeent].shape
compare(self, d3plot2)

Compare two d3plots and print the info

Parameters
d3plot2D3plot

second d3plot

Returns
hdr_differencesdict

differences in the header

array_differencesdict

difference between arrays (number of non-matching elements)

static enable_logger(enable: bool)

Enable the logger for this class

Parameters
enablebool

whether to enable logging for this class

property header

Dictionary holding all d3plot header information

Notes

The header contains many informations such as number of elements, etc. The names are the original dyna names, thus sometimes confusing … but that’s dyna.

Examples

>>> d3plot = D3plot("some/path/to/d3plot")
>>> d3plot.header
dict_keys(['title', 'runtime', 'filetype', 'source_version', ...])
>>> # number of shells
>>> d3plot.header['nel4']
85624
plot(self, i_timestep: int = 0, field=None, is_element_field: bool = True)

Plot the d3plot geometry

Parameters
i_timestepint

timestep index to plot

fieldnp.ndarray

Array containing a field value for every element

Notes

Currently only shell elements can be plotted, since for solids the surface needs extraction.

write_d3plot(self, filepath: str, block_size_bytes: int = 2048)

Write a d3plot file again

Parameters
filepathstr

filepath of the new d3plot file

block_size_bytesint

D3plots are originally written in byte-blocks causing zero-padding at the end of files. This can be controlled by this parameter. Set to 0 for no padding.