MantisBT - VTK
View Issue Details
0014453VTK(No Category)public2013-12-10 07:432013-12-20 15:57
Jorge 
Berk Geveci 
normalminorhave not tried
closedfixed 
6.0.0 
6.1.0 
Kitware
incorrect functionality
0014453: error with TerminalSpeed parameter in vtkStreamTracer
I have an StructuredPoints data-set with a vector field on points. In order to generate streamlines on it I use vtkStreamTracer. The range of the velocity goes from 0 to 150. I have found that if I set the TerminalSpeed to a number greater than 1 (for instance 1.5) then no streamline is generated even if the velocity at the starting point is above 90.

Tracing the code at vtkStreamTracer.cxx I reach the point where the problem seems to be:

// It is not enough to use the starting point for stagnation calculation
// Use delX/stepSize to calculate speed and check if it is below
// stagnation threshold
double disp[3];
for (i=0; i<3; i++)
  {
  disp[i] = point2[i] - point1[i];
  }
if ( (stepSize.Interval == 0) ||
     (vtkMath::Norm(disp) / fabs(stepSize.Interval) <= this->TerminalSpeed) )
  {
  retVal = STAGNATION;
  break;
  }

The problem I have seen is that stepSize.Interval is in LENGTH_UNIT and it is almost similar to vtkMath::Norm(disp).

I have changed the test to:

//////////////JOSP//////////////////
double timeTaken = stepTaken / speed;
//////////////JOSP//////////////////
if ( (stepSize.Interval == 0) ||
     (vtkMath::Norm(disp) / timeTaken <= this->TerminalSpeed) )
  {
  retVal = STAGNATION;
  break;
  }

accumTime += timeTaken;

The previous change "seems" to fix the problem. I'm not sure if this change could have other implication but in our application it works as expected. I would like to contribute with a fix if this is really a bug.
No tags attached.
png TerminalSpeedEqualTo0.1.png (32,236) 2013-12-10 07:54
https://www.vtk.org/Bug/file/9568/TerminalSpeedEqualTo0.1.png
png

png TerminalSpeedEqualTo10.png (24,289) 2013-12-10 07:56
https://www.vtk.org/Bug/file/9569/TerminalSpeedEqualTo10.png
png

png TerminalSpeedEqualTo10_Gerrit.png (28,354) 2013-12-18 03:52
https://www.vtk.org/Bug/file/9573/TerminalSpeedEqualTo10_Gerrit.png
png

rar dataset_velocity_2.rar (4,830,996) 2013-12-18 04:35
https://www.vtk.org/Bug/file/9574/dataset_velocity_2.rar
Issue History
2013-12-10 07:43JorgeNew Issue
2013-12-10 07:54JorgeFile Added: TerminalSpeedEqualTo0.1.png
2013-12-10 07:56JorgeFile Added: TerminalSpeedEqualTo10.png
2013-12-10 07:58JorgeNote Added: 0031918
2013-12-10 07:58JorgeNote Edited: 0031918bug_revision_view_page.php?bugnote_id=31918#r684
2013-12-16 18:17Dave DeMarleNote Added: 0031965
2013-12-16 18:17Dave DeMarleStatusbacklog => gerrit review
2013-12-16 18:17Dave DeMarleFixed in Version => 6.1.0
2013-12-17 20:45Berk GeveciNote Added: 0031995
2013-12-18 03:52JorgeFile Added: TerminalSpeedEqualTo10_Gerrit.png
2013-12-18 04:20JorgeNote Added: 0032016
2013-12-18 04:35JorgeFile Added: dataset_velocity_2.rar
2013-12-18 04:36JorgeNote Added: 0032017
2013-12-20 15:56Berk GeveciNote Added: 0032044
2013-12-20 15:57Berk GeveciStatusgerrit review => closed
2013-12-20 15:57Berk GeveciAssigned To => Berk Geveci
2013-12-20 15:57Berk GeveciResolutionopen => fixed

Notes
(0031918)
Jorge   
2013-12-10 07:58   
I have uploaded two results obtained after applying the fix.

TerminalSpeed=0.1 ==> TerminalSpeedEqualTo0.1.png

TerminaSpeed=10 ==> TerminalSpeedEqualTo10.png

Without the fix the picture TerminalSpeedEqualTo10.png has no streamline.

(0031965)
Dave DeMarle   
2013-12-16 18:17   
suggested patch is in for gerrit review

http://review.source.kitware.com/#/t/3734 [^]
(0031995)
Berk Geveci   
2013-12-17 20:45   
I uploaded an alternative implementation that should be slightly better. http://review.source.kitware.com/#/c/13833/ [^]
Can you please give it a try? Or send a dataset to try with?
(0032016)
Jorge   
2013-12-18 04:20   
I have checked the change and it works. It does not generate exactly the same results as expected because the speed to check STAGNATION is now computed in a different way as a mean velocity instead of uniform velocity as s/t. I think the results are correct. I have uploaded a picture of the new results obtained with the code from the gerrit review.
(0032017)
Jorge   
2013-12-18 04:36   
The uploaded file dataset_velocity_2.rar could be used to try.
(0032044)
Berk Geveci   
2013-12-20 15:56   
Fix merged to master.