gemseo / core / mdofunctions

Hide inherited members

mdo_discipline_adapter_generator module

A class to create MDOFunction objects from an MDODiscipline.

class gemseo.core.mdofunctions.mdo_discipline_adapter_generator.MDODisciplineAdapterGenerator(discipline, names_to_sizes=None)[source]

Bases: object

Generator of MDOFunction objects executing an MDODiscipline.

It creates an MDODisciplineAdapter evaluating some of the outputs of the discipline from some of its

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

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

  • names_to_sizes (MutableMapping[str, int] | None) – The sizes of the input variables. If None, guess them from the default inputs and local data of the discipline MDODiscipline.

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

Build a function executing a discipline for some inputs and outputs.

  • 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.


The function.


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

Return type:


discipline: MDODiscipline

The discipline from which to generate functions.