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

Method RequestData

Filters/Statistics/vtkStatisticsAlgorithm.cxx:467–559  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

465
466//------------------------------------------------------------------------------
467int vtkStatisticsAlgorithm::RequestData(
468 vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector)
469{
470 // Extract inputs
471 vtkTable* inData = vtkTable::GetData(inputVector[INPUT_DATA], 0);
472 auto* inModel = vtkStatisticalModel::GetData(inputVector[INPUT_MODEL], 0);
473 vtkTable* inParameters = vtkTable::GetData(inputVector[LEARN_PARAMETERS], 0);
474
475 // Extract outputs
476 vtkTable* outData = vtkTable::GetData(outputVector, OUTPUT_DATA);
477 auto* outModel = vtkStatisticalModel::GetData(outputVector, OUTPUT_MODEL);
478 vtkTable* outTest = vtkTable::GetData(outputVector, OUTPUT_TEST);
479
480 // If input data table is not null then shallow copy it to output and count ghosts
481 // if they are present (so that Learn, Derive, Test, and Assess can use it to
482 // adjust sample counts as needed).
483 if (inData)
484 {
485 outData->ShallowCopy(inData);
486 outData->GetRowData()->RemoveArray(vtkDataSetAttributes::GhostArrayName());
487
488 // Only count ghosts if GhostsToSkip has 1+ bits set and we have ghost marks.
489 vtkUnsignedCharArray* ghosts = inData->GetRowData()->GetGhostArray();
490 if (ghosts && this->GhostsToSkip)
491 {
492 ::GhostsCounter counter(ghosts, this->GhostsToSkip);
493 vtkSMPTools::For(0, ghosts->GetNumberOfValues(), counter);
494 this->NumberOfGhosts = counter.GlobalNumberOfGhosts;
495 }
496 else
497 {
498 this->NumberOfGhosts = 0;
499 }
500 }
501
502 // If there are any columns selected in the buffer which have not been
503 // turned into a request by RequestSelectedColumns(), add them now.
504 // There should be no effect if vtkStatisticsAlgorithmPrivate::Buffer is empty.
505 // This is here to accommodate the simpler user interfaces in OverView for
506 // univariate and bivariate algorithms which will not call RequestSelectedColumns()
507 // on their own.
508 this->RequestSelectedColumns();
509
510 // Calculate primary statistics if requested
511 if (this->LearnOption)
512 {
513 // First, learn primary statistics from data; otherwise, only use input model as output model
514 this->Learn(inData, inParameters, outModel);
515
516 // Second, aggregate learned models with input model if one is present
517 if (inModel)
518 {
519 vtkDataObjectCollection* models = vtkDataObjectCollection::New();
520 models->AddItem(inModel);
521 models->AddItem(outModel);
522 this->Aggregate(models, outModel);
523 models->Delete();
524 }

Callers

nothing calls this directly

Calls 15

AssessMethod · 0.95
GhostArrayNameFunction · 0.85
GetRowDataMethod · 0.80
DeleteMethod · 0.65
GetDataFunction · 0.50
ForFunction · 0.50
NewFunction · 0.50
ShallowCopyMethod · 0.45
RemoveArrayMethod · 0.45
GetGhostArrayMethod · 0.45
GetNumberOfValuesMethod · 0.45

Tested by

no test coverage detected