fgen.data_models.method#

Data model of a method

Method#

class Method(name, description, parameters, returns)[source]#

Bases: object

Data model of a Fortran method

This method is assumed to be part of a FortranDerivedType.

This function can have multiple parameters and a single, optional returns value.

description: str#

Description of what the function does

name: str#

Name of the function in Fortran

parameters: dict[str, fgen.data_models.value.Value]#

Collection of named parameters of the function

Currently, only ValueDefinition is supported because we assume that each parameter only refers to one value. If you think this assumption should be relaxed, please raise an issue illustrating your use case.

returns: typing.Union[fgen.data_models.value.Value, fgen.data_models.multi_return.MultiReturn]#

Return value of the function

property units: dict[str, Union[str, tuple[str, ...]]]#

Units used in the method

Includes units from of the parameters and the return value.

Raises:

ValueError – If different units are supplied for a given parameter name

Returns:

Collection of parameter names and associated units