VTK  9.6.20260226
vtkSortDataArray.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright 2003 Sandia Corporation
3// SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
4
67
68#ifndef vtkSortDataArray_h
69#define vtkSortDataArray_h
70
71#include "vtkCommonCoreModule.h" // For export macro
72#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_7_0
73#include "vtkObject.h"
74
75VTK_ABI_NAMESPACE_BEGIN
76class vtkIdList;
78
79class VTKCOMMONCORE_EXPORT vtkSortDataArray : public vtkObject
80{
81public:
83
89 void PrintSelf(ostream& os, vtkIndent indent) override;
91
96 static void Sort(vtkIdList* keys) { vtkSortDataArray::Sort(keys, 0); }
97 static void Sort(vtkAbstractArray* keys) { vtkSortDataArray::Sort(keys, 0); }
98
100
104 static void Sort(vtkIdList* keys, int dir);
105 static void Sort(vtkAbstractArray* keys, int dir);
107
114 static void Sort(vtkAbstractArray* keys, vtkAbstractArray* values)
115 {
116 vtkSortDataArray::Sort(keys, values, 0);
117 }
118 static void Sort(vtkAbstractArray* keys, vtkIdList* values)
119 {
120 vtkSortDataArray::Sort(keys, values, 0);
121 }
122
124
130 static void Sort(vtkAbstractArray* keys, vtkAbstractArray* values, int dir);
131 static void Sort(vtkAbstractArray* keys, vtkIdList* values, int dir);
133
141 static void SortArrayByComponent(vtkAbstractArray* arr, int k)
142 {
144 }
145
153 static void SortArrayByComponent(vtkAbstractArray* arr, int k, int dir);
154
156
179 static void GenerateSortIndices(vtkAbstractArray* arr, int k, vtkIdType* idx);
180 VTK_DEPRECATED_IN_9_7_0("Use the overload that takes vtkAbstractArray*")
182 int dataType, void* dataIn, vtkIdType numKeys, int numComp, int k, vtkIdType* idx);
183 static void ShuffleArray(vtkAbstractArray* arr, vtkIdType* idx, int dir);
184 VTK_DEPRECATED_IN_9_7_0("Use the overload that takes vtkAbstractArray*")
185 static void ShuffleArray(vtkIdType* idx, int vtkNotUsed(dataType), vtkIdType vtkNotUsed(numKeys),
186 int vtkNotUsed(numComp), vtkAbstractArray* arr, void* vtkNotUsed(dataIn), int dir)
187 {
188 vtkSortDataArray::ShuffleArray(arr, idx, dir);
189 }
190 static void ShuffleIdList(
191 vtkIdType* idx, vtkIdType sze, vtkIdList* arrayIn, vtkIdType* dataIn, int dir);
193
194protected:
197
198 // A more efficient sort for single component arrays. This is delegated to
199 // by the methods above (if appropriate).
201 VTK_DEPRECATED_IN_9_7_0("Use the overload that takes vtkAbstractArray*")
202 static void GenerateSort1Indices(int dataType, void* dataIn, vtkIdType numKeys, vtkIdType* idx);
203
204 // A more efficient shuffle for single component arrays. This is delegated to
205 // by the methods above (if appropriate).
206 static void Shuffle1Array(vtkAbstractArray* arr, vtkIdType* idx, int dir);
207 VTK_DEPRECATED_IN_9_7_0("Use the overload that does not take void*")
208 static void Shuffle1Array(vtkIdType* idx, int vtkNotUsed(dataType), vtkIdType vtkNotUsed(numKeys),
209 vtkAbstractArray* arr, void* vtkNotUsed(dataIn), int dir)
210 {
211 vtkSortDataArray::Shuffle1Array(arr, idx, dir);
212 }
213
214private:
215 vtkSortDataArray(const vtkSortDataArray&) = delete;
216 void operator=(const vtkSortDataArray&) = delete;
217};
218
219VTK_ABI_NAMESPACE_END
220#endif // vtkSortDataArray_h
Abstract superclass for all arrays.
list of point or cell ids
Definition vtkIdList.h:133
a simple class to control print indentation
Definition vtkIndent.h:108
provides several methods for sorting VTK arrays.
static void ShuffleArray(vtkAbstractArray *arr, vtkIdType *idx, int dir)
The following are general functions which can be used to produce an ordering, and/or sort various typ...
static void Sort(vtkIdList *keys)
Sorts the given array in ascending order.
static void Sort(vtkAbstractArray *keys, vtkIdList *values, int dir)
Sorts the given key/value pairs based on the keys (the keys are expected to be 1-tuples,...
static void ShuffleIdList(vtkIdType *idx, vtkIdType sze, vtkIdList *arrayIn, vtkIdType *dataIn, int dir)
The following are general functions which can be used to produce an ordering, and/or sort various typ...
static void Sort(vtkAbstractArray *keys, vtkAbstractArray *values)
Sorts the given key/value pairs based on the keys (the keys are expected to be 1-tuples,...
static void SortArrayByComponent(vtkAbstractArray *arr, int k)
Sorts the given data array using the specified component as a key.
static void Sort(vtkIdList *keys, int dir)
Sorts the given array in either ascending (dir=0) or descending (dir!=0) order.
static void SortArrayByComponent(vtkAbstractArray *arr, int k, int dir)
Sorts the given data array using the specified component as a key.
static void Shuffle1Array(vtkAbstractArray *arr, vtkIdType *idx, int dir)
static void GenerateSort1Indices(vtkAbstractArray *arr, vtkIdType *idx)
static void Sort(vtkAbstractArray *keys, int dir)
Sorts the given array in either ascending (dir=0) or descending (dir!=0) order.
static vtkSortDataArray * New()
Standard VTK methods for instantiating, managing type, and printing information about this class.
~vtkSortDataArray() override
static void GenerateSortIndices(vtkAbstractArray *arr, int k, vtkIdType *idx)
The following are general functions which can be used to produce an ordering, and/or sort various typ...
static void Sort(vtkAbstractArray *keys, vtkAbstractArray *values, int dir)
Sorts the given key/value pairs based on the keys (the keys are expected to be 1-tuples,...
static void Sort(vtkAbstractArray *keys)
static vtkIdType * InitializeSortIndices(vtkIdType numKeys)
The following are general functions which can be used to produce an ordering, and/or sort various typ...
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods for instantiating, managing type, and printing information about this class.
static void Sort(vtkAbstractArray *keys, vtkIdList *values)
#define VTK_DEPRECATED_IN_9_7_0(reason)
int vtkIdType
Definition vtkType.h:363