------------------------------------------------------------------------------
| 412 | |
| 413 | //------------------------------------------------------------------------------ |
| 414 | void vtkSortDataArray::SortArrayByComponent(vtkAbstractArray* arr, int k, int dir) |
| 415 | { |
| 416 | // Check input |
| 417 | if (arr == nullptr) |
| 418 | { |
| 419 | return; |
| 420 | } |
| 421 | vtkIdType numKeys = arr->GetNumberOfTuples(); |
| 422 | int nc = arr->GetNumberOfComponents(); |
| 423 | |
| 424 | if (k < 0 || k >= nc) |
| 425 | { |
| 426 | vtkGenericWarningMacro( |
| 427 | "Cannot sort by column " << k << " since the array only has columns 0 through " << (nc - 1)); |
| 428 | return; |
| 429 | } |
| 430 | |
| 431 | // Perform the sort |
| 432 | vtkIdType* idx = vtkSortDataArray::InitializeSortIndices(numKeys); |
| 433 | |
| 434 | void* dataIn = arr->GetVoidPointer(0); |
| 435 | int dataType = arr->GetDataType(); |
| 436 | vtkSortDataArray::GenerateSortIndices(dataType, dataIn, numKeys, nc, k, idx); |
| 437 | |
| 438 | vtkSortDataArray::ShuffleArray(idx, dataType, numKeys, nc, arr, dataIn, dir); |
| 439 | |
| 440 | // Clean up |
| 441 | delete[] idx; |
| 442 | } |
| 443 | |
| 444 | //------------------------------------------------------------------------------ |
| 445 | void vtkSortDataArray::PrintSelf(ostream& os, vtkIndent indent) |
nothing calls this directly
no test coverage detected