Skip to content
Snippets Groups Projects
Commit 4551bc74 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fix off-by-one index

parent a658d98f
No related branches found
No related tags found
No related merge requests found
...@@ -24,17 +24,17 @@ If(newh) ...@@ -24,17 +24,17 @@ If(newh)
EndIf EndIf
If(all) If(all)
maxstep = 1; NUM_FRAMES = 1;
For i In {1:PostProcessing.NbViews} For i In {1:PostProcessing.NbViews}
View[i-1].TimeStep = 0; View[i-1].TimeStep = 0;
// compute max num of steps // compute max num of steps
If(View[i-1].Visible) If(View[i-1].Visible)
If(View[i-1].NbTimeStep > maxstep) If(View[i-1].NbTimeStep > NUM_FRAMES)
maxstep = View[i-1].NbTimeStep; NUM_FRAMES = View[i-1].NbTimeStep;
EndIf EndIf
EndIf EndIf
EndFor EndFor
For index In {1:maxstep} For index In {1:NUM_FRAMES}
Draw; Draw;
If(method == WHIRLGIF) If(method == WHIRLGIF)
Print Sprintf("/tmp/tmp%03g.gif", index); Print Sprintf("/tmp/tmp%03g.gif", index);
...@@ -54,19 +54,19 @@ If(!all) ...@@ -54,19 +54,19 @@ If(!all)
View[i-1].Visible = 0; View[i-1].Visible = 0;
View[i-1].TimeStep = 0; View[i-1].TimeStep = 0;
EndFor EndFor
index = 0; NUM_FRAMES = 0;
For i In {1:PostProcessing.NbViews} For i In {1:PostProcessing.NbViews}
// Display view i-1 // Display view i-1
View[i-1].Visible = 1; View[i-1].Visible = 1;
// Loop on all solutions in view i-1 // Loop on all solutions in view i-1
For j In {1:View[i-1].NbTimeStep} For j In {1:View[i-1].NbTimeStep}
index++; NUM_FRAMES++;
Draw; Draw;
If(method == WHIRLGIF) If(method == WHIRLGIF)
Print Sprintf("/tmp/tmp%03g.gif", index); Print Sprintf("/tmp/tmp%03g.gif", NUM_FRAMES);
EndIf EndIf
If(method == MPEG_ENCODE || method == MENCODER) If(method == MPEG_ENCODE || method == MENCODER)
Print Sprintf("/tmp/tmp%03g.jpg", index); Print Sprintf("/tmp/tmp%03g.jpg", NUM_FRAMES);
EndIf EndIf
View[i-1].TimeStep++; View[i-1].TimeStep++;
EndFor EndFor
...@@ -74,7 +74,6 @@ If(!all) ...@@ -74,7 +74,6 @@ If(!all)
EndFor EndFor
EndIf EndIf
NUM_FRAMES = index;
ENCODER = method; ENCODER = method;
Include "encode.script"; Include "encode.script";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment