MCPcopy Create free account
hub / github.com/Kitware/VTK / TraceOneStep

Method TraceOneStep

Filters/ParallelFlowPaths/vtkPStreamTracer.cxx:1787–1835  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1785
1786//------------------------------------------------------------------------------
1787bool vtkPStreamTracer::TraceOneStep(
1788 vtkPolyData* traceOut, vtkAbstractInterpolatedVelocityField* func, PStreamTracerPoint* point)
1789{
1790 double outPoint[3], outNormal[3];
1791
1792 vtkIdType lastPointIndex = LastPointIndex(traceOut);
1793 double lastPoint[3];
1794 // Continue the integration a bit further to obtain a point
1795 // outside. The main integration step can not always be used
1796 // for this, specially if the integration is not 2nd order.
1797 traceOut->GetPoint(lastPointIndex, lastPoint);
1798
1799 vtkInitialValueProblemSolver* ivp = this->Integrator;
1800 ivp->Register(this);
1801
1802 // Use Runge-Kutta2 it produces better results
1803 vtkNew<vtkRungeKutta2> tmpSolver;
1804 this->SetIntegrator(tmpSolver);
1805
1806 memcpy(outPoint, lastPoint, sizeof(double) * 3);
1807
1808 double timeStepTaken = this->SimpleIntegrate(nullptr, outPoint, this->LastUsedStepSize, func);
1809
1810 PRINT("Simple Integrate from :" << lastPoint[0] << " " << lastPoint[1] << " " << lastPoint[2]
1811 << " to " << outPoint[0] << " " << outPoint[1] << " "
1812 << outPoint[2]);
1813 double d = sqrt(vtkMath::Distance2BetweenPoints(lastPoint, outPoint));
1814
1815 this->SetIntegrator(ivp);
1816 ivp->UnRegister(this);
1817
1818 vtkDataArray* normals = traceOut->GetPointData()->GetArray("Normals");
1819 if (normals)
1820 {
1821 normals->GetTuple(lastPointIndex, outNormal);
1822 }
1823
1824 bool res = d > 0;
1825 if (res)
1826 {
1827 Assert(SameShape(traceOut->GetPointData(), this->Utils->GetProto()->GetTail()->GetPointData()),
1828 "Point data mismatch");
1829 point->Reseed(outPoint, outNormal, traceOut, lastPointIndex, point->GetPropagation() + d,
1830 point->GetIntegrationTime() + timeStepTaken);
1831 AssertEq(point->GetTail()->GetPointData()->GetNumberOfTuples(), 1);
1832 }
1833
1834 return res;
1835}
1836
1837//------------------------------------------------------------------------------
1838void vtkPStreamTracer::Prepend(vtkPolyData* pathPoly, vtkPolyData* headPoly)

Callers 1

RequestDataMethod · 0.95

Calls 15

LastPointIndexFunction · 0.85
PRINTFunction · 0.85
SameShapeFunction · 0.85
GetTailMethod · 0.80
GetProtoMethod · 0.80
ReseedMethod · 0.80
GetIntegrationTimeMethod · 0.80
sqrtFunction · 0.50
AssertFunction · 0.50
GetPointMethod · 0.45
RegisterMethod · 0.45
SimpleIntegrateMethod · 0.45

Tested by

no test coverage detected