72 vtkInformation *vtkNotUsed(request),
73 vtkInformationVector **inputVector,
74 vtkInformationVector *outputVector)
76 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
77 vtkInformation *outInfo = outputVector->GetInformationObject(0);
79 vtkPolyData *input = vtkPolyData::SafeDownCast(
80 inInfo->Get(vtkDataObject::DATA_OBJECT()));
81 vtkPolyData *output = vtkPolyData::SafeDownCast(
82 outInfo->Get(vtkDataObject::DATA_OBJECT()));
84 if (input->GetNumberOfPoints() < 1)
91 vtkErrorMacro(
"Error: IntegrationTimeArrayName not specified");
97 if (!integrationTimeArray)
99 vtkErrorMacro(
"Error: IntegrationTimeArray with name specified does not exist");
103 vtkDataArray* velocityArray = NULL;
111 vtkErrorMacro(
"Error: VelocityArray with name specified does not exist");
116 int numberOfCells = input->GetNumberOfCells();
118 vtkPoints* outputPoints = vtkPoints::New();
119 vtkCellArray* outputVerts = vtkCellArray::New();
121 vtkDoubleArray* outputTimeArray = vtkDoubleArray::New();
124 vtkDoubleArray* outputVelocityArray = vtkDoubleArray::New();
126 outputVelocityArray->SetNumberOfComponents(3);
133 vtkMaskPolyData* mask = vtkMaskPolyData::New();
134 mask->SetInputData(input);
141 vtkPolyData* subset = mask->GetOutput();
143 int numberOfSubsetCells = subset->GetNumberOfCells();
145 for (j=0; j<numberOfSubsetCells; j++)
147 vtkPolyLine* polyLine = vtkPolyLine::SafeDownCast(subset->GetCell(j));
153 vtkIdList* pointIds = polyLine->GetPointIds();
154 int numberOfPointIds = pointIds->GetNumberOfIds();
156 double integrationTime = injectionOffset;
158 for (k=0; k<numberOfPointIds-1; k++)
160 double time0 = integrationTimeArray->GetTuple1(pointIds->GetId(k));
161 double time1 = integrationTimeArray->GetTuple1(pointIds->GetId(k+1));
162 if (time0 < integrationTime && time1 < integrationTime)
166 if (time0 > integrationTime && time1 > integrationTime)
173 double pcoord = (integrationTime - time0) / (time1 - time0);
174 double interpolatedPoint[3];
176 vtkIdType pointId = outputPoints->InsertNextPoint(interpolatedPoint);
177 outputVerts->InsertNextCell(1);
178 outputVerts->InsertCellPoint(pointId);
179 outputTimeArray->InsertNextValue(integrationTime + injectionOffset);
184 outputVelocityArray->InsertNextTuple(velocity);
186 integrationTime += this->
DeltaT;
187 if (integrationTime > time1)
191 if (integrationTime + injectionOffset > this->
TracingEnd)
196 if (integrationTime + injectionOffset > this->
TracingEnd)
204 output->SetPoints(outputPoints);
205 output->SetVerts(outputVerts);
206 output->GetPointData()->AddArray(outputTimeArray);
209 output->GetPointData()->AddArray(outputVelocityArray);
212 outputPoints->Delete();
213 outputVerts->Delete();
214 outputTimeArray->Delete();
217 outputVelocityArray->Delete();
Resample time-resolved streamlines into discrete Lagrangian particle positions at successive time ste...
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
void PrintSelf(std::ostream &os, vtkIndent indent) override
vtkStandardNewMacro(vtkvmtkStreamlineToParticlesFilter)