Skip to content

Commit 3bee730

Browse files
fix: rename WorkflowData to WorkflowTopology
1 parent f314ada commit 3bee730

File tree

5 files changed

+49
-44
lines changed

5 files changed

+49
-44
lines changed

src/ansys/dpf/core/workflow.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
server_meet_version_and_raise,
4444
)
4545
from ansys.dpf.core import server as server_module
46-
from ansys.dpf.core.workflow_data.workflow_data import WorkflowData
46+
from ansys.dpf.core.workflow_topology.workflow_topology import WorkflowTopology
4747
from ansys.dpf.gate import (
4848
workflow_abstract_api,
4949
workflow_grpcapi,
@@ -954,12 +954,12 @@ def to_graphviz(self, path: Union[os.PathLike, str]):
954954
"""Saves the workflow to a GraphViz file."""
955955
return self._api.work_flow_export_graphviz(self, str(path))
956956

957-
def get_data(self):
958-
workflow_to_workflow_data_op = dpf_operator.Operator("workflow_to_workflow_data")
959-
workflow_to_workflow_data_op.inputs.workflow.connect(self)
960-
workflow_data_container = workflow_to_workflow_data_op.outputs.workflow_data()
957+
def get_topology(self):
958+
workflow_to_workflow_topology_op = dpf_operator.Operator("workflow_to_workflow_topology")
959+
workflow_to_workflow_topology_op.inputs.workflow.connect(self)
960+
workflow_topology_container = workflow_to_workflow_topology_op.outputs.workflow_topology()
961961

962-
return WorkflowData(workflow_data_container)
962+
return WorkflowTopology(workflow_topology_container)
963963

964964
def __del__(self):
965965
try:

src/ansys/dpf/core/workflow_data/data_connection.py renamed to src/ansys/dpf/core/workflow_topology/data_connection.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,14 @@ def target_operator(self):
4242
from ansys.dpf.core.dpf_operator import Operator
4343

4444
if self._target_operator is None:
45-
self._target_operator = self._container.get_property(
46-
"target_operator", Operator)
45+
self._target_operator = self._container.get_property("target_operator", Operator)
4746

4847
return self._target_operator
4948

5049
@property
5150
def target_pin_id(self):
5251
if self._target_pin_id is None:
53-
self._target_pin_id = self._container.get_property(
54-
"target_pin_id", int)
52+
self._target_pin_id = self._container.get_property("target_pin_id", int)
5553

5654
return self._target_pin_id
5755

@@ -66,7 +64,7 @@ def __str__(self):
6664
" - target_operator:\n"
6765
f"{indent(self.target_operator.name, indents)}\n"
6866
" - target_pin_id:\n"
69-
f"{indent(self.target_pin_id, indents)}\n"
67+
f"{indent(self.target_pin_id, indents)}"
7068
)
7169

7270

@@ -88,4 +86,4 @@ def __str__(self):
8886
from ansys.dpf.core.helpers.utils import indent
8987

9088
indents = (" ", " - ")
91-
return f"{"\n".join([indent(data_connection, *indents) for data_connection in self])}\n"
89+
return "\n".join([indent(data_connection, *indents) for data_connection in self])

src/ansys/dpf/core/workflow_data/exposed_pin.py renamed to src/ansys/dpf/core/workflow_topology/exposed_pin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __str__(self):
6464
" - operator:\n"
6565
f"{indent(self.operator.name, indents)}\n"
6666
" - pin_id:\n"
67-
f"{indent(self.pin_id, indents)}\n"
67+
f"{indent(self.pin_id, indents)}"
6868
)
6969

7070
def __repr__(self) -> str:
@@ -89,4 +89,4 @@ def __str__(self):
8989
from ansys.dpf.core.helpers.utils import indent
9090

9191
indents = (" ", " - ")
92-
return f"{"\n".join([indent(exposed_pin, *indents) for exposed_pin in self])}\n"
92+
return "\n".join([indent(exposed_pin, *indents) for exposed_pin in self])

src/ansys/dpf/core/workflow_data/operator_connection.py renamed to src/ansys/dpf/core/workflow_topology/operator_connection.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,14 @@ def source_operator(self):
3636
from ansys.dpf.core.dpf_operator import Operator
3737

3838
if self._source_operator is None:
39-
self._source_operator = self._container.get_property(
40-
"source_operator", Operator)
39+
self._source_operator = self._container.get_property("source_operator", Operator)
4140

4241
return self._source_operator
4342

4443
@property
4544
def source_pin_id(self):
4645
if self._source_pin_id is None:
47-
self._source_pin_id = self._container.get_property(
48-
"source_pin_id", int)
46+
self._source_pin_id = self._container.get_property("source_pin_id", int)
4947

5048
return self._source_pin_id
5149

@@ -54,16 +52,14 @@ def target_operator(self):
5452
from ansys.dpf.core.dpf_operator import Operator
5553

5654
if self._target_operator is None:
57-
self._target_operator = self._container.get_property(
58-
"target_operator", Operator)
55+
self._target_operator = self._container.get_property("target_operator", Operator)
5956

6057
return self._target_operator
6158

6259
@property
6360
def target_pin_id(self):
6461
if self._target_pin_id is None:
65-
self._target_pin_id = self._container.get_property(
66-
"target_pin_id", int)
62+
self._target_pin_id = self._container.get_property("target_pin_id", int)
6763

6864
return self._target_pin_id
6965

