gemseo / core / mdofunctions

function_generator module

A class to creat MDOFunctions from MDODisciplines.

class gemseo.core.mdofunctions.function_generator.MDOFunctionGenerator(discipline)[source]

Bases: object

Generator of MDOFunction objects from a MDODiscipline.

It creates a MDOFunction evaluating some of the outputs of the discipline from some of its

It uses closures to generate functions instances from a discipline execution.

Parameters:

discipline (MDODiscipline) – The discipline from which the generator builds the functions.

get_function(input_names, output_names, default_inputs=None, differentiable=True)[source]

Build a function from a discipline input and output lists.

Parameters:
  • input_names (Sequence[str]) – The names of the inputs of the discipline to be inputs of the function.

  • output_names (Sequence[str]) – The names of outputs of the discipline to be returned by the function.

  • default_inputs (Mapping[str, ndarray] | None) – The default values of the inputs. If None, use the default values of the inputs specified by the discipline.

  • differentiable (bool) –

    If True, then inputs and outputs are added to the variables to be differentiated.

    By default it is set to True.

Returns:

The function.

Raises:

ValueError – If a given input (or output) name is not the name of an input (or output) variable of the discipline.

Return type:

MDOFunction