Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/ansys/dpf/core/dpf_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,11 @@ def _type_to_input_method(self):
model,
generic_data_container,
any,
streams_container,
)

out = [
(streams_container.StreamsContainer, self._api.operator_connect_streams),
(any.Any, self._api.operator_connect_any),
(bool, self._api.operator_connect_bool),
((int, Enum), self._api.operator_connect_int),
Expand Down
4 changes: 4 additions & 0 deletions src/ansys/dpf/core/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,11 @@ def _type_to_input_method(self):
model,
generic_data_container,
any,
streams_container,
)

out = [
(streams_container.StreamsContainer, self._api.work_flow_connect_streams),
(any.Any, self._api.work_flow_connect_any),
(bool, self._api.work_flow_connect_bool),
((int, Enum), self._api.work_flow_connect_int),
Expand Down Expand Up @@ -307,9 +309,11 @@ def _type_to_output_method(self):
generic_data_container,
any,
collection_base,
streams_container,
)

out = [
(streams_container.StreamsContainer, self._api.work_flow_getoutput_streams),
(any.Any, self._api.work_flow_getoutput_as_any),
(bool, self._api.work_flow_getoutput_bool),
(int, self._api.work_flow_getoutput_int),
Expand Down
11 changes: 11 additions & 0 deletions tests/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1381,3 +1381,14 @@ def test_input_any(server_type):
output = op.get_output(pin=0, output_type=dpf.core.types.field)
assert isinstance(output, dpf.core.Field)
assert len(output.data_as_list) == len(data)


def test_operator_input_output_streams(server_type, simple_bar):
data_source = dpf.core.DataSources(simple_bar, server=server_type)
streams_op = dpf.core.operators.metadata.streams_provider(server=server_type)
streams_op.inputs.data_sources.connect(data_source)
streams = streams_op.outputs.streams_container()
time_provider = dpf.core.operators.metadata.time_freq_provider(server=server_type)
time_provider.connect(pin=3, inpt=streams)
times = time_provider.outputs.time_freq_support()
assert times
21 changes: 21 additions & 0 deletions tests/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,27 @@ def test_input_any(server_type):
assert isinstance(output, dpf.core.Field)


def test_workflow_input_output_streams(server_type, simple_bar):
data_source = dpf.core.DataSources(simple_bar, server=server_type)
streams_op = dpf.core.operators.metadata.streams_provider(server=server_type)
streams_op.inputs.data_sources.connect(data_source)
wf_1 = dpf.core.Workflow(server=server_type)
wf_1.add_operator(streams_op)
wf_1.set_output_name("output_streams", streams_op.outputs.streams_container)

streams = wf_1.get_output("output_streams", dpf.core.types.streams_container)

time_provider = dpf.core.operators.metadata.time_freq_provider(server=server_type)

wf_2 = dpf.core.Workflow(server=server_type)
wf_2.add_operator(time_provider)
wf_2.set_input_name("input_streams", time_provider.inputs.streams_container)
wf_2.set_output_name("output_tfs", time_provider.outputs.time_freq_support)
wf_2.connect("input_streams", streams)
times = wf_2.get_output("output_tfs", dpf.core.types.time_freq_support)
assert times


def main():
test_connect_field_workflow()
velocity_acceleration = conftest.resolve_test_file("velocity_acceleration.rst", "rst_operators")
Expand Down