VTK  9.2.6
vtkReduceTable.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkReduceTable.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 =========================================================================*/
39 #ifndef vtkReduceTable_h
40 #define vtkReduceTable_h
41 
42 #include "vtkInfovisCoreModule.h" // For export macro
43 #include "vtkTableAlgorithm.h"
44 
45 #include <map> // For ivar
46 #include <set> // For ivar
47 #include <vector> // For ivar
48 
49 class vtkVariant;
50 
51 class VTKINFOVISCORE_EXPORT vtkReduceTable : public vtkTableAlgorithm
52 {
53 public:
54  static vtkReduceTable* New();
56  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
59 
64  vtkGetMacro(IndexColumn, vtkIdType);
65  vtkSetMacro(IndexColumn, vtkIdType);
67 
69 
73  vtkGetMacro(NumericalReductionMethod, int);
74  vtkSetMacro(NumericalReductionMethod, int);
76 
78 
82  vtkGetMacro(NonNumericalReductionMethod, int);
83  vtkSetMacro(NonNumericalReductionMethod, int);
85 
91  int GetReductionMethodForColumn(vtkIdType col);
92 
97  void SetReductionMethodForColumn(vtkIdType col, int method);
98 
102  enum
103  {
106  MODE
107  };
108 
109 protected:
110  vtkReduceTable();
111  ~vtkReduceTable() override;
112 
114 
119  void InitializeOutputTable(vtkTable* input, vtkTable* output);
120 
125  void AccumulateIndexValues(vtkTable* input);
126 
130  void PopulateIndexColumn(vtkTable* output);
131 
137  void PopulateDataColumn(vtkTable* input, vtkTable* output, vtkIdType col);
138 
143  void ReduceValuesToMean(vtkTable* input, vtkTable* output, vtkIdType row, vtkIdType col,
144  std::vector<vtkIdType> oldRows);
145 
150  void ReduceValuesToMedian(vtkTable* input, vtkTable* output, vtkIdType row, vtkIdType col,
151  std::vector<vtkIdType> oldRows);
152 
157  void ReduceValuesToMode(vtkTable* input, vtkTable* output, vtkIdType row, vtkIdType col,
158  std::vector<vtkIdType> oldRows);
159 
161  std::set<vtkVariant> IndexValues;
162  std::map<vtkVariant, std::vector<vtkIdType>> NewRowToOldRowsMap;
163  std::map<vtkIdType, int> ColumnReductionMethods;
164 
167 
168 private:
169  vtkReduceTable(const vtkReduceTable&) = delete;
170  void operator=(const vtkReduceTable&) = delete;
171 };
172 
173 #endif
std::set< vtkVariant > IndexValues
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkTableAlgorithm * New()
Store vtkAlgorithm input/output information.
int vtkIdType
Definition: vtkType.h:332
A atomic type representing the union of many types.
Definition: vtkVariant.h:69
std::map< vtkVariant, std::vector< vtkIdType > > NewRowToOldRowsMap
std::map< vtkIdType, int > ColumnReductionMethods
a simple class to control print indentation
Definition: vtkIndent.h:39
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:73
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
Superclass for algorithms that produce only vtkTables as output.
Store zero or more vtkInformation instances.
int NonNumericalReductionMethod
vtkIdType IndexColumn
combine some of the rows of a table
int NumericalReductionMethod