remapping module¶
A discipline whose inputs and outputs map to those of another.
- class gemseo.disciplines.remapping.RemappingDiscipline(discipline, input_mapping, output_mapping)[source]
Bases:
MDODiscipline
A discipline whose inputs and outputs map to those of another.
An input or output name mapping looks like
{"new_x": "x", "new_y": ("y", components)}
where the variable"new_x"
corresponds to the original variable"x"
and the variable"new_y"
corresponds to somecomponents
of the original variable"y"
.components
can be an integeri
(thei
-th component ofy
), a sequence of integers[i, j, k]
(thei
-th,j
-th andk
-th components ofy
) or an iterable of integersrange(i, j+1)
(from thei
-th to thej
-th components ofy
).Initialize self. See help(type(self)) for accurate signature.
- Parameters:
discipline (MDODiscipline) – The original discipline.
input_mapping (NameMapping) – The input names to the original input names.
output_mapping (NameMapping) – The output names to the original output names.
- Raises:
ValueError – When the original discipline has no default input values.
- cache: AbstractCache | None
The cache containing one or several executions of the discipline according to the cache policy.
- data_processor: DataProcessor
A tool to pre- and post-process discipline data.
- exec_for_lin: bool
Whether the last execution was due to a linearization.
- input_grammar: BaseGrammar
The input grammar.
- jac: MutableMapping[str, MutableMapping[str, ndarray | csr_array | JacobianOperator]]
The Jacobians of the outputs wrt inputs.
The structure is
{output: {input: matrix}}
.
- name: str
The name of the discipline.
- property original_discipline: MDODiscipline
The original discipline.
- output_grammar: BaseGrammar
The output grammar.
- re_exec_policy: ReExecutionPolicy
The policy to re-execute the same discipline.
- residual_variables: dict[str, str]
The output variables mapping to their inputs, to be considered as residuals; they shall be equal to zero.
- run_solves_residuals: bool
Whether the run method shall solve the residuals.
Examples using RemappingDiscipline¶
Rename the input and output variables