VTK  9.1.0
vtkSortDataArray.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkSortDataArray.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15
16/*
17 * Copyright 2003 Sandia Corporation.
18 * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
19 * license for use of this work by or on behalf of the
20 * U.S. Government. Redistribution and use in source and binary forms, with
21 * or without modification, are permitted provided that this Notice and any
22 * statement of authorship are reproduced on all copies.
23 */
24
85#ifndef vtkSortDataArray_h
86#define vtkSortDataArray_h
87
88#include "vtkCommonCoreModule.h" // For export macro
89#include "vtkObject.h"
90
91class vtkIdList;
93
94class VTKCOMMONCORE_EXPORT vtkSortDataArray : public vtkObject
95{
96public:
98
104 void PrintSelf(ostream& os, vtkIndent indent) override;
106
111 static void Sort(vtkIdList* keys) { vtkSortDataArray::Sort(keys, 0); }
112 static void Sort(vtkAbstractArray* keys) { vtkSortDataArray::Sort(keys, 0); }
113
115
119 static void Sort(vtkIdList* keys, int dir);
120 static void Sort(vtkAbstractArray* keys, int dir);
122
129 static void Sort(vtkAbstractArray* keys, vtkAbstractArray* values)
130 {
131 vtkSortDataArray::Sort(keys, values, 0);
132 }
133 static void Sort(vtkAbstractArray* keys, vtkIdList* values)
134 {
135 vtkSortDataArray::Sort(keys, values, 0);
136 }
137
139
145 static void Sort(vtkAbstractArray* keys, vtkAbstractArray* values, int dir);
146 static void Sort(vtkAbstractArray* keys, vtkIdList* values, int dir);
148
156 static void SortArrayByComponent(vtkAbstractArray* arr, int k)
157 {
159 }
160
168 static void SortArrayByComponent(vtkAbstractArray* arr, int k, int dir);
169
171
195 int dataType, void* dataIn, vtkIdType numKeys, int numComp, int k, vtkIdType* idx);
196 static void ShuffleArray(vtkIdType* idx, int dataType, vtkIdType numKeys, int numComp,
197 vtkAbstractArray* arr, void* dataIn, int dir);
198 static void ShuffleIdList(
199 vtkIdType* idx, vtkIdType sze, vtkIdList* arrayIn, vtkIdType* dataIn, int dir);
201
202protected:
205
206 // A more efficient sort for single component arrays. This is delegated to
207 // by the methods above (if appropriate).
208 static void GenerateSort1Indices(int dataType, void* dataIn, vtkIdType numKeys, vtkIdType* idx);
209
210 // A more efficient shuffle for single component arrays. This is delegated to
211 // by the methods above (if appropriate).
212 static void Shuffle1Array(
213 vtkIdType* idx, int dataType, vtkIdType numKeys, vtkAbstractArray* arr, void* dataIn, int dir);
214
215private:
216 vtkSortDataArray(const vtkSortDataArray&) = delete;
217 void operator=(const vtkSortDataArray&) = delete;
218};
219
220#endif // vtkSortDataArray_h
Abstract superclass for all arrays.
list of point or cell ids
Definition: vtkIdList.h:140
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract base class for most VTK objects
Definition: vtkObject.h:73
provides several methods for sorting VTK arrays.
static void Shuffle1Array(vtkIdType *idx, int dataType, vtkIdType numKeys, vtkAbstractArray *arr, void *dataIn, int dir)
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 GenerateSortIndices(int dataType, void *dataIn, vtkIdType numKeys, int numComp, int k, vtkIdType *idx)
The following are general functions which can be used to produce an ordering, and/or sort various typ...
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 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 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 ShuffleArray(vtkIdType *idx, int dataType, vtkIdType numKeys, int numComp, vtkAbstractArray *arr, void *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)
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)
static void GenerateSort1Indices(int dataType, void *dataIn, vtkIdType numKeys, vtkIdType *idx)
@ dir
Definition: vtkX3D.h:330
int vtkIdType
Definition: vtkType.h:332