Skip to content

Commit b777188

Browse files
authored
Fix Operator.eval() in case output pin 0 is not named "fields_container" (#1527)
Signed-off-by: paul.profizi <[email protected]>
1 parent 105d296 commit b777188

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/ansys/dpf/core/outputs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ def _get_given_output(self, input_type_name):
112112
corresponding_pins.append(pin)
113113
return corresponding_pins
114114

115+
def __getitem__(self, index):
116+
return self._outputs[index]
117+
115118
def __str__(self):
116119
docstr = "Available outputs:\n"
117120
for output in self._outputs:

src/ansys/dpf/core/results.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,12 @@ def eval(self):
263263
>>> fc = disp.on_all_time_freqs.eval()
264264
265265
"""
266-
fc = self.__call__().outputs.fields_container()
266+
outputs = self.__call__().outputs
267+
if hasattr(outputs, "fields_container"):
268+
fc = outputs.fields_container()
269+
else:
270+
# Support operators where the first output is not named "field_container"
271+
fc = outputs[0]()
267272
if self._specific_fc_type == "shape":
268273
fc = ElShapeFieldsContainer(fields_container=fc._get_ownership(), server=fc._server)
269274
elif self._specific_fc_type == "body":

0 commit comments

Comments
 (0)