Skip to content

Commit

Permalink
Fix component names
Browse files Browse the repository at this point in the history
  • Loading branch information
janvonrickenbach committed Aug 29, 2024
1 parent 138bf37 commit 0ebc88e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/ansys/dpf/post/result_workflows/_build_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class _MeshWorkflowInputs:
@dataclasses.dataclass
class _ComponentExtractorWorkflowInputs:
components_to_extract: list[int]
component_names: list[str]


@dataclasses.dataclass
Expand Down Expand Up @@ -174,6 +175,7 @@ def _create_result_workflows_impl(
) = _create_extract_component_workflow(
create_operator_callable=create_operator_callable,
components_to_extract=component_extractor_workflow_inputs.components_to_extract,
component_names=component_extractor_workflow_inputs.component_names,
base_name=base_name,
server=server,
)
Expand Down Expand Up @@ -252,7 +254,8 @@ def _create_result_workflows(
] = None
if should_extract_components:
component_extractor_workflow_inputs = _ComponentExtractorWorkflowInputs(
components_to_extract=components_to_extract
components_to_extract=components_to_extract,
component_names=components_out,
)

sweeping_phase_workflow_inputs: Optional[_SweepingPhaseWorkflowInputs] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ def _connect_initial_results_inputs(
force_elemental_nodal: bool,
location: str,
selection: Selection,
data_sources: Any,
streams_provider: Any,
expand_cyclic: bool,
phase_angle_cyclic: Any,
mesh: MeshedRegion,
streams_provider: Any,
data_sources: Any,
):
initial_result_workflow.connect_with(
selection.spatial_selection._selection,
Expand All @@ -93,7 +93,10 @@ def _connect_initial_results_inputs(

# Connect data_sources and streams_container inputs of selection if necessary
# Todo: was this working before?
if "streams" in initial_result_workflow.input_names:
if (
"streams" in initial_result_workflow.input_names
and streams_provider is not None
):
initial_result_workflow.connect("streams", streams_provider)
if "data_sources" in initial_result_workflow.input_names:
initial_result_workflow.connect("data_sources", data_sources)
Expand Down
3 changes: 2 additions & 1 deletion src/ansys/dpf/post/result_workflows/_sub_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def _create_mesh_workflow(mesh_provider: Any, server):
def _create_extract_component_workflow(
create_operator_callable: _CreateOperatorCallable,
components_to_extract: list[int],
component_names: list[str],
base_name: str,
server,
):
Expand All @@ -143,7 +144,7 @@ def _create_extract_component_workflow(

result_is_single_component = False
if len(components_to_extract) == 1:
new_base_name = base_name + f"_{components_to_extract[0]}"
new_base_name = base_name + f"_{component_names[0]}"
result_is_single_component = True
else:
new_base_name = base_name
Expand Down

0 comments on commit 0ebc88e

Please sign in to comment.