VTK  9.0.1
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 =========================================================================*/
36 #ifndef vtkReduceTable_h
37 #define vtkReduceTable_h
38 
39 #include "vtkInfovisCoreModule.h" // For export macro
40 #include "vtkTableAlgorithm.h"
41 
42 #include <map> // For ivar
43 #include <set> // For ivar
44 #include <vector> // For ivar
45 
46 class vtkVariant;
47 
48 class VTKINFOVISCORE_EXPORT vtkReduceTable : public vtkTableAlgorithm
49 {
50 public:
51  static vtkReduceTable* New();
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
56 
61  vtkGetMacro(IndexColumn, vtkIdType);
62  vtkSetMacro(IndexColumn, vtkIdType);
64 
66 
70  vtkGetMacro(NumericalReductionMethod, int);
71  vtkSetMacro(NumericalReductionMethod, int);
73 
75 
79  vtkGetMacro(NonNumericalReductionMethod, int);
80  vtkSetMacro(NonNumericalReductionMethod, int);
82 
88  int GetReductionMethodForColumn(vtkIdType col);
89 
94  void SetReductionMethodForColumn(vtkIdType col, int method);
95 
99  enum
100  {
103  MODE
104  };
105 
106 protected:
107  vtkReduceTable();
108  ~vtkReduceTable() override;
109 
111 
116  void InitializeOutputTable(vtkTable* input, vtkTable* output);
117 
122  void AccumulateIndexValues(vtkTable* input);
123 
127  void PopulateIndexColumn(vtkTable* output);
128 
134  void PopulateDataColumn(vtkTable* input, vtkTable* output, vtkIdType col);
135 
140  void ReduceValuesToMean(vtkTable* input, vtkTable* output, vtkIdType row, vtkIdType col,
141  std::vector<vtkIdType> oldRows);
142 
147  void ReduceValuesToMedian(vtkTable* input, vtkTable* output, vtkIdType row, vtkIdType col,
148  std::vector<vtkIdType> oldRows);
149 
154  void ReduceValuesToMode(vtkTable* input, vtkTable* output, vtkIdType row, vtkIdType col,
155  std::vector<vtkIdType> oldRows);
156 
158  std::set<vtkVariant> IndexValues;
159  std::map<vtkVariant, std::vector<vtkIdType> > NewRowToOldRowsMap;
160  std::map<vtkIdType, int> ColumnReductionMethods;
161 
164 
165 private:
166  vtkReduceTable(const vtkReduceTable&) = delete;
167  void operator=(const vtkReduceTable&) = delete;
168 };
169 
170 #endif
vtkReduceTable::MEDIAN
@ MEDIAN
Definition: vtkReduceTable.h:102
vtkTableAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:62
vtkReduceTable::ColumnReductionMethods
std::map< vtkIdType, int > ColumnReductionMethods
Definition: vtkReduceTable.h:160
vtkReduceTable::MEAN
@ MEAN
Definition: vtkReduceTable.h:101
vtkTableAlgorithm
Superclass for algorithms that produce only vtkTables as output.
Definition: vtkTableAlgorithm.h:48
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkReduceTable
combine some of the rows of a table
Definition: vtkReduceTable.h:48
vtkVariant
A atomic type representing the union of many types.
Definition: vtkVariant.h:65
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkReduceTable::NumericalReductionMethod
int NumericalReductionMethod
Definition: vtkReduceTable.h:162
vtkReduceTable::NewRowToOldRowsMap
std::map< vtkVariant, std::vector< vtkIdType > > NewRowToOldRowsMap
Definition: vtkReduceTable.h:159
vtkReduceTable::IndexValues
std::set< vtkVariant > IndexValues
Definition: vtkReduceTable.h:158
vtkTableAlgorithm.h
vtkTableAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkReduceTable::IndexColumn
vtkIdType IndexColumn
Definition: vtkReduceTable.h:157
vtkReduceTable::NonNumericalReductionMethod
int NonNumericalReductionMethod
Definition: vtkReduceTable.h:163
vtkTableAlgorithm::New
static vtkTableAlgorithm * New()