spectre.IO.H5.IterElements

Functions

include_element(element_id, element_patterns)

Whether or not the 'element_id' matches any of the 'element_patterns'

iter_elements(volfiles, obs_ids[, ...])

Return volume data by element

stripped_element_name(element_id)

The element name without the leading and trailing square bracket

Classes

Element(id, mesh, map[, time, ...])

class spectre.IO.H5.IterElements.Element(id: spectre.Domain._Pybindings.ElementId1D | spectre.Domain._Pybindings.ElementId2D | spectre.Domain._Pybindings.ElementId3D, mesh: spectre.Spectral._Pybindings.Mesh1D | spectre.Spectral._Pybindings.Mesh2D | spectre.Spectral._Pybindings.Mesh3D, map: spectre.Domain.CoordinateMaps._Pybindings.CoordinateMapElementLogicalToInertial1D | spectre.Domain.CoordinateMaps._Pybindings.CoordinateMapElementLogicalToInertial2D | spectre.Domain.CoordinateMaps._Pybindings.CoordinateMapElementLogicalToInertial3D | NoneType, time: float | None = None, functions_of_time: Dict[str, spectre.Domain._Pybindings.FunctionOfTime] | None = None, data_slice: slice | None = None)
data_slice: slice | None = None
property det_jacobian
property dim
functions_of_time: Dict[str, FunctionOfTime] | None = None
id: ElementId1D | ElementId2D | ElementId3D
property inertial_coordinates
property inv_jacobian
property jacobian
property logical_coordinates
map: CoordinateMapElementLogicalToInertial1D | CoordinateMapElementLogicalToInertial2D | CoordinateMapElementLogicalToInertial3D | None
mesh: Mesh1D | Mesh2D | Mesh3D
time: float | None = None
spectre.IO.H5.IterElements.include_element(element_id: str | ElementId1D | ElementId2D | ElementId3D, element_patterns: Sequence[str] | None) bool

Whether or not the ‘element_id’ matches any of the ‘element_patterns’

The ‘element_patterns’ are interpreted as glob patterns. If ‘element_patterns’ is None, every element is included. If ‘element_patterns’ is an empty list, no element is included.

spectre.IO.H5.IterElements.iter_elements(volfiles: H5Vol | Iterable[H5Vol], obs_ids: int | Sequence[int] | None, tensor_components: Iterable[str] | None = None, element_patterns: Sequence[str] | None = None)

Return volume data by element

Parameters:
  • volfiles – Open spectre H5 volume files. Can be a single volfile or a list, but can also be an iterator that opens and closes the files on demand.

  • obs_id – An observation ID, a list of observation IDs, or None to iterate over all observation IDs.

  • tensor_components – Tensor components to retrieve. Can be empty.

  • element_patterns – If specified, include only elements that match any of these glob patterns. See ‘IterElements.include_element’ for details.

Returns: Iterator over all elements in all ‘volfiles’. Yields either just

the ‘Element’ with structural information if ‘tensor_components’ is empty, or both the ‘Element’ and an ‘np.ndarray’ with the tensor data listed in ‘tensor_components’. The tensor data has shape (len(tensor_components), num_points).

spectre.IO.H5.IterElements.stripped_element_name(element_id: str | ElementId1D | ElementId2D | ElementId3D) bool

The element name without the leading and trailing square bracket

Square brackets have special meaning in glob patterns, so it’s easier to strip them away when dealing with element names on the command line.