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

Method Summarize

Filters/Extraction/vtkExtractDataArraysOverTime.cxx:373–496  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

371
372//------------------------------------------------------------------------------
373vtkSmartPointer<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());

Callers 1

AddTimeStepInternalMethod · 0.95

Calls 15

GetFieldAssociationMethod · 0.80
NewOrderStatisticsMethod · 0.80
GetRowDataMethod · 0.80
ResetRequestsMethod · 0.80
GetValueByNameMethod · 0.80
assertFunction · 0.50
NewFunction · 0.50
GetNumberOfTuplesMethod · 0.45

Tested by

no test coverage detected