num_elements#
- Part.num_elements(rank: int | None = None) dict #
Get the number of elements of a given type in the current part.
- Parameters:
- rank
int
,optional
For a dataset using multiple ranks, the rank to return data from. The default is RankValues.SINGLE_RANK.
- rank
- Returns:
dict
A dictionary with keys being the element type and the values being the number of such elements. Element types with zero elements are not included in the dictionary.
Examples
>>> part = reader.parts()[0] >>> elements = part.elements() >>> for etype, count in elements.items(): ... print(libuserd.ElementType(etype).name, count)