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

Method ShuffleIdList

Common/Core/vtkSortDataArray.cxx:304–326  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Given a set of indices (after sorting), copy the ids from a pre-sorted id array to a final, post-sorted array.

Source from the content-addressed store, hash-verified

302// Given a set of indices (after sorting), copy the ids from a pre-sorted
303// id array to a final, post-sorted array.
304void vtkSortDataArray::ShuffleIdList(
305 vtkIdType* idx, vtkIdType sze, vtkIdList* arrayIn, vtkIdType* preSort, int dir)
306{
307 vtkIdType* postSort = new vtkIdType[sze];
308
309 if (dir == 0) // ascending
310 {
311 for (vtkIdType i = 0; i < sze; ++i)
312 {
313 postSort[i] = preSort[idx[i]];
314 }
315 }
316 else
317 {
318 vtkIdType end = sze - 1;
319 for (vtkIdType i = 0; i < sze; ++i)
320 {
321 postSort[i] = preSort[idx[end - i]];
322 }
323 }
324
325 arrayIn->SetArray(postSort, sze);
326}
327
328//------------------------------------------------------------------------------
329// Sort a position index based on the values in the abstract array. Once

Callers

nothing calls this directly

Calls 1

SetArrayMethod · 0.45

Tested by

no test coverage detected