Fixing memory leak in Streamlines

Fixing memory leak introduced bacause of increamenting the num
of steps in the wrong place while generating streamlines
This commit is contained in:
ayenpure 2018-04-20 13:48:54 -07:00
parent 7d5e99c0b6
commit 617b8668c7

@ -239,10 +239,9 @@ public:
{ {
// Irrespective of what the advected status of the particle is, // Irrespective of what the advected status of the particle is,
// we need to set the output position as the last step taken by // we need to set the output position as the last step taken by
// the particle, and increase the number of steps take by 1. // the particle.
Pos.Set(idx, pt); Pos.Set(idx, pt);
vtkm::Id nSteps = Steps.Get(idx); vtkm::Id nSteps = Steps.Get(idx);
Steps.Set(idx, ++nSteps);
// Update the step for streamline storing portals. // Update the step for streamline storing portals.
// This includes updating the history and the valid points. // This includes updating the history and the valid points.
@ -250,6 +249,9 @@ public:
History.Set(loc, pt); History.Set(loc, pt);
ValidPoint.Set(loc, 1); ValidPoint.Set(loc, 1);
// Increase the number of steps take by 1.
Steps.Set(idx, ++nSteps);
// Check if the particle has completed the maximum steps required. // Check if the particle has completed the maximum steps required.
// If yes, set it to teminated. // If yes, set it to teminated.
if (nSteps == MaxSteps) if (nSteps == MaxSteps)