gemseo.disciplines.utils module#
A set of functions to handle disciplines.
- check_disciplines_consistency(disciplines, log_message, raise_error)[source]#
Check if disciplines are consistent.
The disciplines are consistent if each output is computed by one and only one discipline.
- Parameters:
disciplines (Iterable[Discipline]) -- The disciplines of interest.
log_message (bool) -- Whether to log a message when the disciplines are not consistent.
raise_error (bool) -- Whether to raise an error when the disciplines are not consistent.
- Returns:
Whether the disciplines are consistent.
- Raises:
ValueError -- When two disciplines compute the same output and
raise_error
isTrue
.- Return type:
- get_all_inputs(disciplines, skip_scenarios=True)[source]#
Return all the input names of the disciplines.
- Parameters:
disciplines (Iterable[Discipline]) -- The disciplines including potentially
Scenario
objects.skip_scenarios (bool) --
If
True
, skip theScenario
objects. Otherwise, consider their disciplines.By default it is set to True.
- Returns:
The names of the inputs.
- Return type:
- get_all_outputs(disciplines, skip_scenarios=True)[source]#
Return all the output names of the disciplines.
- Parameters:
disciplines (Iterable[Discipline | BaseScenario]) -- The disciplines including potentially
Scenario
objects.skip_scenarios (bool) --
If
True
, skip theScenario
objects. Otherwise, consider their disciplines.By default it is set to True.
- Returns:
The names of the outputs.
- Return type:
- get_sub_disciplines(disciplines, recursive=False)[source]#
Determine the sub-disciplines.
This method lists the sub-disciplines' disciplines. It will list up to one level of disciplines contained inside another one unless the
recursive
argument is set toTrue
.- Parameters:
disciplines (Iterable[Discipline]) -- The disciplines from which the sub-disciplines will be determined.
recursive (bool) --
If
True
, the method will look inside any discipline that has other disciplines inside until it reaches a discipline without sub-disciplines, in this case the return value will not include any discipline that has sub-disciplines. IfFalse
, the method will list up to one level of disciplines contained inside another one, in this case the return value may include disciplines that contain sub-disciplines.By default it is set to False.
- Returns:
The sub-disciplines.
- Return type: