fgen.wrapping_strategies.receiving_from_python_steps#
Data model for how we receive data from Python in Fortran
ReceivingFromPythonSteps#
- class ReceivingFromPythonSteps(postprocessing_fortran_calls, fortran_wrapper_callable_parameters, fortran_module_callable_args, fortran_helper_variables=_Nothing.NOTHING)[source]#
Bases:
object
Container for holding the steps required to receive data from Python
-
fortran_helper_variables:
tuple
[tuple
[str
,str
],...
]# Helper variables required to pass the value from Python to Fortran
The first element of each tuple is the helper variable’s name, the second element is its type declaration.
-
fortran_module_callable_args:
tuple
[typing.Union
[fgen.data_models.multi_return.MultiReturn
,fgen.data_models.value.Value
],...
]# Arguments to pass to the (original) Fortran module callable
These just take the data model of the (original) Fortran module callable’s argument. Hence these must match what is expected by the Fortran module exactly, there can be no different naming, types etc. (different types wouldn’t compile anyway, avoiding different names is done for clarity and simplicity).
- property fortran_module_callable_args_names: list[str]#
Argument list to use when calling a callable in the (original) Fortran module
Note that this may not be the entire argument list, it is only the calls for the arguments managed by
self
.
- property fortran_wrapper_callable_parameter_names: list[str]#
Names of the Fortran wrapper callable’s parameters
Note that this may not be the entire parameter list, it is only the calls for the parameters managed by
self
.
-
fortran_wrapper_callable_parameters:
tuple
[tuple
[str
,str
,typing.Union
[fgen.data_models.multi_return.MultiReturn
,fgen.data_models.value.Value
]],...
]# Parameters of the Fortran wrapper callable
The first element of each tuple is the parameter name as it appears in the declaration of the Fortran wrapper callable. The second element of each tuple is the type used when passing this variable to Fortran (which may differ from the variable type in Fortran). The third element of each tuple is the data model of the parameter, which makes it available for docstrings etc.
- property not_directly_passed_fortran_module_callable_args: list[Union[fgen.data_models.multi_return.MultiReturn, fgen.data_models.value.Value]]#
Fortran module callable arguments that aren’t directly passed from Python
These arguments will have intermediate steps, hence the arguments need to be declared as variables separately from the callable parameter declarations.
Note that this is only for the arguments managed by
self
, not necessarily all arguments of the callable.
- property not_directly_passed_fortran_module_callable_args_type_declarations: list[tuple[str, str]]#
Type declarations for the argument list that aren’t directly passed from Python.
These type declarations are only required because these arguments for the (original) Fortran callable cannot be directly passed from Python, i.e. these arguments are not parameters of the wrapper module’s callable (i.e. would otherwise be undefined).
The first element of each returned tuple is the argument’s name, the second is the type declaration.
The argument list is the argument list that is used when calling a callable in the (original) Fortran module.
Note that this may not be the entire argument list, it is only the calls for the arguments managed by
self
.
-
postprocessing_fortran_calls:
typing.Optional
[str
]# Calls required to process the data received from Python
-
fortran_helper_variables:
get_type_declaration_for_passing_value_to_fortran_callable#
- get_type_declaration_for_passing_value_to_fortran_callable(value)[source]#
Get the type declaration for
value
when passing to the (original) Fortran.This is the type expected by the (original) Fortran when receiving
value
as an argument to callables.- Parameters:
value (
typing.Union
[fgen.data_models.multi_return.MultiReturn
,fgen.data_models.value.Value
]) – Value for which to get the type declaration- Returns:
str
– The type declaration forvalue