Skip to content

Commit

Permalink
Fix Operator.eval() in case output pin 0 is not named "fields_contain…
Browse files Browse the repository at this point in the history
…er" (#1527)

Signed-off-by: paul.profizi <paul.profizi@ansys.com>
  • Loading branch information
PProfizi authored Apr 23, 2024
1 parent 105d296 commit b777188
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/ansys/dpf/core/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ def _get_given_output(self, input_type_name):
corresponding_pins.append(pin)
return corresponding_pins

def __getitem__(self, index):
return self._outputs[index]

def __str__(self):
docstr = "Available outputs:\n"
for output in self._outputs:
Expand Down
7 changes: 6 additions & 1 deletion src/ansys/dpf/core/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,12 @@ def eval(self):
>>> fc = disp.on_all_time_freqs.eval()
"""
fc = self.__call__().outputs.fields_container()
outputs = self.__call__().outputs
if hasattr(outputs, "fields_container"):
fc = outputs.fields_container()
else:
# Support operators where the first output is not named "field_container"
fc = outputs[0]()
if self._specific_fc_type == "shape":
fc = ElShapeFieldsContainer(fields_container=fc._get_ownership(), server=fc._server)
elif self._specific_fc_type == "body":
Expand Down

0 comments on commit b777188

Please sign in to comment.