Skip to content

Commit e4e394b

Browse files
committed
Correctly add operators to animation workflow
1 parent 74f6711 commit e4e394b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/ansys/dpf/core/fields_container.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,11 +571,17 @@ def animate(self, save_as=None, deform_by=None, scale_factor=1.0, **kwargs):
571571
# Define the field extraction using the fields_container and indices
572572
extract_field_op = dpf.core.operators.utility.extract_field(self)
573573
to_render = extract_field_op.outputs.field
574+
# Add the operators to the workflow
575+
wf.add_operators([extract_field_op, forward_index])
576+
577+
# Treat multi-component fields by taking their norm
574578
n_components = self[0].component_count
575579
if n_components > 1:
576580
norm_op = dpf.core.operators.math.norm(extract_field_op.outputs.field)
581+
wf.add_operator(norm_op)
577582
to_render = norm_op.outputs.field
578583

584+
# Get time steps IDs and values
579585
loop_over = self.get_time_scoping()
580586
frequencies = self.time_freq_support.time_frequencies
581587
if frequencies is None:
@@ -586,8 +592,6 @@ def animate(self, save_as=None, deform_by=None, scale_factor=1.0, **kwargs):
586592

587593
wf.set_input_name("indices", extract_field_op.inputs.indices) # Have to do it this way
588594
wf.connect("indices", forward_index) # Otherwise not accepted
589-
# Add the operators to the workflow
590-
wf.add_operators([extract_field_op, forward_index])
591595

592596
deform = True
593597
# Define whether to deform and what with
@@ -627,6 +631,10 @@ def animate(self, save_as=None, deform_by=None, scale_factor=1.0, **kwargs):
627631
extract_field_op_2.outputs.field, extract_scale_factor_op.outputs.field
628632
)
629633
wf.set_output_name("deform_by", divide_op.outputs.field)
634+
635+
wf.add_operators(
636+
[scale_factor_invert, extract_field_op_2, extract_scale_factor_op, divide_op]
637+
)
630638
else:
631639
scale_factor = None
632640
wf.set_output_name("to_render", to_render)

0 commit comments

Comments
 (0)