π·οΈ Typing (foamlib.typing)ο
Standard typesο
The following are aliases of the primary types used throughout foamlib to represent the equivalent OpenFOAM data structures.
Note
For concrete classes in foamlib that represent files and some stored data types (like foamlib.Dimensioned), see the foamlib.FoamFile section.
- foamlib.typing.SubDict: TypeAlias = dict[str, 'Data | SubDict | None'] | multicollections.MultiDict[str, 'Data | SubDict | None']ο
An OpenFOAM dictionary nested in a file.
- foamlib.typing.Data: TypeAlias = str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | tuple[str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]], str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]], typing.Unpack[tuple[str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]], ...]]]ο
A single OpenFOAM value, or multiple values as a tuple.
- foamlib.typing.StandaloneData: TypeAlias = str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | numpy.ndarray[tuple[int], numpy.dtype[numpy.int64 | numpy.int32 | numpy.float64]] | numpy.ndarray[tuple[int, typing.Literal[3]], numpy.dtype[numpy.float64 | numpy.float32]] | list[numpy.ndarray[tuple[typing.Literal[3, 4]], numpy.dtype[numpy.int64]]] | tuple[str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | numpy.ndarray[tuple[int], numpy.dtype[numpy.int64 | numpy.int32 | numpy.float64]] | numpy.ndarray[tuple[int, typing.Literal[3]], numpy.dtype[numpy.float64 | numpy.float32]] | list[numpy.ndarray[tuple[typing.Literal[3, 4]], numpy.dtype[numpy.int64]]], str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | numpy.ndarray[tuple[int], numpy.dtype[numpy.int64 | numpy.int32 | numpy.float64]] | numpy.ndarray[tuple[int, typing.Literal[3]], numpy.dtype[numpy.float64 | numpy.float32]] | list[numpy.ndarray[tuple[typing.Literal[3, 4]], numpy.dtype[numpy.int64]]], typing.Unpack[tuple[str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | numpy.ndarray[tuple[int], numpy.dtype[numpy.int64 | numpy.int32 | numpy.float64]] | numpy.ndarray[tuple[int, typing.Literal[3]], numpy.dtype[numpy.float64 | numpy.float32]] | list[numpy.ndarray[tuple[typing.Literal[3, 4]], numpy.dtype[numpy.int64]]], ...]]]ο
One or more OpenFOAM values that can appear at the top level of a file.
- foamlib.typing.DataEntry: TypeAlias = str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]]ο
A single OpenFOAM value.
- foamlib.typing.StandaloneDataEntry: TypeAlias = str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | numpy.ndarray[tuple[int], numpy.dtype[numpy.int64 | numpy.int32 | numpy.float64]] | numpy.ndarray[tuple[int, typing.Literal[3]], numpy.dtype[numpy.float64 | numpy.float32]] | list[numpy.ndarray[tuple[typing.Literal[3, 4]], numpy.dtype[numpy.int64]]]ο
A single OpenFOAM value that can appear at the top level of a file.
- foamlib.typing.Dictο
An OpenFOAM dictionary.
alias of
dict[str, Data | Dict]
- foamlib.typing.KeywordEntryο
An OpenFOAM keyword entry (i.e., a key-value pair).
alias of
tuple[DataEntry, Data | Dict]
- foamlib.typing.Listο
An OpenFOAM list.
alias of
list[DataEntry | KeywordEntry | Dict]
- foamlib.typing.Field: TypeAlias = float | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]]ο
An OpenFOAM field of scalars, vectors, symmetric tensors, or full tensors.
- foamlib.typing.Tensor: TypeAlias = float | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]]ο
An OpenFOAM scalar, vector, symmetric tensor, or full tensor.
Other accepted typesο
These βLikeβ type variants accept the standard type plus other formats that could potentially be converted to the standard type.
- foamlib.typing.SubDictLikeο
Any mapping that could be interpreted as a
SubDict.alias of
Mapping[str, DataLike | SubDictLike | None]
- foamlib.typing.DataLike: TypeAlias = str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | numbers.Integral | numbers.Real | collections.abc.Sequence[int | float] | collections.abc.Sequence['DataEntryLike | KeywordEntryLike | DictLike'] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]] | collections.abc.Sequence[float | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | numbers.Real | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]]] | tuple[str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | numbers.Integral | numbers.Real | collections.abc.Sequence[int | float] | collections.abc.Sequence['DataEntryLike | KeywordEntryLike | DictLike'] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]] | collections.abc.Sequence[float | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | numbers.Real | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]]], str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | numbers.Integral | numbers.Real | collections.abc.Sequence[int | float] | collections.abc.Sequence['DataEntryLike | KeywordEntryLike | DictLike'] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]] | collections.abc.Sequence[float | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | numbers.Real | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]]], typing.Unpack[tuple[str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | numbers.Integral | numbers.Real | collections.abc.Sequence[int | float] | collections.abc.Sequence['DataEntryLike | KeywordEntryLike | DictLike'] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]] | collections.abc.Sequence[float | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | numbers.Real | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]]], ...]]]ο
Any type that could be interpreted as a
Data.
- foamlib.typing.StandaloneDataLike: TypeAlias = str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | numpy.ndarray[tuple[int], numpy.dtype[numpy.int64 | numpy.int32 | numpy.float64]] | numpy.ndarray[tuple[int, typing.Literal[3]], numpy.dtype[numpy.float64 | numpy.float32]] | list[numpy.ndarray[tuple[typing.Literal[3, 4]], numpy.dtype[numpy.int64]]] | numbers.Integral | numbers.Real | collections.abc.Sequence[int | float] | collections.abc.Sequence['DataEntryLike | KeywordEntryLike | DictLike'] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]] | collections.abc.Sequence[float | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | numbers.Real | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]]] | collections.abc.Sequence[int] | collections.abc.Sequence[float] | collections.abc.Sequence[numpy.ndarray[tuple[typing.Literal[3]], numpy.dtype[numpy.floating]]] | collections.abc.Sequence[numpy.ndarray[tuple[typing.Literal[3, 4]], numpy.dtype[numpy.integer]]] | collections.abc.Sequence[collections.abc.Sequence[int]] | tuple[str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | numpy.ndarray[tuple[int], numpy.dtype[numpy.int64 | numpy.int32 | numpy.float64]] | numpy.ndarray[tuple[int, typing.Literal[3]], numpy.dtype[numpy.float64 | numpy.float32]] | list[numpy.ndarray[tuple[typing.Literal[3, 4]], numpy.dtype[numpy.int64]]] | numbers.Integral | numbers.Real | collections.abc.Sequence[int | float] | collections.abc.Sequence['DataEntryLike | KeywordEntryLike | DictLike'] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]] | collections.abc.Sequence[float | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | numbers.Real | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]]] | collections.abc.Sequence[int] | collections.abc.Sequence[float] | collections.abc.Sequence[numpy.ndarray[tuple[typing.Literal[3]], numpy.dtype[numpy.floating]]] | collections.abc.Sequence[numpy.ndarray[tuple[typing.Literal[3, 4]], numpy.dtype[numpy.integer]]] | collections.abc.Sequence[collections.abc.Sequence[int]], str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | numpy.ndarray[tuple[int], numpy.dtype[numpy.int64 | numpy.int32 | numpy.float64]] | numpy.ndarray[tuple[int, typing.Literal[3]], numpy.dtype[numpy.float64 | numpy.float32]] | list[numpy.ndarray[tuple[typing.Literal[3, 4]], numpy.dtype[numpy.int64]]] | numbers.Integral | numbers.Real | collections.abc.Sequence[int | float] | collections.abc.Sequence['DataEntryLike | KeywordEntryLike | DictLike'] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]] | collections.abc.Sequence[float | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | numbers.Real | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]]] | collections.abc.Sequence[int] | collections.abc.Sequence[float] | collections.abc.Sequence[numpy.ndarray[tuple[typing.Literal[3]], numpy.dtype[numpy.floating]]] | collections.abc.Sequence[numpy.ndarray[tuple[typing.Literal[3, 4]], numpy.dtype[numpy.integer]]] | collections.abc.Sequence[collections.abc.Sequence[int]], typing.Unpack[tuple[str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | numpy.ndarray[tuple[int], numpy.dtype[numpy.int64 | numpy.int32 | numpy.float64]] | numpy.ndarray[tuple[int, typing.Literal[3]], numpy.dtype[numpy.float64 | numpy.float32]] | list[numpy.ndarray[tuple[typing.Literal[3, 4]], numpy.dtype[numpy.int64]]] | numbers.Integral | numbers.Real | collections.abc.Sequence[int | float] | collections.abc.Sequence['DataEntryLike | KeywordEntryLike | DictLike'] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]] | collections.abc.Sequence[float | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | numbers.Real | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]]] | collections.abc.Sequence[int] | collections.abc.Sequence[float] | collections.abc.Sequence[numpy.ndarray[tuple[typing.Literal[3]], numpy.dtype[numpy.floating]]] | collections.abc.Sequence[numpy.ndarray[tuple[typing.Literal[3, 4]], numpy.dtype[numpy.integer]]] | collections.abc.Sequence[collections.abc.Sequence[int]], ...]]]ο
Any type that could be interpreted as a
StandaloneData.
- foamlib.typing.DataEntryLike: TypeAlias = str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | numbers.Integral | numbers.Real | collections.abc.Sequence[int | float] | collections.abc.Sequence['DataEntryLike | KeywordEntryLike | DictLike'] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]] | collections.abc.Sequence[float | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | numbers.Real | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]]]ο
Any type that could be interpreted as a
DataEntry.
- foamlib.typing.StandaloneDataEntryLike: TypeAlias = str | int | float | bool | foamlib._files.types.Dimensioned | foamlib._files.types.DimensionSet | list['DataEntry | KeywordEntry | Dict'] | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | numpy.ndarray[tuple[int], numpy.dtype[numpy.int64 | numpy.int32 | numpy.float64]] | numpy.ndarray[tuple[int, typing.Literal[3]], numpy.dtype[numpy.float64 | numpy.float32]] | list[numpy.ndarray[tuple[typing.Literal[3, 4]], numpy.dtype[numpy.int64]]] | numbers.Integral | numbers.Real | collections.abc.Sequence[int | float] | collections.abc.Sequence['DataEntryLike | KeywordEntryLike | DictLike'] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]] | collections.abc.Sequence[float | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | numbers.Real | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]]] | collections.abc.Sequence[int] | collections.abc.Sequence[float] | collections.abc.Sequence[numpy.ndarray[tuple[typing.Literal[3]], numpy.dtype[numpy.floating]]] | collections.abc.Sequence[numpy.ndarray[tuple[typing.Literal[3, 4]], numpy.dtype[numpy.integer]]] | collections.abc.Sequence[collections.abc.Sequence[int]]ο
Any type that could be interpreted as a
StandaloneDataEntry.
- foamlib.typing.DictLikeο
Any mapping that could be interpreted as a
Dict.alias of
Mapping[str, DataLike | DictLike]
- foamlib.typing.KeywordEntryLikeο
Any 2-tuple that could be interpreted as a
KeywordEntry.alias of
tuple[DataEntryLike, Data | DictLike]
- foamlib.typing.ListLikeο
Any sequence that could be interpreted as a
List.alias of
Sequence[DataEntryLike | KeywordEntryLike | DictLike]
- foamlib.typing.FieldLike: TypeAlias = float | numpy.ndarray[tuple[int] | tuple[int, typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating]] | numbers.Real | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]] | collections.abc.Sequence[float | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | numbers.Real | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]]]ο
Any type that could be interpreted as a
Field.
- foamlib.typing.TensorLike: TypeAlias = float | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.float64]] | numbers.Real | collections.abc.Sequence[float | numbers.Real] | numpy.ndarray[tuple[typing.Literal[3, 6, 9]], numpy.dtype[numpy.floating | numpy.integer]]ο
Any type that could be interpreted as a
Tensor.
- foamlib.typing.DimensionSetLike: TypeAlias = foamlib._files.types.DimensionSet | collections.abc.Sequence[int | float]ο
Any type that could be interpreted as a
foamlib.DimensionSet.