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

Method SelectTableFromTable

Filters/Extraction/vtkConvertSelection.cxx:107–150  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

105
106//------------------------------------------------------------------------------
107int vtkConvertSelection::SelectTableFromTable(
108 vtkTable* selTable, vtkTable* dataTable, vtkIdTypeArray* indices)
109{
110 std::set<vtkIdType> matching;
111 vtkNew<vtkIdList> list;
112 for (vtkIdType row = 0; row < selTable->GetNumberOfRows(); row++)
113 {
114 matching.clear();
115 bool initialized = false;
116 for (vtkIdType col = 0; col < selTable->GetNumberOfColumns(); col++)
117 {
118 vtkAbstractArray* from = selTable->GetColumn(col);
119 vtkAbstractArray* to = dataTable->GetColumnByName(from->GetName());
120 if (to)
121 {
122 to->LookupValue(selTable->GetValue(row, col), list);
123 if (!initialized)
124 {
125 matching.insert(list->GetPointer(0), list->GetPointer(0) + list->GetNumberOfIds());
126 initialized = true;
127 }
128 else
129 {
130 std::set<vtkIdType> intersection;
131 std::sort(list->GetPointer(0), list->GetPointer(0) + list->GetNumberOfIds());
132 std::set_intersection(matching.begin(), matching.end(), list->GetPointer(0),
133 list->GetPointer(0) + list->GetNumberOfIds(),
134 std::inserter(intersection, intersection.begin()));
135 matching = intersection;
136 }
137 }
138 }
139 for (const auto& match : matching)
140 {
141 indices->InsertNextValue(match);
142 }
143 if (row % 100 == 0)
144 {
145 double progress = 0.8 * row / selTable->GetNumberOfRows();
146 this->InvokeEvent(vtkCommand::ProgressEvent, &progress);
147 }
148 }
149 return 1;
150}
151
152//------------------------------------------------------------------------------
153int vtkConvertSelection::ConvertToIndexSelection(

Callers 1

ConvertMethod · 0.95

Calls 15

GetColumnByNameMethod · 0.80
InvokeEventMethod · 0.80
sortFunction · 0.50
GetNumberOfRowsMethod · 0.45
clearMethod · 0.45
GetNumberOfColumnsMethod · 0.45
GetColumnMethod · 0.45
GetNameMethod · 0.45
LookupValueMethod · 0.45
GetValueMethod · 0.45
insertMethod · 0.45
GetPointerMethod · 0.45

Tested by

no test coverage detected