fedoo.MultiMeshData
- class MultiMeshData(mesh: MultiMesh, data, active_submesh=0)
Array-like data container associated with a
MultiMesh.MultiMeshDatastores one optional data block per ordered submesh of aMultiMesh. It is returned byDataSet.get_data()for element and Gauss point fields attached to aMultiMesh. The object behaves like the data block of its active submesh when converted to a NumPy array or indexed directly, while still allowing explicit submesh selection.Submeshes may be selected by integer id, submesh name, element type, or a list combining these selectors:
>>> data = dataset.get_data("Stress", "XX") >>> data.active # data for dataset.active_submesh >>> data.submesh(1) # data for submesh id 1 >>> data.submesh("tri3") # data for all tri3 submeshes >>> data.global_element_value(42) # value for global element 42 >>> data.global_element_values([3, 18, 42])
- Parameters:
mesh (MultiMesh) – Mesh defining the ordered submeshes.
data (dict, sequence, MultiMeshData or array-like) – Data to associate with submeshes. Dictionaries may use integer submesh ids, submesh names, or unique element types as keys. A sequence must have one entry per submesh. A plain array is attached only to the active submesh.
active_submesh (int or str, default=0) – Submesh used when
MultiMeshDatais accessed as an array.
Notes
Missing submesh data are stored as
None.to_globalconcatenates selected submesh blocks in mesh order and fills missing blocks withfill_value. Global element ids use that same concatenated order.NumPy-style access, including
np.asarray(data)anddata[...], intentionally applies to the active submesh only. Useto_global()orglobal_element_value(s)when working with global element ids.- __init__(mesh: MultiMesh, data, active_submesh=0) None
Methods
MultiMeshData.global_element_id(submesh_id, ...)Return the global element id for a submesh-local element id.
MultiMeshData.global_element_location(element_id)Return
(submesh_id, local_element_id)for a global element id.MultiMeshData.global_element_value(element_id)Return the value attached to one global element id.
MultiMeshData.global_element_values(element_ids)Return values attached to several global element ids.
(submesh_id, data_block)pairs for submeshes that hold data.Submesh ids that hold a (non-empty) data block.
MultiMeshData.map(func)Return a new
MultiMeshDatawithfuncapplied to each non-empty submesh block.MultiMeshData.submesh(selector)Return data associated with one submesh or a filtered view.
MultiMeshData.to_global([indices, fill_value])Concatenate per-submesh data in the selected submesh order.
Data block of the currently active submesh (see
active_submesh).Number of dimensions of the active submesh block only.
Shape of the active submesh block only (not the whole MultiMesh).