fedoo.ProblemDataSet.get_data
- ProblemDataSet.get_data(field, *args, **kwargs)
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. Scalar data, including global DOF arrays, have no mesh association:
data_typeis ignored and their stored value indices are preserved.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.