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

Method Finalize

Filters/FlowPaths/vtkParticlePathFilter.cxx:253–304  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

251
252//------------------------------------------------------------------------------
253int vtkParticlePathFilter::Finalize(
254 vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector)
255{
256 int retVal = this->Superclass::Finalize(request, inputVector, outputVector);
257
258 vtkInformation* outInfo = outputVector->GetInformationObject(0);
259 auto output = vtkPolyData::SafeDownCast(vtkDataObject::GetData(outInfo));
260 output->Initialize();
261
262 if (!this->Points->GetNumberOfPoints())
263 {
264 // Nothing to do in this process
265 return retVal;
266 }
267
268 std::size_t nPoints = 0;
269 for (auto& pair : this->Paths)
270 {
271 nPoints += pair.second.size();
272 }
273
274 vtkNew<vtkPoints> points;
275 points->SetNumberOfPoints(nPoints);
276
277 vtkNew<vtkIdList> mapping;
278 mapping->SetNumberOfIds(points->GetNumberOfPoints());
279 vtkIdType i = -1;
280
281 // We create a mapping from the indexing in Points to the polydata we actually want to output.
282 for (auto& pair : this->Paths)
283 {
284 const auto& path = pair.second;
285 for (vtkIdType pointId : path)
286 {
287 mapping->SetId(++i, pointId);
288 }
289 }
290
291 output->GetPointData()->CopyAllocate(this->Points->GetPointData(), mapping->GetNumberOfIds());
292 output->GetPointData()->CopyData(this->Points->GetPointData(), mapping);
293 points->GetData()->InsertTuplesStartingAt(0, mapping, this->Points->GetPoints()->GetData());
294 output->SetPoints(points);
295
296 vtkNew<vtkCellArray> verts, lines;
297
298 FillCellArrays(verts, lines, this->Paths);
299
300 output->SetVerts(verts);
301 output->SetLines(lines);
302
303 return retVal;
304}
305
306VTK_ABI_NAMESPACE_END

Callers

nothing calls this directly

Calls 15

GetInformationObjectMethod · 0.80
SetNumberOfIdsMethod · 0.80
SetVertsMethod · 0.80
SetLinesMethod · 0.80
FillCellArraysFunction · 0.70
GetDataFunction · 0.50
InitializeMethod · 0.45
GetNumberOfPointsMethod · 0.45
sizeMethod · 0.45
SetNumberOfPointsMethod · 0.45
SetIdMethod · 0.45
CopyAllocateMethod · 0.45

Tested by

no test coverage detected