1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkArraySort.h 5 6 ------------------------------------------------------------------------- 7 Copyright 2008 Sandia Corporation. 8 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 9 the U.S. Government retains certain rights in this software. 10 ------------------------------------------------------------------------- 11 12 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 13 All rights reserved. 14 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 15 16 This software is distributed WITHOUT ANY WARRANTY; without even 17 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 18 PURPOSE. See the above copyright notice for more information. 19 20 =========================================================================*/ 21 22 // .NAME vtkArraySort - Controls sorting of sparse array coordinates. 23 // 24 // .SECTION Description 25 // vtkArraySort stores an ordered set of dimensions along which the 26 // values stored in a sparse array should be sorted. 27 // 28 // Convenience constructors are provided for specifying one, two, and 29 // three dimensions. To sort along more than three dimensions, use the 30 // default constructor, SetDimensions(), and operator[] to assign each 31 // dimension to be sorted. 32 // 33 // .SECTION See Also 34 // vtkSparseArray 35 // 36 // .SECTION Thanks 37 // Developed by Timothy M. Shead (tshead@sandia.gov) at Sandia National 38 // Laboratories. 39 40 #ifndef vtkArraySort_h 41 #define vtkArraySort_h 42 43 #include "vtkCommonCoreModule.h" // For export macro 44 #include "vtkSystemIncludes.h" 45 #include "vtkArrayCoordinates.h" 46 #include <vector> 47 48 class VTKCOMMONCORE_EXPORT vtkArraySort 49 { 50 public: 51 typedef vtkArrayCoordinates::DimensionT DimensionT; 52 53 // Description: 54 // Create an empty set of dimensions. Use SetDimensions() and 55 // operator[] to populate them. 56 vtkArraySort(); 57 58 // Description: 59 // Sorts an array along one dimension. 60 explicit vtkArraySort(DimensionT i); 61 62 // Description: 63 // Sorts an array along two dimensions. 64 vtkArraySort(DimensionT i, DimensionT j); 65 66 // Description: 67 // Sorts an array along three dimensions. 68 vtkArraySort(DimensionT i, DimensionT j, DimensionT k); 69 70 // Description: 71 // Return the number of dimensions for sorting. 72 DimensionT GetDimensions() const; 73 74 // Description: 75 // Set the number of dimensions to be sorted. Note that this method 76 // resets every dimension to zero, so you must set every dimension 77 // explicitly using operator[] after calling SetDimensions(). 78 void SetDimensions(DimensionT dimensions); 79 80 // Description: 81 // Returns the i-th dimension to be sorted. 82 DimensionT& operator[](DimensionT i); 83 84 // Description: 85 // Returns the i-th dimension to be sorted. 86 const DimensionT& operator[](DimensionT i) const; 87 88 89 // Description: 90 // Equality comparison 91 bool operator==(const vtkArraySort& rhs) const; 92 93 // Description: 94 // Inequality comparison 95 bool operator!=(const vtkArraySort& rhs) const; 96 97 // Description: 98 // Serialization 99 VTKCOMMONCORE_EXPORT friend ostream& operator<<( 100 ostream& stream, const vtkArraySort& rhs); 101 102 private: 103 //BTX 104 std::vector<DimensionT> Storage; 105 //ETX 106 }; 107 108 #endif 109 110 // VTK-HeaderTest-Exclude: vtkArraySort.h 111