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

Method RequestDataPlain

Filters/ParallelStatistics/vtkGenerateStatistics.cxx:914–1303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

912}
913
914int vtkGenerateStatistics::RequestDataPlain(vtkDataObject* dataObject, vtkStatisticalModel* model)
915{
916 int allCenterings = 0;
917 std::vector<int> centering;
918 std::vector<vtkSmartPointer<vtkAbstractArray>> columns;
919 bool ok = true;
920 // Use the input array specifications to fetch the arrays specified for this dataObject.
921 int numArrays = this->GetNumberOfInputArraySpecifications();
922 for (int ii = 0; ii < numArrays; ++ii)
923 {
924 int association;
925 auto array = this->GetInputArray(ii, dataObject, association, /*requestedComponent*/ 0);
926 if (!array)
927 {
928 ok = false;
929 break;
930 }
931 columns.push_back(array);
932 centering.push_back(association);
933 allCenterings |= (1 << association);
934 }
935
936 if (!ok)
937 {
938 // SILENTLY FAIL: Missing an array in request results in no model for this block.
939 // This is not an error as this data object may be part of composite data that
940 // has the requested arrays in other blocks.
941 return 1;
942 }
943
944 double trainingFraction = this->TrainingFraction;
945 constexpr int pointsBit = 1 << vtkDataObject::FieldAssociations::FIELD_ASSOCIATION_POINTS;
946 constexpr int cellsBit = 1 << vtkDataObject::FieldAssociations::FIELD_ASSOCIATION_CELLS;
947 constexpr int globalBit = 1 << vtkDataObject::FieldAssociations::FIELD_ASSOCIATION_NONE;
948 constexpr int rowsBit = 1 << vtkDataObject::FieldAssociations::FIELD_ASSOCIATION_ROWS;
949 constexpr int vertsBit = 1 << vtkDataObject::FieldAssociations::FIELD_ASSOCIATION_VERTICES;
950 constexpr int edgesBit = 1 << vtkDataObject::FieldAssociations::FIELD_ASSOCIATION_EDGES;
951
952 if ((allCenterings & (pointsBit | cellsBit)) && (allCenterings & (rowsBit | vertsBit | edgesBit)))
953 {
954 vtkErrorMacro(
955 "Cannot combine point/cell and non-geometric associations in a single data-object.");
956 return 0;
957 }
958 else if ((allCenterings & (rowsBit | globalBit)) && (allCenterings & ~(rowsBit | globalBit)))
959 {
960 vtkErrorMacro(
961 "Cannot combine table data with other data (graph or geometric) in a single data-object.");
962 return 0;
963 }
964 // clang-format off
965 else if (
966 (allCenterings & (edgesBit | vertsBit | globalBit)) &&
967 (allCenterings & ~(edgesBit | vertsBit | globalBit)))
968 {
969 vtkErrorMacro("Cannot combine graph data with other data (tabular or geometric) in a single data-object.");
970 return 0;
971 }

Callers 1

Calls 15

GenerateSubsetMethod · 0.95
SubsetArrayMethod · 0.95
CellToPointSamplesMethod · 0.95
FieldDataToSamplesMethod · 0.95
EdgeToVertexSamplesMethod · 0.95
DumpToFunction · 0.85
GetInputArrayMethod · 0.80
GetRowDataMethod · 0.80

Tested by

no test coverage detected