๐Ÿท๏ธ Typing (foamlib.typing)๏ƒ

Standard types๏ƒ

The following are aliases of the primary types used throughout foamlib to represent the equivalent OpenFOAM data structures.

ๆณจ้‡ˆ

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.

dict[str, Data | Dict]ใฎๅˆฅๅใงใ™ใ€‚

foamlib.typing.KeywordEntry๏ƒ

An OpenFOAM keyword entry (i.e., a key-value pair).

tuple[DataEntry, Data | Dict]ใฎๅˆฅๅใงใ™ใ€‚

foamlib.typing.List๏ƒ

An OpenFOAM list.

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.

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.

Mapping[str, DataLike | DictLike]ใฎๅˆฅๅใงใ™ใ€‚

foamlib.typing.KeywordEntryLike๏ƒ

Any 2-tuple that could be interpreted as a KeywordEntry.

tuple[DataEntryLike, Data | DictLike]ใฎๅˆฅๅใงใ™ใ€‚

foamlib.typing.ListLike๏ƒ

Any sequence that could be interpreted as a List.

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.