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

Method ExtractSelectedRows

Filters/Extraction/vtkExtractSelection.cxx:1100–1136  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1098
1099//------------------------------------------------------------------------------
1100void vtkExtractSelection::ExtractSelectedRows(
1101 vtkTable* input, vtkTable* output, vtkSignedCharArray* rowsInside, bool extractAll)
1102{
1103 const vtkIdType numRows = input->GetNumberOfRows();
1104 vtkNew<vtkIdTypeArray> originalRowIds;
1105 originalRowIds->SetName("vtkOriginalRowIds");
1106
1107 output->GetRowData()->CopyFieldOff("vtkOriginalRowIds");
1108 output->GetRowData()->CopyStructure(input->GetRowData());
1109
1110 if (!extractAll)
1111 {
1112 for (vtkIdType rowId = 0; rowId < numRows; ++rowId)
1113 {
1114 signed char isInside = rowsInside->GetTypedComponent(rowId, 0);
1115 if (isInside)
1116 {
1117 output->InsertNextRow(input->GetRow(rowId));
1118 originalRowIds->InsertNextValue(rowId);
1119 }
1120 }
1121 }
1122 else
1123 {
1124 output->ShallowCopy(input);
1125 originalRowIds->SetNumberOfTuples(numRows);
1126 vtkSMPTools::For(0, numRows,
1127 [&](vtkIdType beginRowId, vtkIdType endRowId)
1128 {
1129 for (vtkIdType rowId = beginRowId; rowId < endRowId; ++rowId)
1130 {
1131 originalRowIds->SetValue(rowId, rowId);
1132 }
1133 });
1134 }
1135 output->AddColumn(originalRowIds);
1136}
1137
1138//------------------------------------------------------------------------------
1139void vtkExtractSelection::PrintSelf(ostream& os, vtkIndent indent)

Callers 1

ExtractElementsMethod · 0.95

Calls 14

CopyFieldOffMethod · 0.80
GetRowDataMethod · 0.80
InsertNextRowMethod · 0.80
GetRowMethod · 0.80
ForFunction · 0.50
GetNumberOfRowsMethod · 0.45
SetNameMethod · 0.45
CopyStructureMethod · 0.45
GetTypedComponentMethod · 0.45
InsertNextValueMethod · 0.45
ShallowCopyMethod · 0.45
SetNumberOfTuplesMethod · 0.45

Tested by

no test coverage detected