@@ -80,7 +76,7 @@ def __str__(self):
8076
" - target_operator:\n"
8177
f"{indent(self.target_operator.name, indents)}\n"
8278
" - target_pin_id:\n"
83-
f"{indent(self.target_pin_id, indents)}\n"
79+
f"{indent(self.target_pin_id, indents)}"
8480
)
8581

8682

@@ -102,4 +98,4 @@ def __str__(self):
10298
from ansys.dpf.core.helpers.utils import indent
10399

104100
indents = (" ", " - ")
105-
return f"{"\n".join([indent(operator_connection, *indents) for operator_connection in self])}\n"
101+
return "\n".join([indent(operator_connection, *indents) for operator_connection in self])

src/ansys/dpf/core/workflow_data/workflow_data.py renamed to src/ansys/dpf/core/workflow_topology/workflow_topology.py

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from ansys.dpf.core.custom_container_base import CustomContainerBase
2424

2525

26-
class WorkflowData(CustomContainerBase):
26+
class WorkflowTopology(CustomContainerBase):
2727
def __init__(self, *args) -> None:
2828
super().__init__(*args)
2929

@@ -38,69 +38,80 @@ def operators(self):
3838
from ansys.dpf.core import OperatorsCollection
3939

4040
if self._operators is None:
41-
self._operators = self._container.get_property(
42-
"operators", OperatorsCollection)
41+
self._operators = self._container.get_property("operators", OperatorsCollection)
4342

4443
return self._operators
4544

4645
@property
4746
def operator_connections(self):
4847
from ansys.dpf.core import GenericDataContainersCollection
49-
from ansys.dpf.core.workflow_data.operator_connection import OperatorConnectionsCollection
48+
from ansys.dpf.core.workflow_topology.operator_connection import (
49+
OperatorConnectionsCollection,
50+
)
5051

5152
if self._operator_connections is None:
5253
self._operator_connections = OperatorConnectionsCollection(
53-
self._container.get_property("operator_connections", GenericDataContainersCollection))
54+
self._container.get_property(
55+
"operator_connections", GenericDataContainersCollection
56+
)
57+
)
5458

5559
return self._operator_connections
5660

5761
@property
5862
def data_connections(self):
5963
from ansys.dpf.core import GenericDataContainersCollection
60-
from ansys.dpf.core.workflow_data.data_connection import DataConnectionsCollection
64+
from ansys.dpf.core.workflow_topology.data_connection import DataConnectionsCollection
6165

6266
if self._data_connections is None:
6367
self._data_connections = DataConnectionsCollection(
64-
self._container.get_property("data_connections", GenericDataContainersCollection))
68+
self._container.get_property("data_connections", GenericDataContainersCollection)
69+
)
6570

6671
return self._data_connections
6772

6873
@property
6974
def exposed_inputs(self):
7075
from ansys.dpf.core import GenericDataContainersCollection
71-
from ansys.dpf.core.workflow_data.exposed_pin import ExposedPinsCollection
76+
from ansys.dpf.core.workflow_topology.exposed_pin import ExposedPinsCollection
7277

7378
if self._exposed_inputs is None:
74-
self._exposed_inputs = ExposedPinsCollection(self._container.get_property(
75-
"exposed_inputs", GenericDataContainersCollection))
79+
self._exposed_inputs = ExposedPinsCollection(
80+
self._container.get_property("exposed_inputs", GenericDataContainersCollection)
81+
)
7682

7783
return self._exposed_inputs
7884

7985
@property
8086
def exposed_outputs(self):
8187
from ansys.dpf.core import GenericDataContainersCollection
82-
from ansys.dpf.core.workflow_data.exposed_pin import ExposedPinsCollection
88+
from ansys.dpf.core.workflow_topology.exposed_pin import ExposedPinsCollection
8389

8490
if self._exposed_outputs is None:
85-
self._exposed_outputs = ExposedPinsCollection(self._container.get_property(
86-
"exposed_outputs", GenericDataContainersCollection))
91+
self._exposed_outputs = ExposedPinsCollection(
92+
self._container.get_property("exposed_outputs", GenericDataContainersCollection)
93+
)
8794

8895
return self._exposed_outputs
8996

9097
def __str__(self):
9198
from ansys.dpf.core.helpers.utils import indent
9299

93-
indents = (" ", " - ")
100+
def indent_operators(operators):
101+
indents = (" ", " - ")
102+
return "\n".join([indent(operator.name, *indents) for operator in operators])
103+
104+
indents = " "
94105
return (
95-
"WorkflowData with properties:\n"
106+
"WorkflowTopology with properties:\n"
96107
f" - operators (len: {len(self.operators)}):\n"
97-
f"{"\n".join([indent(operator.name, *indents) for operator in self.operators])}\n"
108+
f"{indent_operators(self.operators)}\n"
98109
f" - operator_connections (len: {len(self.operator_connections)}):\n"
99-
f"{indent(self.operator_connections, " ")}\n"
110+
f"{indent(self.operator_connections, indents)}\n"
100111
f" - data_connections (len: {len(self.data_connections)}):\n"
101-
f"{indent(self.data_connections, " ")}\n"
112+
f"{indent(self.data_connections, indents)}\n"
102113
f" - exposed_inputs (len: {len(self.exposed_inputs)}):\n"
103-
f"{indent(self.exposed_inputs, " ")}\n"
114+
f"{indent(self.exposed_inputs, indents)}\n"
104115
f" - exposed_outputs (len: {len(self.exposed_outputs)}):\n"
105-
f"{indent(self.exposed_outputs, " ")}\n"
116+
f"{indent(self.exposed_outputs, indents)}"
106117
)

0 commit comments

Comments
 (0)