Commit 921fac16 authored by Dave DeMarle's avatar Dave DeMarle Committed by Berk Geveci
Browse files

bug 14453 fix for stream tracer

per http://www.vtk.org/Bug/view.php?id=14453

thanks Jorge for the patch

Change-Id: Ief67c8224f1d39b2c918bf24d3f4f347ee5a3835
parent efb1793c
...@@ -947,25 +947,6 @@ void vtkStreamTracer::Integrate(vtkPointData *input0Data, ...@@ -947,25 +947,6 @@ void vtkStreamTracer::Integrate(vtkPointData *input0Data,
break; break;
} }
// 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;
}
accumTime += stepTaken / speed;
// Calculate propagation (using the same units as MaximumPropagation
propagation += fabs( stepSize.Interval );
// This is the next starting point // This is the next starting point
for(i=0; i<3; i++) for(i=0; i<3; i++)
{ {
...@@ -979,6 +960,20 @@ void vtkStreamTracer::Integrate(vtkPointData *input0Data, ...@@ -979,6 +960,20 @@ void vtkStreamTracer::Integrate(vtkPointData *input0Data,
memcpy(lastPoint, point2, 3*sizeof(double)); memcpy(lastPoint, point2, 3*sizeof(double));
break; break;
} }
// It is not enough to use the starting point for stagnation calculation
// Use average speed to check if it is below stagnation threshold
double speed2 = vtkMath::Norm(velocity);
if ( (speed+speed2)/2 <= this->TerminalSpeed )
{
retVal = STAGNATION;
break;
}
accumTime += stepTaken / speed;
// Calculate propagation (using the same units as MaximumPropagation
propagation += fabs( stepSize.Interval );
// Make sure we use the dataset found by the vtkAbstractInterpolatedVelocityField // Make sure we use the dataset found by the vtkAbstractInterpolatedVelocityField
input = func->GetLastDataSet(); input = func->GetLastDataSet();
inputPD = input->GetPointData(); inputPD = input->GetPointData();
...@@ -994,7 +989,7 @@ void vtkStreamTracer::Integrate(vtkPointData *input0Data, ...@@ -994,7 +989,7 @@ void vtkStreamTracer::Integrate(vtkPointData *input0Data,
// Calculate cell length and speed to be used in unit conversions // Calculate cell length and speed to be used in unit conversions
input->GetCell(func->GetLastCellId(), cell); input->GetCell(func->GetLastCellId(), cell);
cellLength = sqrt(static_cast<double>(cell->GetLength2())); cellLength = sqrt(static_cast<double>(cell->GetLength2()));
speed = vtkMath::Norm(velocity); speed = speed2;
// Interpolate all point attributes on current point // Interpolate all point attributes on current point
func->GetLastWeights(weights); func->GetLastWeights(weights);
InterpolatePoint(outputPD, inputPD, nextPoint, cell->PointIds, weights, this->HasMatchingPointAttributes); InterpolatePoint(outputPD, inputPD, nextPoint, cell->PointIds, weights, this->HasMatchingPointAttributes);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment