gemseo.core.mdo_functions.discipline_adapter_generator module#

A class to create MDOFunction objects from an Discipline.

class DisciplineAdapterGenerator(discipline, names_to_sizes=mappingproxy({}))[source]#

Bases: object

A generator of discipline adapter.

Given a discipline, an DisciplineAdapter computes specific outputs from specific inputs.

Parameters:
  • discipline (Discipline) -- The discipline from which to generate discipline adapters.

  • names_to_sizes (MutableMapping[str, int]) --

    The sizes of the input variables. If empty, determine them from the default inputs and local data of the discipline.

    By default it is set to {}.

get_function(input_names, output_names, default_input_data=mappingproxy({}), is_differentiable=True, differentiated_input_names_substitute=())[source]#

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

Parameters:
  • input_names (Sequence[str]) -- The discipline input names defining the function input vector. If empty, use all the discipline inputs.

  • output_names (Sequence[str]) -- The discipline output names defining the function output vector. If empty, use all the discipline outputs.

  • default_input_data (Mapping[str, ndarray]) --

    The default values of the input variables. If empty, use the default input values of the discipline.

    By default it is set to {}.

  • is_differentiable (bool) --

    Whether the function is differentiable.

    By default it is set to True.

  • differentiated_input_names_substitute (Sequence[str]) --

    The names of the inputs with respect to which to differentiate the functions. If empty, use input_names. This argument is not used when is_differentiable is False.

    By default it is set to ().

Returns:

The function.

Raises:

ValueError -- When either an input name is not a discipline input name, a differentiated input name is not a discipline input name or an output name is not a discipline output name.

Return type:

DisciplineAdapter

discipline: Discipline#

The discipline from which to generate discipline adapters.