------------------------------------------------------------------------------
| 371 | |
| 372 | //------------------------------------------------------------------------------ |
| 373 | vtkSmartPointer<vtkDataObject> vtkExtractDataArraysOverTime::vtkInternal::Summarize( |
| 374 | vtkDataObject* input) |
| 375 | { |
| 376 | assert(input != nullptr); |
| 377 | |
| 378 | const int attributeType = this->Self->GetFieldAssociation(); |
| 379 | vtkFieldData* inFD = input->GetAttributesAsFieldData(attributeType); |
| 380 | assert(inFD != nullptr); |
| 381 | |
| 382 | const vtkIdType numIDs = inFD->GetNumberOfTuples(); |
| 383 | if (numIDs <= 0) |
| 384 | { |
| 385 | return nullptr; |
| 386 | } |
| 387 | |
| 388 | // Make a vtkTable containing all fields plus possibly point coordinates. |
| 389 | // We'll pass the table, after splitting multi-component arrays, to |
| 390 | // vtkDescriptiveStatistics to get information about all the selected data at |
| 391 | // this timestep. |
| 392 | vtkNew<vtkTable> statInput; // Input table created from input's attributes |
| 393 | vtkNew<vtkTable> statSummary; // Reformatted statistics filter output |
| 394 | vtkNew<vtkSplitColumnComponents> splitColumns; |
| 395 | auto descrStats = this->Self->NewDescriptiveStatistics(); |
| 396 | auto orderStats = this->Self->NewOrderStatistics(); |
| 397 | descrStats->SetLearnOption(true); |
| 398 | descrStats->SetDeriveOption(true); |
| 399 | descrStats->SetAssessOption(false); |
| 400 | orderStats->SetLearnOption(true); |
| 401 | orderStats->SetDeriveOption(true); |
| 402 | orderStats->SetAssessOption(false); |
| 403 | |
| 404 | vtkDataSetAttributes* statInDSA = statInput->GetRowData(); |
| 405 | statInDSA->ShallowCopy(inFD); |
| 406 | // Add point coordinates to selected data if we are tracking point-data. |
| 407 | if (attributeType == vtkDataObject::POINT) |
| 408 | { |
| 409 | vtkDataSet* ds = vtkDataSet::SafeDownCast(input); |
| 410 | vtkNew<vtkDoubleArray> pX[3]; |
| 411 | for (int comp = 0; comp < 3; ++comp) |
| 412 | { |
| 413 | pX[comp]->SetNumberOfComponents(1); |
| 414 | pX[comp]->SetNumberOfTuples(numIDs); |
| 415 | } |
| 416 | for (vtkIdType cc = 0; cc < numIDs; ++cc) |
| 417 | { |
| 418 | double* coords = ds->GetPoint(cc); |
| 419 | for (int comp = 0; comp < 3; ++comp) |
| 420 | { |
| 421 | pX[comp]->SetValue(cc, coords[comp]); |
| 422 | } |
| 423 | } |
| 424 | vtkExtractArraysAssignUniqueCoordNames(statInDSA, pX[0], pX[1], pX[2]); |
| 425 | } |
| 426 | splitColumns->SetInputDataObject(0, statInput); |
| 427 | splitColumns->SetCalculateMagnitudes(true); |
| 428 | splitColumns->Update(); |
| 429 | vtkTable* splits = splitColumns->GetOutput(); |
| 430 | descrStats->SetInputConnection(splitColumns->GetOutputPort()); |
no test coverage detected