------------------------------------------------------------------------------
| 1785 | |
| 1786 | //------------------------------------------------------------------------------ |
| 1787 | bool 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 | //------------------------------------------------------------------------------ |
| 1838 | void vtkPStreamTracer::Prepend(vtkPolyData* pathPoly, vtkPolyData* headPoly) |
no test coverage detected