fgen.data_models.multi_return#

Data model of a return value that contains multiple values

MultiReturn#

class MultiReturn(definition, unit=None, dynamic_unit=False)[source]#

Bases: object

Data model for a return type that returns more than one value

This defines the returned values’ units, Fortran data type and other metadata. It is the combination of a UnitlessValueDefinition and information about the units of each returned value.

definition: fgen.data_models.unitless_value.UnitlessValue#

Definition of the value’s key information

dynamic_unit: typing.Union[bool, str]#

Whether the units should be inferred dynamically, rather than statically

Support for this is currently not implemented. If you require this feature, please raise an issue.

property requires_units: bool#

Whether this value requires units or not

Returns:

True if this value requires units, False otherwise.

unit: typing.Optional[tuple[str, ...]]#

Units of the returned values

The units must be able to parsed by pint and be present in the pint.UnitRegistry being used by the application (normal rules for pint). Some examples include: “kg”, “1 / month”.

A unit is required for all numeric-types (i.e. integer, real, complex). For non-numeric values, the unit is unused.