fedoo.DataSet.get_data
- DataSet.get_data(field, component=None, data_type=None, return_data_type=False, *, fill_unused_nodes=0.0)
Retrieve data from the DataSet for a given field.
This method is equivalent to the DataSet.__getitem__ magic method. One may prefer to use the shorthand syntax: dataset[field, component, data_type].
- Parameters:
field (str) – Name of the data field to retrieve.
component (int, str or None, optional) – Index or label of the component to extract if the data is multi-dimensional. If None, all components are returned.
data_type (str or None, optional) – Desired data type to convert to. Can be one of ‘Node’, ‘Element’, or ‘GaussPoint’. If None, the original data type is preserved.
return_data_type (bool, optional) – If True, the method returns a tuple (data, data_type) where data_type is the type of the returned data. If False, only the data is returned.
fill_unused_nodes (scalar, optional) – Value used for nodes that are not used by the active submesh when a MultiMesh node field is restricted to one submesh. Default is 0. If
None, the original node array is returned unchanged.
- Returns:
data (np.ndarray or MultiMeshData) – The requested data, possibly converted to the specified type. For a
MultiMeshdataset, element and Gauss point fields are returned asMultiMeshDataobjects. Node fields remain NumPy arrays.data_type (str, optional) – Returned only if return_data_type is True. Indicates the type of the returned data.
Notes
This method supports automatic conversion between node, element, and Gauss point data types when applicable.
With a
MultiMesh, element and Gauss point fields may be stored as a dictionary keyed by submesh id, submesh name, or unique element type. The active submesh is controlled bydataset.active_submesh.Element ids in a
MultiMeshuse a global, concatenated numbering: all elements of submesh 0, then all elements of submesh 1, and so on. Retrieve values using those ids from the returnedMultiMeshData:stress = dataset.get_data("Stress", "vm", "Element") value = stress.global_element_value(global_element_id) values = stress.global_element_values(global_element_ids)
Use
stress.to_global()when a single NumPy array in this global order is needed.np.asarray(stress)instead returns the data of the active submesh.