@@ -517,6 +517,11 @@ def animate(self, save_as=None, deform_by=None, scale_factor=1.0, **kwargs):
517
517
# Define the field extraction using the fields_container and indices
518
518
extract_field_op = dpf .core .operators .utility .extract_field (self )
519
519
520
+ loop_over = self .get_time_scoping ()
521
+ frequencies = self .time_freq_support .time_frequencies
522
+ if frequencies is None :
523
+ raise ValueError ("The fields_container has no time_frequencies." )
524
+
520
525
# TODO /!\ We should be using a mechanical::time_selector, however it is not wrapped.
521
526
522
527
wf .set_input_name ("indices" , extract_field_op .inputs .indices ) # Have to do it this way
@@ -543,8 +548,8 @@ def animate(self, save_as=None, deform_by=None, scale_factor=1.0, **kwargs):
543
548
f"!= len(self)={ len (self )} )." )
544
549
else :
545
550
deform = False
546
- if deform :
547
551
552
+ if deform :
548
553
scale_factor_fc = dpf .core .animator .scale_factor_to_fc (scale_factor , deform_by )
549
554
scale_factor_invert = dpf .core .operators .math .invert_fc (scale_factor_fc )
550
555
# Extraction of the field of interest based on index
@@ -559,22 +564,12 @@ def animate(self, save_as=None, deform_by=None, scale_factor=1.0, **kwargs):
559
564
560
565
divide_op = dpf .core .operators .math .component_wise_divide (
561
566
extract_field_op_2 .outputs .field , extract_scale_factor_op .outputs .field )
562
- # Get the mesh from the field to render
563
- get_mesh_op = dpf .core .operators .mesh .from_field (extract_field_op .outputs .field )
564
- # Get the coordinates field from the mesh
565
- get_coordinates_op = dpf .core .operators .mesh .node_coordinates (get_mesh_op .outputs .mesh )
566
- # Addition to the scaled deformation field
567
- add_op = dpf .core .operators .math .add (divide_op .outputs .field ,
568
- get_coordinates_op .outputs .coordinates_as_field )
569
- wf .set_output_name ("deform_by" , add_op .outputs .field )
570
- add_op .progress_bar = False
567
+ wf .set_output_name ("deform_by" , divide_op .outputs .field )
571
568
else :
572
569
scale_factor = None
573
570
wf .set_output_name ("to_render" , extract_field_op .outputs .field )
574
571
wf .progress_bar = False
575
572
576
- loop_over = self .get_time_scoping ()
577
- frequencies = self .time_freq_support .time_frequencies
578
573
loop_over_field = dpf .core .fields_factory .field_from_array (
579
574
frequencies .data [loop_over .ids - 1 ])
580
575
loop_over_field .scoping .ids = loop_over .ids
0 commit comments